本文整理汇总了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__,)
)