本文整理汇总了Python中collections.MutableMapping.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python MutableMapping.__init__方法的具体用法?Python MutableMapping.__init__怎么用?Python MutableMapping.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collections.MutableMapping
的用法示例。
在下文中一共展示了MutableMapping.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import __init__ [as 别名]
def __init__(self, *state: tuple):
MutableMapping.__init__(self)
MutableComposite.__init__(self)
try:
for i, name in enumerate(self._fields):
setattr(self, name, state[i])
except IndexError:
IndexError("Instantiate %s with %u elements, but required are: %s"
% (self.__class__.__name__, len(state), self._fields))
示例2: __init__
# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import __init__ [as 别名]
def __init__(self, query="", sort_keys=False, lower_keys=False, upper_keys=False):
MutableMapping.__init__(self)
self._parameters = []
self._sort_keys = sort_keys
self._lower_keys = lower_keys
self._upper_keys = upper_keys
if isinstance(query, Mapping):
if isinstance(query, _ParamMap):
if query.is_sort_keys():
self.set_sort_keys()
if query.is_lower_keys():
self.set_lower_keys()
if query.is_upper_keys():
self.set_upper_keys()
self.update(query)
elif query is not None:
self.update(OrderedDict(urlparse.parse_qsl(str(query))))
示例3: __init__
# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import __init__ [as 别名]
def __init__(self, **kwargs):
MutableMapping.__init__(self)
self.modifications = {}
""" Holds chemical modifications. """
self.breaksym = kwargs.get('breaksym', not kwargs.get('keepsymm', False))
""" Whether to break symmetries or not. """
示例4: __init__
# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import __init__ [as 别名]
def __init__(self, *args, **kwargs):
MutableMapping.__init__(self)
dict.__init__(self)
self._root = _Link()
self._map = {}
self.update(*args, **kwargs)