本文整理汇总了Python中UserDict.UserDict.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python UserDict.__init__方法的具体用法?Python UserDict.__init__怎么用?Python UserDict.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDict.UserDict
的用法示例。
在下文中一共展示了UserDict.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, keyfile=None, certfile=None,
ssl_version='PROTOCOL_SSLv23', ca_certs=None,
do_handshake_on_connect=True, cert_reqs=CERT_NONE,
suppress_ragged_eofs=True, ciphers=None, **kwargs):
"""settings of SSL
:param keyfile: SSL key file path usally end with ".key"
:param certfile: SSL cert file path usally end with ".crt"
"""
UserDict.__init__(self)
self.data.update( dict(keyfile = keyfile,
certfile = certfile,
server_side = True,
ssl_version = getattr(ssl, ssl_version, ssl.PROTOCOL_SSLv23),
ca_certs = ca_certs,
do_handshake_on_connect = do_handshake_on_connect,
cert_reqs=cert_reqs,
suppress_ragged_eofs = suppress_ragged_eofs,
ciphers = ciphers))
示例2: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict 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)
示例3: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self,BASE=None,UNWANTED=[],**kw):
data = {}
if BASE:
if isinstance(BASE,AttrMap):
data = BASE.data #they used BASECLASS._attrMap
else:
if type(BASE) not in (type(()),type([])): BASE = (BASE,)
for B in BASE:
if hasattr(B,'_attrMap'):
data.update(getattr(B._attrMap,'data',{}))
else:
raise ValueError, 'BASE=%s has wrong kind of value' % str(B)
UserDict.__init__(self,data)
self.remove(UNWANTED)
self.data.update(kw)
示例4: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, fieldMarker, fieldValue):
"""
This method constructs a Field object as a tuple of a field
marker and a field value.
@param fieldMarker: a field's marker
@type fieldMarker: string
@param fieldValue : a field's value (the actual data)
@type fieldValue : string
"""
self._field = (fieldMarker, fieldValue)
示例5: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, *maps):
'''Initialize a ChainMap by setting *maps* to the given mappings.
If no mappings are provided, a single empty dictionary is used.
'''
self.maps = list(maps) or [{}] # always at least one map
示例6: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, object, method, name=None):
if name is None:
name = method.__name__
self.object = object
self.method = method
self.name = name
setattr(self.object, name, self)
示例7: NoSubstitutionProxy
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def NoSubstitutionProxy(subject):
class _NoSubstitutionProxy(Environment):
def __init__(self, subject):
self.__dict__['__subject'] = subject
def __getattr__(self, name):
return getattr(self.__dict__['__subject'], name)
def __setattr__(self, name, value):
return setattr(self.__dict__['__subject'], name, value)
def raw_to_mode(self, dict):
try:
raw = dict['raw']
except KeyError:
pass
else:
del dict['raw']
dict['mode'] = raw
def subst(self, string, *args, **kwargs):
return string
def subst_kw(self, kw, *args, **kwargs):
return kw
def subst_list(self, string, *args, **kwargs):
nargs = (string, self,) + args
nkw = kwargs.copy()
nkw['gvars'] = {}
self.raw_to_mode(nkw)
return SCons.Subst.scons_subst_list(*nargs, **nkw)
def subst_target_source(self, string, *args, **kwargs):
nargs = (string, self,) + args
nkw = kwargs.copy()
nkw['gvars'] = {}
self.raw_to_mode(nkw)
return SCons.Subst.scons_subst(*nargs, **nkw)
return _NoSubstitutionProxy(subject)
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
示例8: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, subject):
"""Wrap an object as a Proxy object"""
self.__subject = subject
示例9: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, dict = None):
self._keys = []
UserDict.__init__(self, dict)
示例10: __init__
# 需要导入模块: from UserDict import UserDict [as 别名]
# 或者: from UserDict.UserDict import __init__ [as 别名]
def __init__(self, module=__name__):
self.logger = logging.getLogger('%s-%s(%s)' %(module, self.__class__, _get_idstr(self)))