当前位置: 首页>>代码示例>>Python>>正文


Python local.__init__函数代码示例

本文整理汇总了Python中threading.local.__init__函数的典型用法代码示例。如果您正苦于以下问题:Python __init__函数的具体用法?Python __init__怎么用?Python __init__使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了__init__函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, connection_class, host_port):
     local.__init__(self)
     self.__connection_class = connection_class
     self.__host_port = host_port
     self.__active = []
     self.__passive = []
     self.__timeout = float(environ.get("PY2NEO_TIMEOUT", 2))
开发者ID:sakisv,项目名称:py2neo,代码行数:7,代码来源:http.py

示例2: __init__

    def __init__(self, servers, debug=0, pickleProtocol=0,
                 pickler=pickle.Pickler, unpickler=pickle.Unpickler,
                 pload=None, pid=None):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        @param pickleProtocol: number to mandate protocol used by (c)Pickle.
        @param pickler: optional override of default Pickler to allow subclassing.
        @param unpickler: optional override of default Unpickler to allow subclassing.
        @param pload: optional persistent_load function to call on pickle loading.
        Useful for cPickle since subclassing isn't allowed.
        @param pid: optional persistent_id function to call on pickle storing.
        Useful for cPickle since subclassing isn't allowed.
        """
        local.__init__(self)
        self.set_servers(servers)
        self.debug = debug
        self.stats = {}

        # Allow users to modify pickling/unpickling behavior
        self.pickleProtocol = pickleProtocol
        self.pickler = pickler
        self.unpickler = unpickler
        self.persistent_load = pload
        self.persistent_id = pid
开发者ID:appliedcode,项目名称:appscale,代码行数:28,代码来源:memcachedb.py

示例3: __init__

    def __init__(self, servers=['127.0.0.1:11211'], debug=0, transcoder=Transcoder()):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        @param pickleProtocol: number to mandate protocol used by (c)Pickle.
        @param pickler: optional override of default Pickler to allow subclassing.
        @param unpickler: optional override of default Unpickler to allow subclassing.
        @param pload: optional persistent_load function to call on pickle loading.
        Useful for cPickle since subclassing isn't allowed.
        @param pid: optional persistent_id function to call on pickle storing.
        Useful for cPickle since subclassing isn't allowed.
        """
        local.__init__(self)
        self.debug = debug
        self.set_servers(servers)
        self.stats = {}


        #alias function
        self.gets = self.get_multi
        self.deletes = self.delete_multi
        self.destroy = self.disconnect_all
        self.close = self.disconnect_all
        if transcoder is None:
            raise _Error( 'empty transcoder')
        self.transcoder=transcoder
开发者ID:pkarc,项目名称:python3-memcache,代码行数:29,代码来源:memcache.py

示例4: __init__

    def __init__(self, servers, debug=0, pickleProtocol=0,
                 pickler=pickle.Pickler, unpickler=pickle.Unpickler,
                 pload=None, pid=None,
                 server_max_key_length=SERVER_MAX_KEY_LENGTH,
                 server_max_value_length=SERVER_MAX_VALUE_LENGTH,
                 dead_retry=_DEAD_RETRY, socket_timeout=_SOCKET_TIMEOUT,
                 cache_cas = False):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        @param pickleProtocol: number to mandate protocol used by (c)Pickle.
        @param pickler: optional override of default Pickler to allow subclassing.
        @param unpickler: optional override of default Unpickler to allow subclassing.
        @param pload: optional persistent_load function to call on pickle loading.
        Useful for cPickle since subclassing isn't allowed.
        @param pid: optional persistent_id function to call on pickle storing.
        Useful for cPickle since subclassing isn't allowed.
        @param dead_retry: number of seconds before retrying a blacklisted
        server. Default to 30 s.
        @param socket_timeout: timeout in seconds for all calls to a server. Defaults
        to 3 seconds.
        @param cache_cas: (default False) If true, cas operations will be
        cached.  WARNING: This cache is not expired internally, if you have
        a long-running process you will need to expire it manually via
        "client.reset_cas(), or the cache can grow unlimited.
        @param server_max_key_length: (default SERVER_MAX_KEY_LENGTH)
        Data that is larger than this will not be sent to the server.
        @param server_max_value_length: (default SERVER_MAX_VALUE_LENGTH)
        Data that is larger than this will not be sent to the server.
        """
        local.__init__(self)
        self.debug = debug
        self.dead_retry = dead_retry
        self.socket_timeout = socket_timeout
        self.set_servers(servers)
        self.stats = {}
        self.cache_cas = cache_cas
        self.reset_cas()

        # Allow users to modify pickling/unpickling behavior
        self.pickleProtocol = pickleProtocol
        self.pickler = pickler
        self.unpickler = unpickler
        self.persistent_load = pload
        self.persistent_id = pid
        self.server_max_key_length = server_max_key_length
        self.server_max_value_length = server_max_value_length

        #  figure out the pickler style
        file = StringIO()
        try:
            pickler = self.pickler(file, protocol = self.pickleProtocol)
            self.picklerIsKeyword = True
        except TypeError:
            self.picklerIsKeyword = False
开发者ID:nicholasserra,项目名称:python-ultramemcached,代码行数:58,代码来源:ultramemcache.py

示例5: __init__

    def __init__(self, servers, debug=0, pickleProtocol=0,
                 pickler=pickle.Pickler, unpickler=pickle.Unpickler,
                 pload=None, pid=None):

        local.__init__(self)

        super(TestClient, self).__init__(servers, debug=debug,
            pickleProtocol=pickleProtocol, pickler=pickler, unpickler=unpickler,
            pload=pload, pid=pid)

        self.data = {}
        self.token = 0
开发者ID:anemitz,项目名称:calendarserver,代码行数:12,代码来源:memcacheclient.py

示例6: __init__

    def __init__(self, servers, debug=0):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        """
        local.__init__(self)
        self.set_servers(servers)
        self.debug = debug
        self.stats = {}
