reads through the prop attributes and filters them for the associated
    class and returns a dictionary for meta_class __prepare__

    args:
        prop: class object to read
        cls_name: the name of the class to tie the porperty to
179196
def tie_prop_to_class(prop, cls_name):
    
    attr_list = [attr for attr in dir(prop) if type(attr, Uri)]
    prop_defs = kwargs.pop('prop_defs')
    prop_name = kwargs.pop('prop_name')
    cls_name = kwargs.pop('cls_name')
    if cls_name == 'RdfClassBase':
        return {}
    doc_string = make_doc_string(name,
                                 prop_defs,
                                 bases,
                                 None)
    new_def = prepare_prop_defs(prop_defs, prop_name, cls_name)
    new_def['__doc__'] = doc_string
    new_def['_cls_name'] = cls_name
    new_def['_prop_name'] = prop_name
    if prop_name == 'rdf_type':
        new_def['append'] = unique_append
    # if prop_name == 'rdf_type':
    #     pdb.set_trace()
    new_def['_init_processors'] = get_processors('kds_initProcessor',
                                                 prop_defs)
    new_def['_es_processors'] = get_processors('kds_esProcessor',
                                               prop_defs,
                                               'es_values')
    # pdb.set_trace()
    return new_def
879002
def __dict_to_object_meta(name, namespace, metadata):
    '''
    
    '''
    meta_obj = kubernetes.client.V1ObjectMeta()
    meta_obj.namespace = namespace

    # Replicate `kubectl [create|replace|apply] --record`
    if 'annotations' not in metadata:
        metadata['annotations'] = {}
    if 'kubernetes.io/change-cause' not in metadata['annotations']:
        metadata['annotations']['kubernetes.io/change-cause'] = ' '.join(sys.argv)

    for key, value in iteritems(metadata):
        if hasattr(meta_obj, key):
            setattr(meta_obj, key, value)

    if meta_obj.name != name:
        log.warning(
            'The object already has a name attribute, overwriting it with '
            'the one defined inside of salt')
        meta_obj.name = name

    return meta_obj
588426
def _get_prop_infos(self, prop):
        
        info_dict = self.get_info_field(prop)
        main_infos = info_dict.get('export', {}).copy()
        infos = main_infos.get(self.config_key, {})
        main_infos['label'] = self._get_title(prop, main_infos, info_dict)
        main_infos['name'] = prop.key
        main_infos['key'] = prop.key
        main_infos.update(infos)
        main_infos['__col__'] = prop
        return main_infos
714224
def get_class(self, name):
        
        for i in self.get_classes():
            if i.get_name() == name:
                return i
        return None
654483
def get_by(self, prop, val, raise_exc=False):
        ''''''
        try:
            val = self.serialize(val)
            return self._meta[prop][val][0]
        except (KeyError, IndexError):
            if raise_exc:
                raise
            else:
                return None
1022636
def prop_modifier(self, cls: ClassDefinition, slot: SlotDefinition) -> str:
        
        pk = '(pk)' if slot.primary_key else ''
        inherited = slot.name not in cls.slots
        mixin = inherited and slot.name in \
                [mslot.name for mslot in [self.schema.classes[m] for m in cls.mixins]]
        injected = cls.name in self.synopsis.applytos and \
                   slot.name in [aslot.name for aslot in
                                 [self.schema.classes[a] for a in sorted(self.synopsis.applytos[cls.name].classrefs)]]
        return pk + '(a)' if injected else '(m)' if mixin else '(i)' if inherited else ''
1024568
def as_dict(self):
        
        out = {}
        for prop in self:
            propval = getattr(self, prop)

            if hasattr(propval, 'for_json'):
                out[prop] = propval.for_json()
            elif isinstance(propval, list):
                out[prop] = [getattr(x, 'for_json', lambda:x)() for x in propval]
            elif isinstance(propval, (ProtocolBase, LiteralValue)):
                out[prop] = propval.as_dict()
            elif propval is not None:
                out[prop] = propval

        return out
308807
def nameddict(name, props):
    
    class NamedDict(object):
        def __init__(self, *args, **kwargs):
            self.__store = {}.fromkeys(props)
            if args:
                for i, k in enumerate(props[:len(args)]):
                    self[k] = args[i]
            for k, v in kwargs.items():
                self[k] = v

        def __getattr__(self, key):
            # print '+', key
            if key.startswith('_NamedDict__'):
                return self.__dict__[key]
            else:
                return self.__store[key]

        def __setattr__(self, key, value):
            # print '-', key
            if key.startswith('_NamedDict__'):
                object.__setattr__(self, key, value)
            else:
                self.__setitem__(key, value)
                # self.__store[key] = value

        def __getitem__(self, key):
            return self.__store[key]

        def __setitem__(self, key, value):
            if key not in props:
                raise AttributeError("NamedDict(%s) has no attribute %s, avaliables are %s" % (
                    name, key, props))
            self.__store[key] = value

        def __dict__(self):
            return self.__store

        def __str__(self):
            return 'NamedDict(%s: %s)' % (name, str(self.__store))

    return NamedDict
