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的更多相关文章

  1. Memcached source code analysis (threading model)--reference

    Look under the start memcahced threading process memcached multi-threaded mainly by instantiating mu ...

  2. 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 ...

  3. 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 ...

  4. Apache Commons Pool2 源码分析 | Apache Commons Pool2 Source Code Analysis

    Apache Commons Pool实现了对象池的功能.定义了对象的生成.销毁.激活.钝化等操作及其状态转换,并提供几个默认的对象池实现.在讲述其实现原理前,先提一下其中有几个重要的对象: Pool ...

  5. Redis source code analysis

    http://zhangtielei.com/posts/blog-redis-dict.html http://zhangtielei.com/assets/photos_redis/redis_d ...

  6. linux kernel & source code analysis& hacking

    https://kernelnewbies.org/ http://www.tldp.org/LDP/lki/index.html https://kernelnewbies.org/ML https ...

  7. 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 ...

  8. 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- ...

  9. Top 40 Static Code Analysis Tools

    https://www.softwaretestinghelp.com/tools/top-40-static-code-analysis-tools/ In this article, I have ...

  10. 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 ...

随机推荐

  1. Java的委托

    http://www.cnblogs.com/soojoe/archive/2012/04/12/2532304.html 委托模式是软件设计模式中的一项基本技巧.在委托模式中,有两个对象参与处理同一 ...

  2. [转]Windows系统中监控文件复制操作的几种方式

    1. ICopyHook 作用: 监视文件夹和打印机移动,删除, 重命名, 复制操作. 可以得到源和目标文件名. 可以控制拒绝操作. 缺点: 不能对文件进行控制. 只对Shell文件操作有效, 对原生 ...

  3. python---pymysql

    pymysql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同.2.7用MySQLdb,3.0用pymysql. #下载安装 pip3 install pymysql 使用 执 ...

  4. 正常月报表年初未分配利润修改backup

    原来:GLQC('3132',K('年')-1,'12',,,'本币','N','','本币','0001')+GLQC('314115',K('年')-1,'01',,,'本币','N','','本 ...

  5. 黄聪:基于jQuery+JSON的省市区三级地区联动

    查看演示:http://www.helloweba.com/demo/cityselect/ 源码下载:http://files.cnblogs.com/files/huangcong/citysel ...

  6. SparkContext源码阅读

    SparkContext是spark的入口,通过它来连接集群.创建RDD.广播变量等等. class SparkContext(config: SparkConf) extends Logging w ...

  7. netbean7.2 改变maven插件的中心库地址

    今天内网安装netbeans 7.2(因为所使用的JDK版本问题),但安装上去之后发现build failure,提示说仓库主机找不到,因为提示上说的是apache的仓库地址.看执行maven的输出可 ...

  8. C++中引用的本质

    一般的教材上讲到引用时,都是说"引用是对象的一个别名".我认为这种定义是不清晰的,不利于初学者理解引用.至少我自己曾经被这个定义困扰了一段时间.到底什么是"别名" ...

  9. flask 添加日志

    def add_error_handler(app): for exception in default_exceptions: app.register_error_handler(exceptio ...

  10. RH LINUX5.5 RAW绑定

    ****************ORACLE 11G RAC***********************Disk /dev/sdb: 2147 MB, 2147483648 bytes67 head ...