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 ...
随机推荐
- 【python】and和or的用法
python 中的and从左到右计算表达式,若所有值均为真,则返回最后一个值,若存在假,返回第一个假值. or也是从左到有计算表达式,返回第一个为真的值. IDLE 1.2.4>>> ...
- StringIO学习
StringIO StringIO的行为与file对象非常像,但它不是磁盘上文件,而是一个内存里的“文件”,我们可以将操作磁盘文件那样来操作StringIO.一个简单的例子,让你对StringIO有一 ...
- ADF_Data Binding系列2_使用URL Service Data Control
2015-02-16 Created By BaoXinjian
- 圆内接三角形(X神的代码玩的真好)
设$S$为半径等于$1$的圆内接三角形的面积,则$4S+\dfrac 9S$的最小值是_______. [分析与解] 先证明$S$的最大值为$\dfrac{3\sqrt 3}4$.设$\triangl ...
- ant 自定义taskdef的工作目录
上次同事在用ant执行多层目录的测试用例的时候遇到了一些问题,也就是自定义的taskdef的工作目录总是在开始执行ant的那个目录,而有一些地方用到了当前目录,因此很多测试用命的代码出现了“找不到自定 ...
- CGContextAddArcToPoint和CGContextAddArc
比较难的是CGContextAddArcToPoint 代码如下: CGContextRef context=UIGraphicsGetCurrentContext(); CGContextSetRG ...
- 15. Linked List Cycle && Linked List Cycle II
Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up: Can you solve i ...
- JAVA设计模式之模版方法模式
在阎宏博士的<JAVA与模式>一书中开头是这样描述模板方法(Template Method)模式的: 模板方法模式是类的行为模式.准备一个抽象类,将部分逻辑以具体方法以及具体构造函数的形式 ...
- java中数据类型转换
1.自动类型转换:首先两者数据类型要兼容,且目标类型要大于源类型如(int类型转换成double类型) 2.强制转换:两者数据类型要兼容,会使破坏数据的结构
- DCC Software and Graphics System
After working with DCC software for so many years, I saw the realtime solution went forward so much, ...