本文整理匯總了Python中traitlets.TraitType方法的典型用法代碼示例。如果您正苦於以下問題:Python traitlets.TraitType方法的具體用法?Python traitlets.TraitType怎麽用?Python traitlets.TraitType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類traitlets
的用法示例。
在下文中一共展示了traitlets.TraitType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: can_document_member
# 需要導入模塊: import traitlets [as 別名]
# 或者: from traitlets import TraitType [as 別名]
def can_document_member(cls, member, membername, isattr, parent):
return isinstance(member, TraitType)
示例2: __new__
# 需要導入模塊: import traitlets [as 別名]
# 或者: from traitlets import TraitType [as 別名]
def __new__(mcls, name, bases, classdict):
# FIXME: this duplicates the code from MetaHasTraits.
# I don't think a super() call will help me here.
for k,v in iteritems(classdict):
if isinstance(v, TraitType):
v.name = k
elif inspect.isclass(v):
if issubclass(v, TraitType):
vinst = v()
vinst.name = k
classdict[k] = vinst
cls = MetaQObject.__new__(mcls, name, bases, classdict)
return cls