Python.Scrapy.12-scrapy-source-code-analysis-part-2
Scrapy 源代码分析系列-2 signals, signalmanager, project, conf
1. 模块: signals.py signalmanager.py project.py conf.py
1.1 conf.py project.py
conf.py 是废弃的模块。她的功能由crawler.settings代替。 来自conf.py的代码如下:
if 'scrapy.cmdline' not in sys.modules:
from scrapy.utils.project import get_project_settings
settings = get_project_settings() import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
warnings.warn("Module `scrapy.conf` is deprecated, use `crawler.settings` attribute instead",
ScrapyDeprecationWarning, stacklevel=2)
project.py 也是被废弃的模块。
1.2 interfaces.py
interfaces.py 定义了接口ISpiderManager, 接口方法如下:
def create(spider_name, **spider_args): 创建一个新的Spider对象。
def list(): 返回project中所有的spider。
def find_by_request(request): 处理request的sipder列表
该模块依赖: zope.interface (zope.interface), 关于该库另外进行分析。
1.3 signals.py signalmanager.py
signals.py 定义了一系列object类型的对象。
signalmanager.py 定义类SignalManager来管理signal。该类依赖 dispatcher 和 signal:
from scrapy.xlib.pydispatch import dispatcher
from scrapy.utils import signal
那么需要分析子包: scrapy.xlib
To Be Continued:
接下来分析模块: item.py link.py linkextractor.py log.py logformatter.py exceptions.py extension.py
Python.Scrapy.12-scrapy-source-code-analysis-part-2的更多相关文章
- Memcached source code analysis (threading model)--reference
Look under the start memcahced threading process memcached multi-threaded mainly by instantiating mu ...
- Golang Template source code analysis(Parse)
This blog was written at go 1.3.1 version. We know that we use template thought by followed way: fun ...
- Memcached source code analysis -- Analysis of change of state--reference
This article mainly introduces the process of Memcached, libevent structure of the main thread and w ...
- Apache Commons Pool2 源码分析 | Apache Commons Pool2 Source Code Analysis
Apache Commons Pool实现了对象池的功能.定义了对象的生成.销毁.激活.钝化等操作及其状态转换,并提供几个默认的对象池实现.在讲述其实现原理前,先提一下其中有几个重要的对象: Pool ...
- Redis source code analysis
http://zhangtielei.com/posts/blog-redis-dict.html http://zhangtielei.com/assets/photos_redis/redis_d ...
- linux kernel & source code analysis& hacking
https://kernelnewbies.org/ http://www.tldp.org/LDP/lki/index.html https://kernelnewbies.org/ML https ...
- 2018.6.21 HOLTEK HT49R70A-1 Source Code analysis
Cange note: “Reading TMR1H will latch the contents of TMR1H and TMR1L counter to the destination”? F ...
- The Ultimate List of Open Source Static Code Analysis Security Tools
https://www.checkmarx.com/2014/11/13/the-ultimate-list-of-open-source-static-code-analysis-security- ...
- Top 40 Static Code Analysis Tools
https://www.softwaretestinghelp.com/tools/top-40-static-code-analysis-tools/ In this article, I have ...
- Source Code Reading for Vue 3: How does `hasChanged` work?
Hey, guys! The next generation of Vue has released already. There are not only the brand new composi ...
随机推荐
- git配置管理
生成 SSH 公钥 如前所述,许多 Git 服务器都使用 SSH 公钥进行认证. 为了向 Git 服务器提供 SSH 公钥,如果某系统用户尚未拥有密钥,必须事先为其生成一份. 这个过程在所有操作系统上 ...
- bzoj3087: Coci2009 misolovke
Description [misolovke]给定一个 N*N 的网格.每个格子里至少会有一个捕鼠器, 并且已知每个格子里的捕鼠器个数.现在需要在 每一行 中选取恰好 K 个连续的格子, 把里面的捕鼠 ...
- Perl Sort函数用法总结和使用实例
一) sort函数用法 sort LISTsort BLOCK LISTsort SUBNAME LIST sort的用法有如上3种形式.它对LIST进行排序,并返回排序后的列表.假如忽略了SUBNA ...
- HBase体系结构(转)
HBase的服务器体系结构遵循简单的主从服务器架构,它由HRegion服务器(HRegion Server)群和HBase Master服务器(HBase Master Server)构成.HBase ...
- RestTemplate
RestTemplate是Spring提供的用于访问Rest服务的客户端,RestTemplate提供了多种便捷访问远程Http服务的方法,能够大大提高客户端的编写效率.调用RestTemplate的 ...
- ant 自定义taskdef的工作目录
上次同事在用ant执行多层目录的测试用例的时候遇到了一些问题,也就是自定义的taskdef的工作目录总是在开始执行ant的那个目录,而有一些地方用到了当前目录,因此很多测试用命的代码出现了“找不到自定 ...
- 【转】C#环形队列
概述 看了一个数据结构的教程,是用C++写的,可自己C#还是一个菜鸟,更别说C++了,但还是大胆尝试用C#将其中的环形队列的实现写出来,先上代码: 1 public class MyQueue< ...
- (String) 压缩String
e.g. aaabbcccc 返回a3b2c4 public static String compressString(String str) { StringBuilder sb=new S ...
- 60. Insert Interval && Merge Intervals
Insert Interval Given a set of non-overlapping intervals, insert a new interval into the intervals ( ...
- service对象
Service 对象 提供用于创建服务程序的一组工具 语法 Shell.Service[.property|method] 属性 Description 服务描述,仅限于 Windows 2000 及 ...