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


Python dummy_threading.RLock方法代碼示例

本文整理匯總了Python中dummy_threading.RLock方法的典型用法代碼示例。如果您正苦於以下問題:Python dummy_threading.RLock方法的具體用法?Python dummy_threading.RLock怎麽用?Python dummy_threading.RLock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dummy_threading的用法示例。


在下文中一共展示了dummy_threading.RLock方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import RLock [as 別名]
def __init__(self, url, timeout=None, num_workers=10, **kwargs):
        """
        Initialise an instance.
        :param url: The root URL to use for scraping.
        :param timeout: The timeout, in seconds, to be applied to requests.
                        This defaults to ``None`` (no timeout specified).
        :param num_workers: The number of worker threads you want to do I/O,
                            This defaults to 10.
        :param kwargs: Passed to the superclass.
        """
        super(SimpleScrapingLocator, self).__init__(**kwargs)
        self.base_url = ensure_slash(url)
        self.timeout = timeout
        self._page_cache = {}
        self._seen = set()
        self._to_fetch = queue.Queue()
        self._bad_hosts = set()
        self.skip_externals = False
        self.num_workers = num_workers
        self._lock = threading.RLock()
        # See issue #45: we need to be resilient when the locator is used
        # in a thread, e.g. with concurrent.futures. We can't use self._lock
        # as it is for coordinating our internal threads - the ones created
        # in _prepare_threads.
        self._gplock = threading.RLock() 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:27,代碼來源:locators.py

示例2: __getstate__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import RLock [as 別名]
def __getstate__(self):
        """Unlike a normal CookieJar, this class is pickleable."""
        state = self.__dict__.copy()
        # remove the unpickleable RLock object
        state.pop('_cookies_lock')
        return state 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:8,代碼來源:cookies.py

示例3: __setstate__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import RLock [as 別名]
def __setstate__(self, state):
        """Unlike a normal CookieJar, this class is pickleable."""
        self.__dict__.update(state)
        if '_cookies_lock' not in self.__dict__:
            self._cookies_lock = threading.RLock() 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:7,代碼來源:cookies.py

示例4: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import RLock [as 別名]
def __init__(self, policy=None):
        if policy is None:
            policy = DefaultCookiePolicy()
        self._policy = policy

        self._cookies_lock = _threading.RLock()
        self._cookies = {} 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:9,代碼來源:cookiejar.py


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