开发者ID:Craigus,项目名称:lesswrong,代码行数:12,代码来源:memcache.py

示例7: __init__

    def __init__(
        self,
        servers,
        debug=0,
        pickleProtocol=0,
        pickler=pickle.Pickler,
        unpickler=pickle.Unpickler,
        pload=None,
        pid=None,
        server_max_key_length=SERVER_MAX_KEY_LENGTH,
        server_max_value_length=SERVER_MAX_VALUE_LENGTH,
        dead_retry=DEAD_RETRY,
        socket_timeout=SOCKET_TIMEOUT,
        router_class=Router,
    ):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        @param pickleProtocol: number to mandate protocol used by (c)Pickle.
        @param pickler: optional override of default Pickler to allow subclassing.
        @param unpickler: optional override of default Unpickler to allow subclassing.
        @param pload: optional persistent_load function to call on pickle loading.
        Useful for cPickle since subclassing isn't allowed.
        @param pid: optional persistent_id function to call on pickle storing.
        Useful for cPickle since subclassing isn't allowed.
        """
        local.__init__(self)
        self.debug = debug
        self.set_servers(servers, dead_retry, socket_timeout)
        self.router = router_class(self.servers)
        self.stats = {}
        self.cas_ids = {}

        # Allow users to modify pickling/unpickling behavior
        self.pickleProtocol = pickleProtocol
        self.pickler = pickler
        self.unpickler = unpickler
        self.persistent_load = pload
        self.persistent_id = pid
        self.server_max_key_length = server_max_key_length
        self.server_max_value_length = server_max_value_length

        #  figure out the pickler style
        file = StringIO()
        try:
            pickler = self.pickler(file, protocol=self.pickleProtocol)
            self.picklerIsKeyword = True
        except TypeError:
            self.picklerIsKeyword = False
开发者ID:tiny-mouse,项目名称:python-memcached,代码行数:52,代码来源:memcache.py

示例8: __init__

	def __init__(self, servers, debug=False):
		"""
		Create a new Client object with the given list of servers.

		:param servers: `servers` is passed to `set_servers`.
		:param debug: whether to display error messages when a server is unavailable.
		"""

		local.__init__(self)

		self.debug = debug

		self.servers = []
		self.buckets = []

		self.set_servers(servers)
		self.stats = {}
开发者ID:j4cbo,项目名称:chiral,代码行数:17,代码来源:memcache.py

示例9: __init__

    def __init__(self, servers, debug=0, pickleProtocol=0,
            pickler=pickle.Pickler, unpickler=pickle.Unpickler):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        """
        local.__init__(self)
        self.set_servers(servers)
        self.debug = debug
        self.stats = {}

        # Allow users to modify pickling/unpickling behavior
        self.pickleProtocol = pickleProtocol
        self.pickler = pickler
        self.unpickler = unpickler
开发者ID:ivanov,项目名称:sycamore,代码行数:18,代码来源:memcache.py

示例10: __init__

    def __init__(self, servers, debug=0,
                 server_max_key_length=SERVER_MAX_KEY_LENGTH,
                 server_max_value_length=SERVER_MAX_VALUE_LENGTH,
                 socket_timeout=_SOCKET_TIMEOUT):
        """
        Create a new Client object with the given list of servers.

        @param servers: C{servers} is passed to L{set_servers}.
        @param debug: whether to display error messages when a server can't be
        contacted.
        @param socket_timeout: timeout in seconds for all calls to a server. Defaults
        to 3 seconds.
        @param server_max_key_length: (default SERVER_MAX_KEY_LENGTH)
        Data that is larger than this will not be sent to the server.
        @param server_max_value_length: (default SERVER_MAX_VALUE_LENGTH)
        Data that is larger than this will not be sent to the server.
        """
        local.__init__(self)
        self.debug = debug
        self.socket_timeout = socket_timeout
        self.set_servers(servers)
        self.stats = {}
        self.server_max_key_length = server_max_key_length
        self.server_max_value_length = server_max_value_length
开发者ID:ericmoritz,项目名称:python-kestrel,代码行数:24,代码来源:kestrelpy.py

示例11: __init__

 def __init__(self, scheme, host_port):
     local.__init__(self)
     self._scheme = scheme
     self._host_port = host_port
     self._active = []
     self._passive = []
开发者ID:TTia,项目名称:Pykipedia,代码行数:6,代码来源:http.py

示例12: __init__

 def __init__(self, connection_class, host_port):
     local.__init__(self)
     self.__connection_class = connection_class
     self.__host_port = host_port
     self.__active = []
     self.__passive = []
开发者ID:bartaelterman,项目名称:snippets,代码行数:6,代码来源:http.py

示例13: __init__

 def __init__(self, queue):
     local.__init__(self)
     self.registered = False
     self.vote = False
     self.queue = queue
开发者ID:zopefoundation,项目名称:Products.CMFCore,代码行数:5,代码来源:indexing.py

示例14: __init__

 def __init__(self):
     local.__init__(self)
     self.sentinel = Sentinel()
     created_sentinels.append(id(self.sentinel))
开发者ID:loganfreeman,项目名称:gevent,代码行数:4,代码来源:test__local.py

示例15: __init__

 def __init__(self, stuff, foo=1):
     local.__init__(self)
     self.stuff = stuff
     self.foo = foo
开发者ID:Alex-CS,项目名称:sonify,代码行数:4,代码来源:test_threading_local_jy.py


注:本文中的threading.local.__init__函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。