returns a list version of the object, based on it's attributes
488530
def as_list(self):
        
        if hasattr(self, 'cust_list'):
            return self.cust_list
        if hasattr(self, 'attr_check'):
            self.attr_check()
        cls_bltns = set(dir(self.__class__))
        ret = [a for a in dir(self) if a not in cls_bltns and getattr(self, a)]
        return ret
444557
def get_stats(self, obj, stat_name):
        
        return [int(v) for v in self.get_attribute(obj, stat_name).split()]
50374
def getObjectList(IDs, date, pos):
    
    objList = [getObject(ID, date, pos) for ID in IDs]
    return ObjectList(objList)
252478
def versions_request(self):
        """"""
        ret = self.handle_api_exceptions('GET', '', api_ver='')
        return [str_dict(x) for x in ret.json()]
1336691
def named_objs(objlist, namesdict=None):
    
    objs = OrderedDict()

    if namesdict is not None:
        objtoname = {hashable(v): k for k, v in namesdict.items()}

    for obj in objlist:
        if namesdict is not None and hashable(obj) in objtoname:
            k = objtoname[hashable(obj)]
        elif hasattr(obj, "name"):
            k = obj.name
        elif hasattr(obj, '__name__'):
            k = obj.__name__
        else:
            k = as_unicode(obj)
        objs[k] = obj
    return objs
153216
def list_to_compare_dict(self, list_form):
        """"""
        compare_dict = {}
        for field in list_form:
            if field['name'] in compare_dict:
                self.pr_dbg("List has duplicate field %s:\n%s" %
                            (field['name'], compare_dict[field['name']]))
                if compare_dict[field['name']] != field:
                    self.pr_dbg("And values are different:\n%s" % field)
                return None
            compare_dict[field['name']] = field
            for ign_f in self.mappings_ignore:
                compare_dict[field['name']][ign_f] = 0
        return compare_dict
790072
def p_object_field_list(self, p):
        
        obj = p[1].copy()
        obj.update(p[2])
        p[0] = obj
300802
def get_attributes(obj):
    
    if not obj or type(obj) is not dict:
        return {}

    keys = list(obj.keys())
    if len(keys) > 0:
        key = keys[0]
    else:
        return {}
    key_obj = obj.get(key, {})
    if type(key_obj) is not dict:
        # if the object is not a dict
        # it is probably already scoped to attributes
        return obj
    if key != "attributes":
        attrs = key_obj.get('attributes')
        if type(attrs) is not dict:
            # if the attributes doesn't exist,
            # it is probably already scoped to attributes
            return obj
    else:
        # if the attributes exist, we return the value, except if it's not a dict type
        attrs = key_obj
        if type(attrs) is not dict:
            return obj

    return attrs
1077140
def object_to_items(data_structure):
    """"""
    items = []
    # Get all items from dict
    try:
        items = list(data_structure.__dict__.items())
    except:
        pass
    # Get all slots
    hierarchy = [data_structure]
    try:
        hierarchy += inspect.getmro(data_structure)
    except:
        pass
    slots = []
    try:
        for b in hierarchy:
            try:
                slots += b.__slots__
            except:  # pragma: no cover
                pass
    except:  # pragma: no cover
        pass
    # Get attrs from slots
    for x in slots:
        items.append((x, getattr(data_structure, x)))
    return items
438976
def version(*list, inherit_from: nil, &block)
      superclass = self[inherit_from] || self
      subclass   = Class.new(superclass, &block)
      list.each { |v| versions[v] = subclass }
    end
1013345
def as_object_version(value):
    
    return value if isinstance(value, ObjectVersion) \
        else ObjectVersion.query.filter_by(version_id=value).one_or_none()
728965
def get_list(self, name):
        ''''''
        normalized_name = normalize_name(name, self._normalize_overrides)
        return self._map[normalized_name]
373251
def get_elements(self, object_list):
        
        result = []
        for item in object_list:
            if isinstance(item, list):
                result += self.get_elements(item)
            elif isinstance(item, TranslatableModel):
                result.append(item)
        return result
308125
def object_attributes( thing, all=False ) :
    '''
    
    '''
    standard_names = set( dir( object() ) )
    things_names = set( dir( thing ) )
    if not all :
        things_names -= standard_names
        things_names |= set( ['__doc__'] )
    return sorted( things_names )
1332554
def get_attrs(obj):
    """"""
    if not hasattr(obj, '__dict__'):
        return []  # slots only
    proxy_type = types.MappingProxyType if six.PY3 else types.DictProxyType
    if not isinstance(obj.__dict__, (dict, proxy_type)):
        print(type(obj.__dict__), obj)
        raise TypeError("%s.__dict__ is not a dictionary" % obj.__name__)
    return obj.__dict__.keys()
265610
def get_properties(obj):
    
    if hasattr(obj, 'keys'):
        return obj.keys()
    elif hasattr(obj, '__dict__'):
        return obj.__dict__.keys()

    return []
233637
def _normalize(obj):
    
    if isinstance(obj, list):
        return [_normalize(item) for item in obj]
    elif isinstance(obj, dict):
        return {k: _normalize(v) for k, v in obj.items() if v is not None}
    elif hasattr(obj, 'to_python'):
        return obj.to_python()
    return obj