1026727
def p_dynamic_class_name_reference(p):
    ''''''
    if len(p) == 5:
        name, dims = p[3]
        p[0] = ast.ObjectProperty(p[1], name, lineno=p.lineno(2))
        for class_, dim, lineno in dims:
            p[0] = class_(p[0], dim, lineno=lineno)
        for name, dims in p[4]:
            p[0] = ast.ObjectProperty(p[0], name, lineno=p.lineno(2))
            for class_, dim, lineno in dims:
                p[0] = class_(p[0], dim, lineno=lineno)
    else:
        p[0] = p[1]
388109
def has_prop_attribute(cls, prop_name):  # @NoSelf
        """"""
        return (prop_name in cls.__dict__ and
                not isinstance(cls.__dict__[prop_name], types.FunctionType))
1055664
def get_properties(cls_def):
    
    # pdb.set_trace()
    prop_list = {prop: value for prop, value in cls_def.items() \
                 if 'rdf_Property' in value.get('rdf_type', "") or \
                 value.get('rdfs_domain')}

    return prop_list
193539
def _parse_properties(self, properties):
        
        props = {}
        # TODO: clean up prop_dict?
        prop_dict = OrderedDict()
        # We use a dict instead of list to provide for a richer syntax
        for p in properties:
            if p in self.aliases:
                if isinstance(properties, dict):
                    props[self.aliases[p]] = properties[p]
                else:
                    props[self.aliases[p]] = 1
                prop_dict[p] = self.aliases[p].split(".")
            else:
                if isinstance(properties, dict):
                    props[p] = properties[p]
                else:
                    props[p] = 1
                prop_dict[p] = p.split(".")
        # including a lower-level key after a higher level key e.g.:
        # {'output': 1, 'output.crystal': 1} instead of
        # {'output.crystal': 1, 'output': 1}
        # causes mongo to skip the other higher level keys.
        # this is a (sketchy) workaround for that. Note this problem
        # doesn't appear often in python2 because the dictionary ordering
        # is more stable.
        props = OrderedDict(sorted(props.items(), reverse=True))
        return props, prop_dict
1192900
def link_property(prop, cls_object):
    
    register = False
    cls_name = cls_object.__name__
    if cls_name and cls_name != 'RdfBaseClass':
        new_name = "%s_%s" % (prop._prop_name, cls_name)
    else:
        new_name = prop._prop_name

    new_prop = types.new_class(new_name,
                               (prop,),
                               {'metaclass': RdfLinkedPropertyMeta,
                                'cls_name': cls_name,
                                'prop_name': prop._prop_name,
                                'linked_cls': cls_object})
    return new_prop
462511
def get_property(self, prop):
        
        prop = prop.split('.')
        root = self
        for p in prop:
            if p in root:
                root = root[p]
            else:
                return None
        return root
1014863
def get_attrs(cls):
        
        ignore = dir(type('dummy', (object,), {})) + ['__metaclass__']
        attrs = [
            item for item in inspect.getmembers(cls) if item[0] not in ignore
            and not isinstance(
                item[1], (
                    types.FunctionType,
                    types.MethodType,
                    classmethod,
                    staticmethod,
                    property))]
        # sort by idx and use attribute name to break ties
        attrs.sort(key=lambda attr: (getattr(attr[1], 'idx', -1), attr[0]))
        return attrs
839891
def getProperty(self, prop, *args, **kwargs):
        
        f = self.__getAttrs.get(prop)
        if not f:
            raise KeyError('Unknown readable property: %s' % prop)
        return f(self, *args, **kwargs)
1261573
def cls_get_by_name(cls, name):
    
    try:
        val = getattr(cls, name)
    except AttributeError:
        for attr in (a for a in dir(cls) if not a.startswith('_')):
            try:
                val = getattr(cls, attr)
            except AttributeError:
                # Is known to happen.
                continue
            valname = getattr(val, 'name', None)
            if valname == name:
                return val
        else:
            raise ValueError('No {} with that name: {}'.format(
                cls.__name__,
                name,
            ))
    else:
        return val