Update self with values from a dictionary
        mapping file path [str] to `FileFlags` enum
167528
def update(self, file_dict):
        
        for key, val in file_dict.items():
            if key in self.file_dict:
                self.file_dict[key] |= val
            else:
                self.file_dict[key] = val
208521
def _filenames_from_arg(filename):
    """"""
    if isinstance(filename, string_types):
        filenames = [filename]
    elif isinstance(filename, (list, tuple)):
        filenames = filename
    else:
        raise Exception('filename argument must be string, list or tuple')
    for fn in filenames:
        if not os.path.exists(fn):
            raise ValueError('file not found: %s' % fn)
        if not os.path.isfile(fn):
            raise ValueError('not a file: %s' % fn)
    return filenames
321385
function mapAllNames(path) {
    log("[%s] Mapping %s", self.parentModuleName, path);
    fs.readdirSync(path).forEach(function(p){
      var absPath = PATH.resolve(path+PATH.sep+p);
      var lstat = fs.lstatSync(absPath);

      if(lstat.isFile() && isModule(p)) {
        var name = getModuleName(p);
        self.updateNameCache(name, absPath);
      } else if(! isIgnoreFolder(p) && lstat.isDirectory()) {
        mapAllNames(absPath);
      }
    });

    function isIgnoreFolder(folderName) {
      return !folderName || folderName === 'node_modules' || folderName[0] === '.';
    }

    function isModule(p) {
      return p.match(/\.(js|json)$/);
    }

    function getModuleName(p) {
      return p.replace(/\.(js|json)$/, '');
    }
  }
1080458
def _replace_data_types(dictionary):
        
        logging_levels = {'NONE': 0, 'NULL': 0, 'DEBUG': 10, 'INFO': 20,
                'WARNING': 30, 'ERROR': 40, 'CRITICAL': 50}
        for k, v in dictionary.items():
            if v in ['true', 'True', 'on']:
                dictionary[k] = True
            elif v in ['false', 'False', 'off']:
                dictionary[k] = False
            elif k == 'log_file' and '~' in v:
                dictionary[k] = v.replace('~', os.path.expanduser('~'))
            elif v in logging_levels:
                dictionary[k] = logging_levels[v]
            elif isinstance(v, str) and v.isnumeric():
                dictionary[k] = int(v)
            elif ',' in v:
                dictionary[k] = [x.strip() for x in v.split(',')]
        return dictionary
921649
def _update(self, kwargs):
        """"""
        from pygal.util import merge
        dir_self_set = set(dir(self))
        merge(
            self.__dict__,
            dict([(k, v) for (k, v) in kwargs.items()
                  if not k.startswith('_') and k in dir_self_set])
        )
523055
def from_name_re(cls, path:PathOrStr, fnames:FilePathList, pat:str, valid_pct:float=0.2, **kwargs):
        ""
        pat = re.compile(pat)
        def _get_label(fn):
            if isinstance(fn, Path): fn = fn.as_posix()
            res = pat.search(str(fn))
            assert res,f'Failed to find "{pat}" in "{fn}"'
            return res.group(1)
        return cls.from_name_func(path, fnames, _get_label, valid_pct=valid_pct, **kwargs)
1197128
def set_options_from_dict(self, data_dict, filename=None):
        
        if filename is not None:
            filename = os.path.dirname(filename)
        for k in data_dict:
            if not isinstance(data_dict[k], dict):
                raise ValueError("The input data has to be a dict of dict")
            for sk in data_dict[k]:
                if self.gc[(self.gc["k1"] == k) &
                           (self.gc["k2"] == sk)].shape[0] == 0:
                    continue
                if isinstance(data_dict[k][sk], six.string_types):
                    data_dict[k][sk] = str(data_dict[k][sk])
                _type = self.gc[(self.gc["k1"] == k) &
                                (self.gc["k2"] == sk)][["type"]].values[0]
                data_dict[k][sk] = ev.cast(data_dict[k][sk], _type)
                if self.get_option(k, sk, True) != data_dict[k][sk]:
                    try:
                        self.set_option(k, sk, data_dict[k][sk])
                    # Provided paths do not work: try add them relative
                    # to the config file
                    except IOError:
                        if filename is None:
                            raise IOError('Error path: {0}.{1}'.format(k, sk))
                        npat = os.path.join(filename, data_dict[k][sk])
                        self.set_option(k, sk, os.path.normpath(npat))
                    except ValueError:
                        pass
