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 ...
随机推荐
- [2014.01.27]WFsoft.wfWebCtrl.wfUrlPager 3.2
wfUrlPager多功能.Net翻页组件,使用简单,功能强大. 提供"首页","上一页","下一页","末页",&qu ...
- 使用Script Component源处理不规则平面文件
微软 BI 系列随笔 - SSIS 2012 高级应用 - Script Component处理不规则平面文件 场景介绍 在使用SSIS从平面文件导入源数据时,最常遇到的是以下两种情况: 导入规则的平 ...
- Correlation Filter in Visual Tracking系列一:Visual Object Tracking using Adaptive Correlation Filters 论文笔记
Visual Object Tracking using Adaptive Correlation Filters 一文发表于2010的CVPR上,是笔者所知的第一篇将correlation filt ...
- 【mysql】压缩myisam数据表
myisam引擎介绍 存储结构: MyISAM每张表被存放在三个文件: frm:表格定义: MYD(MYData):数据文件: MYI(MYIndex):索引文件: 存储空间: MyISAM可被压 ...
- 黄聪:jquery 校验中国身份证号码
大陆18位身份证(第二代身份证) 身份号码是一组具有特征组合码,由十七位数字本体码和一位校验码组成. 排列顺序从左至右依次为:六位数字地区码,八位数字生日码,三位数字顺序码和一位数字校验码. 校验方法 ...
- EditText----
==============01 editText属性 1.输入法Enter键图标的设置: 软件盘的界面替换只有一个属性android:imeOptions,这个属性的可以取的值有normal,a ...
- 用WinDbg调试Windows和驱动程序
由于本人能力有限,翻译不足之处敬请谅解,欢迎批评指正:sunylat@163.com MSDN原文:https://msdn.microsoft.com/zh-cn/library/windows/h ...
- AngularJS 中利用 Interceptors 来统一处理 HTTP 的错误(reproduce)
原文:http://chensd.com/2016-03/Angular-Handle-Global-Http-Error-with-Interceptors.html?utm_source=tuic ...
- 1,SFDC 管理员篇 - 基本设置
1, 公司配置 Setup | Administrator| Company Profile *Company Inforamtion:公司基础信息,License信息,重要的设置包括本地时间,币种, ...
- java 枚举类 enum 总结
枚举定义: enum是计算机编程语言中的一种数据类型.枚举类型:在实际问题中,有些变量的取值被限定在一个有限的范围内.例如,一个星期内只有七天,一年只有十二个月,一个班每周有六门课程等等.如果把这些量 ...