Converts keys in YAML that reference other keys.
167298
def __convert_key(expression):
        
        if type(expression) is str and len(expression) > 2 and expression[1] == '!':
            expression = eval(expression[2:-1])
        return expression
1217177
def keys
      if :hash == self.type
        self.children.map { |child| child.children[0] }
      else
        raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.debug_info}"
      end
    end
218421
def command_convert(config):
    """"""

    _, ext = os.path.splitext(config)
    if 'json' in ext:
        if click.confirm('convert to <%s> to yaml?' % config):
            configparser = kaptan.Kaptan()
            configparser.import_config(config)
            newfile = config.replace(ext, '.yaml')
            newconfig = configparser.export('yaml', indent=2, default_flow_style=False)
            if click.confirm('Save config to %s?' % newfile):
                buf = open(newfile, 'w')
                buf.write(newconfig)
                buf.close()
                print('New config saved to %s' % newfile)
    elif 'yaml' in ext:
        if click.confirm('convert to <%s> to json?' % config):
            configparser = kaptan.Kaptan()
            configparser.import_config(config)
            newfile = config.replace(ext, '.json')
            newconfig = configparser.export('json', indent=2)
            print(newconfig)
            if click.confirm('Save config to <%s>?' % newfile):
                buf = open(newfile, 'w')
                buf.write(newconfig)
                buf.close()
                print('New config saved to <%s>.' % newfile)
251172
def keys(self, pattern, *, encoding=_NOTSET):
        """"""
        return self.execute(b'KEYS', pattern, encoding=encoding)
805185
def normalize_keys(self, value):
        
        return dict((self.normalize_name(k), v) for k, v in value.items())
880542
def _normalized_keys(self, section, items):
        # type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any]
        
        normalized = {}
        for name, val in items:
            key = section + "." + _normalize_name(name)
            normalized[key] = val
        return normalized
1242258
def make_key(self, *parts):
        """"""
        separator = getattr(self.model_class, 'index_separator', '.')
        parts = map(decode, parts)
        return '%s%s' % (self._base_key, separator.join(map(str, parts)))
682945
def keys(self, namespace, prefix=None, limit=None, offset=None):
        """"""
        params = [namespace]
        query = 'SELECT key FROM gauged_keys WHERE namespace = %s'
        if prefix is not None:
            query += ' AND key LIKE %s'
            params.append(prefix + '%')
        if limit is not None:
            query += ' LIMIT %s'
            params.append(limit)
        if offset is not None:
            query += ' OFFSET %s'
            params.append(offset)
        cursor = self.cursor
        cursor.execute(query, params)
        return [key for key, in cursor]
491448
def keysym_to_keycodes(self, keysym):
        """"""
        try:
            # Copy the map list, reversing the arguments
            return map(lambda x: (x[1], x[0]), self._keymap_syms[keysym])
        except KeyError:
            return []
1368280
def parse_yaml(self, y):
        '''

        '''
        self.component_id = y['componentId']
        self.instance_name = y['instanceName']
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y.get(RTS_EXT_NS_YAML + 'properties'):
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value
        return self
244585
def to_hierayaml
      attributes = Hash[filtered_keys.map { |k| [k.to_s, values[k]] }]
      YAML.dump('type' => { title => attributes }).split("\n").drop(2).join("\n") + "\n"
    end
1213985
def _key_to_index(keys, key, single_only=False):
    ''
    if isinstance(key, int): # validate the int index
        try:
            keys[key]
        except IndexError:
            raise KeyError('Index out of range of keys: %s' % (key,))
        if key < 0:
            key += len(keys) # always positive index
        return key
#    keys = d.keys()
    if not single_only:
        if isinstance(key, (tuple, list)):
            return [_key_to_index_single(keys, k) for k in key]

        if isinstance(key, slice):
            start, stop, step = key.start, key.stop, key.step
            try:
                MI_check_index_name(start)
                start = keys.index(start)
            except TypeError:
                pass
            try:
                MI_check_index_name(stop)
                stop = keys.index(stop)
            except TypeError:
                pass
#            return slice(start, stop, step)
            args = slice(start, stop, step).indices(len(keys))
            return force_list(range(*args)) # list of indices
    try:
        return keys.index(key)
    except ValueError: # not IndexError
        raise KeyError('Key not found: %s' % (key,))
736501
def read_yaml_key(source, key)
      return unless key.is_a?(String)
      paths = key.split('.')
      source = source[paths.shift] until paths.empty? || source.nil?
      source
    end
244898
def transform
            t = nil
            if @value.is_a? Hash
                t = {}
                @value.each { |k,v|
                    t[ k ] = v[1].transform
                }
            elsif @value.is_a? Array
                t = []
                @value.each { |v|
                    t.push v.transform
                }
            else
                t = @value
            end
            YAML.transfer_method( @type_id, t )
        end
1058765
def _convert_nonstring_categoricals(self, param_dict):
        """"""
        return {name: (self.categorical_mappings_[name][val] if name in self.categorical_mappings_ else val)
                for (name, val) in param_dict.items()}
1070892
def normalize_string_keys(old):
    """"""
    new = {}
    for key, value in old.items():
        if isinstance(key, bytes_):
            new[key.decode('utf8')] = value
        else:
            new[key] = value
    return new
204840
def convert_keys(self, pydict):
        
        new_dict = dict()
        for key, value in pydict.items():
            new_dict[self.get_field_key(key)] = value
        return new_dict