116139
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'document_id' in _dict:
            args['document_id'] = _dict.get('document_id')
        else:
            raise ValueError(
                'Required property \'document_id\' not present in DocumentStatus JSON'
            )
        if 'configuration_id' in _dict:
            args['configuration_id'] = _dict.get('configuration_id')
        if 'status' in _dict:
            args['status'] = _dict.get('status')
        else:
            raise ValueError(
                'Required property \'status\' not present in DocumentStatus JSON'
            )
        if 'status_description' in _dict:
            args['status_description'] = _dict.get('status_description')
        else:
            raise ValueError(
                'Required property \'status_description\' not present in DocumentStatus JSON'
            )
        if 'filename' in _dict:
            args['filename'] = _dict.get('filename')
        if 'file_type' in _dict:
            args['file_type'] = _dict.get('file_type')
        if 'sha1' in _dict:
            args['sha1'] = _dict.get('sha1')
        if 'notices' in _dict:
            args['notices'] = [
                Notice._from_dict(x) for x in (_dict.get('notices'))
            ]
        else:
            raise ValueError(
                'Required property \'notices\' not present in DocumentStatus JSON'
            )
        return cls(**args)
942494
def extract_from_dict(data, path):
    
    value = data
    try:
        for key in path:
            value = value[key]
        return value
    except (KeyError, IndexError, TypeError):
        return ''
391488
def value_for_keypath(dict, keypath):
    

    if len(keypath) == 0:
        return dict

    keys = keypath.split('.')
    value = dict
    for key in keys:
        if key in value:
            value = value[key]
        else:
            return None

    return value
657334
def set_api_key_from_file(path, set_global=True):
    """"""
    with open(path, 'r+b') as f:
        global api_key
        api_key = f.read().strip()
    return api_key
1112618
def update_args(self, args):
        
        for cfg in args:
            keys, v = cfg.split('=', maxsplit=1)
            keylist = keys.split('.')

            dic = self
            for i, k in enumerate(keylist[:-1]):
                assert k in dir(dic), "Unknown config key: {}".format(keys)
                dic = getattr(dic, k)
            key = keylist[-1]

            oldv = getattr(dic, key)
            if not isinstance(oldv, str):
                v = eval(v)
            setattr(dic, key, v)
934685
def inis2dict(ini_paths: Union[str, Sequence[str]]) -> dict:
    

    var_dflt = r'\${(.*?):-(.*?)}'
    def _interpolate(content):
        rv = expandvars(content)
        while True:
            match = re.search(var_dflt, rv)
            if match is None:
                break
            bash_var = '${{{}}}'.format(match.group(1))
            value = expandvars(bash_var)
            rv = re.sub(var_dflt, match.group(2) if value == bash_var else value, rv, count=1)

        return rv

    parser = ConfigParser()

    for ini in [ini_paths] if isinstance(ini_paths, str) else ini_paths:
        if not isfile(ini):
            raise FileNotFoundError('No such file: {}'.format(ini))
        with open(ini, 'r') as ini_fh:
            ini_text = _interpolate(ini_fh.read())
            parser.read_string(ini_text)

    return {s: dict(parser[s].items()) for s in parser.sections()}
680947
def update_dict(d, u):
    
    for key, val in u.items():
        if isinstance(val, collections.Mapping):
            d[key] = update_dict(d.get(key, {}), val)
        else:
            d[key] = u[key]
    return d
1001322
def parse_file_to_dict(self, fname):
        
        print('TODO - parse_file_to_dict' + fname)
        for m in self.maps:
            if m.tpe == 'file':
                if m.key[0:3] == 'col':
                    print('reading column..')
1127585
def update(self, *args, **kwargs):
        
        if len(args) > 1:
            raise TypeError("update expected at most 1 arguments, got %d" % len(args))

        for key, value in dict(*args, **kwargs).items():
            self[key] = value
1166977
def MergeFlags(self, args, unique=1, dict=None):
        

        if dict is None:
            dict = self
        if not SCons.Util.is_Dict(args):
            args = self.ParseFlags(args)
        if not unique:
            self.Append(**args)
            return self
        for key, value in args.items():
            if not value:
                continue
            try:
                orig = self[key]
            except KeyError:
                orig = value
            else:
                if not orig:
                    orig = value
                elif value:
                    # Add orig and value.  The logic here was lifted from
                    # part of env.Append() (see there for a lot of comments
                    # about the order in which things are tried) and is
                    # used mainly to handle coercion of strings to CLVar to
                    # "do the right thing" given (e.g.) an original CCFLAGS
                    # string variable like '-pipe -Wall'.
                    try:
                        orig = orig + value
                    except (KeyError, TypeError):
                        try:
                            add_to_orig = orig.append
                        except AttributeError:
                            value.insert(0, orig)
                            orig = value
                        else:
                            add_to_orig(value)
            t = []
            if key[-4:] == 'PATH':
                ### keep left-most occurence
                for v in orig:
                    if v not in t:
                        t.append(v)
            else:
                ### keep right-most occurence
                orig.reverse()
                for v in orig:
                    if v not in t:
                        t.insert(0, v)
            self[key] = t
        return self