當前位置: 首頁>>代碼示例>>Python>>正文


Python UserDict.__init__方法代碼示例

本文整理匯總了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)) 
開發者ID:34nm,項目名稱:gsmtpd,代碼行數:21,代碼來源:server.py

示例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) 
開發者ID:eonpatapon,項目名稱:contrail-api-cli,代碼行數:22,代碼來源:resource.py

示例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) 
開發者ID:gltn,項目名稱:stdm,代碼行數:18,代碼來源:attrmap.py

示例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) 
開發者ID:rafasashi,項目名稱:razzy-spinner,代碼行數:12,代碼來源:utilities.py

示例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 
開發者ID:AtomLinter,項目名稱:linter-pylama,代碼行數:8,代碼來源:singledispatch_helpers.py

示例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) 
開發者ID:coin3d,項目名稱:pivy,代碼行數:9,代碼來源:Environment.py

示例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: 
開發者ID:coin3d,項目名稱:pivy,代碼行數:41,代碼來源:Environment.py

示例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 
開發者ID:coin3d,項目名稱:pivy,代碼行數:5,代碼來源:Util.py

示例9: __init__

# 需要導入模塊: from UserDict import UserDict [as 別名]
# 或者: from UserDict.UserDict import __init__ [as 別名]
def __init__(self, dict = None):
        self._keys = []
        UserDict.__init__(self, dict) 
開發者ID:mirskytech,項目名稱:ansible-role-manager,代碼行數:5,代碼來源:odict.py

示例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))) 
開發者ID:donSchoe,項目名稱:p2pool-n,代碼行數:4,代碼來源:Utility.py


注:本文中的UserDict.UserDict.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。