Dictionary : dictionary IDENTIFIER Inheritance "{" DictionaryMembers "}" ";"
3006
def p_Dictionary(p):
  
  p[0] = model.Dictionary(name=p[2], parent=p[3], members=p[5])
178822
def FromDictionary(cls, dictionary):
    
    if 'user_id' in dictionary:
      raise errors.GitkitClientError('use localId instead')
    if 'localId' not in dictionary:
      raise errors.GitkitClientError('must specify localId')
    if 'email' not in dictionary:
      raise errors.GitkitClientError('must specify email')

    return cls(decode=False, **dictionary)
210836
def todict_using_struct(self, dict_struct=None, dict_post_processors=None):
        
        # It is important to assign the passed kwarg to a differently named variable.
        # A dict is passed by reference and using the same kwarg here results in it
        # getting mutated - causing unforeseen side effects
        dict_struct_to_use = (
            self._dict_struct_ if dict_struct is None
            else dict_struct)
        if dict_struct_to_use is None and self._autogenerate_dict_struct_if_none_:
            dict_struct_to_use = self.autogenerated_dict_structure()
        elif dict_struct.get("attrs") is None:
            dict_struct_to_use = {}
            dict_struct_to_use["attrs"] = self.autogenerated_dict_structure()["attrs"]
            if "rels" in dict_struct:
                dict_struct_to_use["rels"] = dict_struct.get("rels")
        result = self.serialize_attrs(*dict_struct_to_use.get('attrs', []))
        for rel, rel_dict_struct in dict_struct_to_use.get('rels', {}).items():
            rel_obj = getattr(self, rel) if hasattr(self, rel) else None
            if rel_obj is not None:
                if is_list_like(rel_obj):
                    result[rel] = [i.todict_using_struct(dict_struct=rel_dict_struct)
                                   if hasattr(i, 'todict_using_struct') else i
                                   for i in rel_obj]
                elif is_dict_like(rel_obj):
                    result[rel] = {k: v.todict_using_struct(dict_struct=rel_dict_struct)
                                   if hasattr(v, 'todict_using_struct') else v
                                   for k, v in rel_obj.iteritems()}
                else:
                    result[rel] = rel_obj.todict_using_struct(
                        dict_struct=rel_dict_struct) if hasattr(
                        rel_obj, 'todict_using_struct') else rel_obj
            else:
                result[rel] = None
        if isinstance(dict_post_processors, list):
            for dict_post_processor in dict_post_processors:
                if callable(dict_post_processor):
                    result = dict_post_processor(result, self)
        return result
595169
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'classifier_id' in _dict:
            args['classifier_id'] = _dict.get('classifier_id')
        else:
            raise ValueError(
                'Required property \'classifier_id\' not present in Classifier JSON'
            )
        if 'name' in _dict:
            args['name'] = _dict.get('name')
        else:
            raise ValueError(
                'Required property \'name\' not present in Classifier JSON')
        if 'owner' in _dict:
            args['owner'] = _dict.get('owner')
        if 'status' in _dict:
            args['status'] = _dict.get('status')
        if 'core_ml_enabled' in _dict:
            args['core_ml_enabled'] = _dict.get('core_ml_enabled')
        if 'explanation' in _dict:
            args['explanation'] = _dict.get('explanation')
        if 'created' in _dict:
            args['created'] = string_to_datetime(_dict.get('created'))
        if 'classes' in _dict:
            args['classes'] = [
                Class._from_dict(x) for x in (_dict.get('classes'))
            ]
        if 'retrained' in _dict:
            args['retrained'] = string_to_datetime(_dict.get('retrained'))
        if 'updated' in _dict:
            args['updated'] = string_to_datetime(_dict.get('updated'))
        return cls(**args)
763731
def t_IDENTIFIER(t):
  "
  if t.value in keywords:
    t.type = t.value
  return t
123569
def props(cls):
    
    return {k:v for (k, v) in inspect.getmembers(cls) if type(v) is Argument}
1033770
function Dict(xref) {
    // Map should only be used internally, use functions below to access.
    this.map = Object.create(null);
    this.xref = xref;
    this.objId = null;
    this.__nonSerializable__ = nonSerializable; // disable cloning of the Dict
  }
4
def key_to_kind(cls, key):
    
    if key.kind() == Kind.KIND_NAME:
      return key.id()
    else:
      return key.parent().id()
786573
def typed_fields(cls):
        """"""

        # Checking cls._typed_fields could return a superclass _typed_fields
        # value. So we check our class __dict__ which does not include
        # inherited attributes.
        klassdict = cls.__dict__

        try:
            return klassdict["_typed_fields"]
        except KeyError:
            fields = cls.typed_fields_with_attrnames()
            cls._typed_fields = tuple(field for _, field in fields)
        return cls._typed_fields
410469
def flatten_dict(dic, parent_key='', sep='.'):
    
    items = []
    for key, value in dic.items():
        new_key = parent_key + sep + key if parent_key else key
        if isinstance(value, collections.MutableMapping):
            items.extend(flatten_dict(value, new_key, sep=sep).items())
        elif isinstance(value, list):
            for idx, elt in enumerate(value):
                items.extend(
                    flatten_dict(elt, new_key + sep + str(idx), sep=sep).items()
                )
        else:
            items.append((new_key, value))
    return dict(items)
