本文整理匯總了Python中collections.UserList.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python UserList.__init__方法的具體用法?Python UserList.__init__怎麽用?Python UserList.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類collections.UserList
的用法示例。
在下文中一共展示了UserList.__init__方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def __init__(self, type, fetch=False, check=False,
parent=None, recursive=1, session=None, **kwargs):
assert('fq_name' in kwargs or 'uuid' in kwargs or 'to' in kwargs)
super(Resource, self).__init__(session=session)
self.type = type
UserDict.__init__(self, kwargs)
self.from_dict(self.data)
if parent:
self.parent = parent
if check:
self.check()
if fetch:
self.fetch(recursive=recursive)
self.properties = {prop.key: prop for prop in self.schema.properties}
self.emit('created', self)
示例2: context_stacker
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def context_stacker(
inherit: Type, context_managers: Dict[str, AsyncContextManager]
) -> Type:
"""
Using :func:`aenter_stack`
"""
class ContextStacker(inherit):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self._stack = None
async def __aenter__(self):
await super().__aenter__()
self._stack = await aenter_stack(self, context_managers)
return self
async def __aexit__(self, exc_type, exc_value, traceback):
await super().__aexit__(exc_type, exc_value, traceback)
await self._stack.aclose()
return ContextStacker
示例3: __init__
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def __init__(self, subject):
"""Wrap an object as a Proxy object"""
self._subject = subject
示例4: __init__
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def __init__(self, kind, kids=[]):
self.kind = intern(kind)
UserList.__init__(self, kids)
示例5: __init__
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def __init__(self):
UserList.__init__(self)
self.current_deck = None
self.reload()
示例6: __init__
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def __init__(self, items=None, eol=None, path=None, encoding='utf-8'):
UserList.__init__(self, items or [])
self._eol = eol
self.path = path
self.encoding = encoding
示例7: __init__
# 需要導入模塊: from collections import UserList [as 別名]
# 或者: from collections.UserList import __init__ [as 別名]
def __init__(self, parent: "AsyncContextManagerList"):
UserList.__init__(self)
self.parent = parent
self.__stack = None
self.logger = LOGGER.getChild(
"AsyncContextManagerListContext.%s"
% (self.__class__.__qualname__,)
)