当前位置: 首页>>代码示例>>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;未经允许,请勿转载。