<commit_before># -*- coding: utf8 -*-
#
# Module CORE
#
# Part of Nutils: open source numerical utilities for Python. Jointly developed
# by HvZ Computational Engineering, TU/e Multiscale Engineering Fluid Dynamics,
# and others. More info at http://nutils.org <<EMAIL>>. (c) 2014

"""
The core module provides a collection of low level constructs that have no
dependencies on other nutils modules. Primarily for internal use.
"""

from __future__ import print_function, division
import sys, functools, os

globalproperties = {
  'nprocs': 1,
  'outdir': '~/public_html',
  'verbose': 6,
  'richoutput': False,
  'tbexplore': False,
  'imagetype': 'png',
  'symlink': False,
  'recache': False,
  'dot': False,
  'profile': False,
}
try:
  nutilsrc = os.path.expanduser( '~/.nutilsrc' )
  exec( open(nutilsrc).read(), {}, globalproperties )
except IOError:
  pass # file does not exist
except:
  exc_value, frames = sys.exc_info()
  exc_str = '\n'.join( [ repr(exc_value) ] + [ str(f) for f in frames ] )
  print( 'Skipping .nutilsrc: {}'.format(exc_str) )

_nodefault = object()
def getprop( name, default=_nodefault, frame=None ):
  """Access a semi-global property.

  The use of global variables is discouraged, as changes can go unnoticed and
  lead to abscure failure. The getprop mechanism makes local variables accesible
  (read only) from nested scopes, but not from the encompassing scope.

  >>> def f():
  >>>   print getprop('myval')
  >>> 
  >>> def main():
  >>>   __myval__ = 2
  >>>   f()

  Args:
      name (str): Property name, corresponds to __name__ local variable.
      default: Optional default value.

  Returns:
      The object corresponding to the first __name__ encountered in a higher
      scope. If none found, return default. If no default specified, raise
      NameError.
  """
<commit_msg>add rc-file location ~/.config/nutils/config<commit_after># -*- coding: utf8 -*-
#
# Module CORE
#
# Part of Nutils: open source numerical utilities for Python. Jointly developed
# by HvZ Computational Engineering, TU/e Multiscale Engineering Fluid Dynamics,
# and others. More info at http://nutils.org <<EMAIL>>. (c) 2014

"""
The core module provides a collection of low level constructs that have no
dependencies on other nutils modules. Primarily for internal use.
"""

from __future__ import print_function, division
import sys, functools, os

globalproperties = {
  'nprocs': 1,
  'outdir': '~/public_html',
  'verbose': 6,
  'richoutput': False,
  'tbexplore': False,
  'imagetype': 'png',
  'symlink': False,
  'recache': False,
  'dot': False,
  'profile': False,
}

for nutilsrc in ['~/.config/nutils/config', '~/.nutilsrc']:
  nutilsrc = os.path.expanduser( nutilsrc )
  if not os.path.isfile( nutilsrc ):
    continue
  try:
    exec( open(nutilsrc).read(), {}, globalproperties )
  except:
    exc_value, frames = sys.exc_info()
    exc_str = '\n'.join( [ repr(exc_value) ] + [ str(f) for f in frames ] )
    print( 'Skipping .nutilsrc: {}'.format(exc_str) )
  break

_nodefault = object()
def getprop( name, default=_nodefault, frame=None ):
  """Access a semi-global property.

  The use of global variables is discouraged, as changes can go unnoticed and
  lead to abscure failure. The getprop mechanism makes local variables accesible
  (read only) from nested scopes, but not from the encompassing scope.

  >>> def f():
  >>>   print getprop('myval')
  >>> 
  >>> def main():
  >>>   __myval__ = 2
  >>>   f()

  Args:
      name (str): Property name, corresponds to __name__ local variable.
      default: Optional default value.

  Returns:
      The object corresponding to the first __name__ encountered in a higher
      scope. If none found, return default. If no default specified, raise
      NameError.
  """

{'fraction_non_alphanumeric': 0.12221041445270989, 'fraction_numerical': 0.004250797024442083, 'mean_word_length': 3.6945137157107233, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7007419', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1167, 'n_words': 425}