857116
def FromDict(self, dictionary):
    """"""
    dynamic_fields = []

    for key, value in iteritems(dictionary):
      field_type_info = self.type_infos.get(key)
      if isinstance(field_type_info, ProtoEmbedded):
        nested_value = field_type_info.GetDefault(container=self)
        nested_value.FromDict(value)
        self.Set(key, nested_value)
      elif isinstance(field_type_info, ProtoList):
        if isinstance(field_type_info.delegate, ProtoEmbedded):
          nested_values = []
          for v in value:
            nested_value = field_type_info.delegate.GetDefault(container=self)
            nested_value.FromDict(v)
            nested_values.append(nested_value)

          self.Set(key, nested_values)
        else:
          self.Set(key, value)
      elif isinstance(field_type_info, ProtoDynamicEmbedded):
        dynamic_fields.append(field_type_info)
      elif field_type_info.proto_type_name == "bytes":
        self.Set(key, base64.decodestring(value or ""))
      else:
        self.Set(key, value)

    # Process dynamic fields after all other fields, because most probably
    # their class is determined by one of the previously set fields.
    for dynamic_field in dynamic_fields:
      nested_value = dynamic_field.GetDefault(container=self)
      if nested_value is None:
        raise RuntimeError("Can't initialize dynamic field %s, probably some "
                           "necessary fields weren't supplied." %
                           dynamic_field.name)
      nested_value.FromDict(dictionary[dynamic_field.name])
      self.Set(dynamic_field.name, nested_value)
755839
def parse_as_inheritdoc(p)
      tag = {
        :tagname => :inheritdoc,
        :cls => p.ident_chain,
      }

      if p.look(/#\w/)
        p.match(/#/)
        if p.look(/static-/)
          tag[:static] = true
          p.match(/static-/)
        end
        if p.look(JsDuck::MemberRegistry.regex)
          tag[:type] = p.match(/\w+/).to_sym
          p.match(/-/)
        end
        tag[:member] = p.ident
      end

      tag
    end
315147
def create_dict_subclass(name, hash_func, slots, doc):
    

    hash_length = len(slots)

    # Returns array index -- raises a KeyError if the key does not match
    # its slot value.
    def index_or_key_error(key):
        index = hash_func(key)
        # Make sure the key is **exactly** the same.
        if key != slots[index]:
            raise KeyError(key)
        return index

    def init(self, *args, **kwargs):
        self._arr = [None] * hash_length
        self._len = 0

        # Delegate initialization to update provided by MutableMapping:
        self.update(*args, **kwargs)

    def getitem(self, key):
        index = index_or_key_error(key)
        if self._arr[index] is None:
            raise KeyError(key)
        return self._arr[index][1]

    def setitem(self, key, value):
        index = index_or_key_error(key)
        self._arr[index] = (key, value)

    def delitem(self, key):
        index = index_or_key_error(key)
        if self._arr[index] is None:
            raise KeyError(key)
        self._arr[index] = None

    def dict_iter(self):
        return (pair[0] for pair in self._arr if pair is not None)

    def dict_len(self):
        # TODO: Make this O(1) using auxiliary state?
        return sum(1 for _ in self)

    def dict_repr(self):
        arr_repr = (repr(pair) for pair in self._arr if pair is not None)
        return ''.join((name, '([', ', '.join(arr_repr), '])'))

    # Inheriting from MutableMapping gives us a whole whackload of methods for
    # free.
    bases = (collections.MutableMapping,)

    return type(name, bases, {
        '__init__': init,
        '__doc__': doc,

        '__getitem__': getitem,
        '__setitem__': setitem,
        '__delitem__': delitem,
        '__iter__': dict_iter,
        '__len__': dict_len,

        '__repr__': dict_repr,
    })
121133
def from_dict(cls, d):
        """"""
        warnings.warn(
            'from_dict is deprecated and will be removed in v1.0!',
            stacklevel=2)
        d = d or {}
        return cls(**d)
540147
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'trait_id' in _dict:
            args['trait_id'] = _dict.get('trait_id')
        else:
            raise ValueError(
                'Required property \'trait_id\' not present in Trait JSON')
        if 'name' in _dict:
            args['name'] = _dict.get('name')
        else:
            raise ValueError(
                'Required property \'name\' not present in Trait JSON')
        if 'category' in _dict:
            args['category'] = _dict.get('category')
        else:
            raise ValueError(
                'Required property \'category\' not present in Trait JSON')
        if 'percentile' in _dict:
            args['percentile'] = _dict.get('percentile')
        else:
            raise ValueError(
                'Required property \'percentile\' not present in Trait JSON')
        if 'raw_score' in _dict:
            args['raw_score'] = _dict.get('raw_score')
        if 'significant' in _dict:
            args['significant'] = _dict.get('significant')
        if 'children' in _dict:
            args['children'] = [
                Trait._from_dict(x) for x in (_dict.get('children'))
            ]
        return cls(**args)
959227
def primitive(self):
        """"""
        dict = {}
        for key, value in self.__dict__.items():
            if not key.startswith('_'):
                dict[key] = copy(value)

        for key in dict:
            if isinstance(dict[key], (set)):
                dict[key] = sorted(list(dict[key]))

        return dict
628151
def lookup_subclass(cls, d):
        
        try:
            typeid = d["typeid"]
        except KeyError:
            raise FieldError("typeid not present in keys %s" % list(d))

        subclass = cls._subcls_lookup.get(typeid, None)
        if not subclass:
            raise FieldError("'%s' not a valid typeid" % typeid)
        else:
            return subclass