Returns OrderedDict whose keys are self.attrs
439966
def to_dict(self):
        """"""
        ret = OrderedDict()
        for attrname in self.attrs:
            ret[attrname] = self.__getattribute__(attrname)
        return ret
882456
def attr(cls, iterable, attr_name):
    

    return cls(getattr(x, attr_name) for x in iterable)
701165
def get_attributes(input_dict):
        
        return {k.lstrip("@"): v for k, v in input_dict.items() if k[0] == "@"}
796682
def _sorted_keys(self):
        

        try:
            keys = self._cache['sorted_keys']
        except KeyError:
            keys = self._cache['sorted_keys'] = sorted(self.keys(), key=parse_version)

        return keys
131231
def to_dict(self, rw = False):
		'''
		'''
		return {k:v for (k,v) in self.attributes.items() 
				if (v is not None and (not rw or (k in self.rw_attr_keys)))}
1015
def order_by(self, attribute=None, *, ascending=True):
        
        attribute = self._get_mapping(attribute) or self._attribute
        if attribute:
            self._order_by[attribute] = None if ascending else 'desc'
        else:
            raise ValueError(
                'Attribute property needed. call on_attribute(attribute) '
                'or new(attribute)')
        return self
288427
def from_attrdict(cls, attrdict: OrderedNamespace) -> object:
        
        dictionary = attrdict.__dict__
        # noinspection PyArgumentList
        return cls(**dictionary)
354360
def getschemas(cls):
        
        members = getmembers(cls, lambda member: isinstance(member, Schema))

        result = OrderedDict()

        for name, member in members:
            result[name] = member

        return result
396423
def parse_dict(self, attrs):
        """"""
        attrs = attrs or {}
        ident = attrs.get("id", "")
        classes = attrs.get("classes", [])
        kvs = OrderedDict((k, v) for k, v in attrs.items()
                          if k not in ("classes", "id"))

        return ident, classes, kvs
600447
def compare_ordereddict(self, X, Y):
        """"""

        # check if OrderedDict instances have the same keys and values
        child = self.compare_dicts(X, Y)
        if isinstance(child, DeepExplanation):
            return child

        # check if the order of the keys is the same
        for i, j in zip(X.items(), Y.items()):
            if i[0] != j[0]:
                c = self.get_context()
                msg = "X{0} and Y{1} are in a different order".format(
                    red(c.current_X_keys), green(c.current_Y_keys)
                )
                return DeepExplanation(msg)
        return True
246610
def __dict_to_BetterDict(self, attr):
        """"""
        if type(self[attr]) == dict:
            self[attr] = BetterDict(self[attr])

        return self[attr]
192769
def is_ordered_dict(d):
    
    py3_ordered_dicts = (sys.version_info.major == 3) and (sys.version_info.minor >= 6)
    vanilla_odicts = (sys.version_info.major > 3) or py3_ordered_dicts
    return isinstance(d, (OrderedDict))or (vanilla_odicts and isinstance(d, dict))
648477
def simpleAttrs(self):
        """"""
        simpleAttrs = {}
        for k,v in iteritems(self.attrs):
            if k in ["_matches"]: continue # attributes to specifically ignore
            try:    simpleAttrs[k] = v.type
            except: simpleAttrs[k] = v
        return simpleAttrs
1078942
def get_ordered_attributes(self):
        
        attrs = self.get_attributes()
        attr_arr = np.array(attrs)
        poss = [self.chrPos, self.startPos, self.stopPos]
        if self.strandPos is not None:
            poss.append(self.strandPos)
        if self.otherPos:
            for o in self.otherPos:
                poss.append(o[0])

        idx_sort = np.array(poss).argsort()
        return attr_arr[idx_sort].tolist()
1102740
def keys(self):
        """"""

        keys = OrderedDict()

        def order_key(_):
            (k, v) = _
            cache_key = getattr(type(self), k)
            return cache_key.order

        items = [(k, getattr(type(self), k)) for k
            in dir(type(self))
        ]
        items = [(k, v) for (k, v)
            in items
            if isinstance(v, Key)
        ]

        for k, v in sorted(items, key=order_key):
            keys[k] = getattr(self, k)
        return keys
778269
def as_dict(self):
        """"""
        attrs = vars(self)
        return {key: attrs[key] for key in attrs if not key.startswith('_')}
713212
def _getattrs(self, obj, *attrs):
        
        filtered_attrs = {}
        for attr in attrs:
            if hasattr(obj, attr):
                filtered_attrs[attr] = obj_to_string(
                    self._filter_value(getattr(obj, attr))
                )
        return filtered_attrs