本文整理匯總了Python中krpc.attributes.Attributes.is_a_class_member方法的典型用法代碼示例。如果您正苦於以下問題:Python Attributes.is_a_class_member方法的具體用法?Python Attributes.is_a_class_member怎麽用?Python Attributes.is_a_class_member使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類krpc.attributes.Attributes
的用法示例。
在下文中一共展示了Attributes.is_a_class_member方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from krpc.attributes import Attributes [as 別名]
# 或者: from krpc.attributes.Attributes import is_a_class_member [as 別名]
def __init__(self, service_name, name, procedures, documentation):
super(Class, self).__init__()
self.service_name = service_name
self.name = name
self.fullname = service_name+'.'+name
self.documentation = documentation
self.cref = 'T:%s.%s' % (service_name, name)
self.members = {}
for pname,pinfo in procedures.items():
if Attributes.is_a_class_member(pinfo['attributes']) and \
Attributes.get_class_name(pinfo['attributes']) == name:
if Attributes.is_a_class_method(pinfo['attributes']):
member = ClassMethod(service_name, name, pname, **pinfo)
elif Attributes.is_a_class_static_method(pinfo['attributes']):
member = ClassStaticMethod(service_name, name, pname, **pinfo)
else:
continue
self.members[member.name] = member
properties = {}
for pname,pinfo in procedures.items():
if Attributes.is_a_class_property_accessor(pinfo['attributes']):
propname = Attributes.get_class_property_name(pinfo['attributes'])
if propname not in properties:
properties[propname] = {}
if Attributes.is_a_class_property_getter(pinfo['attributes']):
properties[propname]['getter'] = Procedure(service_name, pname, **pinfo)
else:
properties[propname]['setter'] = Procedure(service_name, pname, **pinfo)
for propname,prop in properties.items():
prop = ClassProperty(service_name, name, propname, **prop)
self.members[prop.name] = prop
示例2: __init__
# 需要導入模塊: from krpc.attributes import Attributes [as 別名]
# 或者: from krpc.attributes.Attributes import is_a_class_member [as 別名]
def __init__(self, name, procedures, classes, enumerations, documentation, sort):
super(Service, self).__init__()
self.name = name
self.fullname = name
self.documentation = documentation
self.cref = 'T:%s' % name
members = []
cprocedures = defaultdict(lambda: dict())
properties = defaultdict(lambda: dict())
for pname,info in procedures.iteritems():
if Attributes.is_a_procedure(info['attributes']):
members.append(Procedure(name, pname, **info))
elif Attributes.is_a_property_accessor(info['attributes']):
propname = Attributes.get_property_name(info['attributes'])
if Attributes.is_a_property_getter(info['attributes']):
properties[propname]['getter'] = Procedure(name, pname, **info)
else:
properties[propname]['setter'] = Procedure(name, pname, **info)
elif Attributes.is_a_class_member(info['attributes']):
cname = Attributes.get_class_name(info['attributes'])
cprocedures[cname][pname] = info
for propname,prop in properties.iteritems():
members.append(Property(name, propname, **prop))
self.classes = {cname: Class(name, cname, cprocedures[cname], sort=sort, **cinfo) for (cname,cinfo) in classes.iteritems()}
self.enumerations = {ename: Enumeration(name, ename, sort=sort, **einfo) for (ename,einfo) in enumerations.iteritems()}
self.members = OrderedDict((member.name, member) for member in sorted(members, key=sort))