<commit_before>###############################################################################
# Caleydo - Visualization for Molecular Biology - http://caleydo.org
# Copyright (c) The Caleydo Team. All rights reserved.
# Licensed under the new BSD license, available at http://caleydo.org/license
###############################################################################


from __future__ import absolute_import
from builtins import object
import os
import jsoncfg
import codecs
from ._utils import replace_nested_variables, extend
import logging


_log = logging.getLogger(__name__)
_c = {}
_preMergeChanges = {}


def get(item, section=None, default=None):
  key = item if section is None else section + '.' + item
  keys = key.split('.')
  act = _c
  for p in keys[0:-1]:
    act = act.get(p, {})
  v = act.get(keys[len(keys) - 1], None)

  def resolve(x):
    if '.' in x:  # assume absolute
      return get(x)
    else:
      return act.get(x, None)

  v = replace_nested_variables(v, resolve)
  # print key, v

  return v if v is not None else default


def set(item, value, section=None):
  global _c, _preMergeChanges
  key = item if section is None else section + '.' + item
  keys = key.split('.')
  act = _c
  for p in keys[0:-1]:
    if p not in act:<commit_msg>allow setting null config<commit_after>###############################################################################
# Caleydo - Visualization for Molecular Biology - http://caleydo.org
# Copyright (c) The Caleydo Team. All rights reserved.
# Licensed under the new BSD license, available at http://caleydo.org/license
###############################################################################


from __future__ import absolute_import
from builtins import object
import os
import jsoncfg
import codecs
from ._utils import replace_nested_variables, extend
import logging


_log = logging.getLogger(__name__)
_c = {}
_preMergeChanges = {}


def get(item, section=None, default=None):
  key = item if section is None else section + '.' + item
  keys = key.split('.')
  act = _c
  for p in keys[0:-1]:
    act = act.get(p, {})
  last_key = keys[len(keys) - 1]

  if last_key not in act:
    # prop does not exist
    return default

  v = act[last_key]

  def resolve(x):
    if '.' in x:  # assume absolute
      return get(x)
    else:
      return act.get(x, None)

  v = replace_nested_variables(v, resolve)
  # print key, v

  return v


def set(item, value, section=None):
  global _c, _preMergeChanges
  key = item if section is None else section + '.' + item
  keys = key.split('.')
  act = _c
  for p in keys[0:-1]:
    if p not in act:
{'fraction_non_alphanumeric': 0.21567135793077216, 'fraction_numerical': 0.003803727653100038, 'mean_word_length': 3.8884758364312266, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1271938', 'n_tokens_mistral': 812, 'n_tokens_neox': 777, 'n_words': 273}