02 2018 档案

摘要:#每个connector都有一个 Connection对象@implementer(interfaces.ITCPTransport, interfaces.ISystemHandle) class Connection(_TLSConnectionMixin, abstract.FileDescriptor, _SocketCloser, _AbortingM... 阅读全文

posted @ 2018-02-28 22:47 王将军之武库 |

摘要:@implementer(interfaces.IStreamClientEndpoint)class TCP4ClientEndpoint(object): """ TCP client endpoint with an IPv4 configuration. """ def __init__(s 阅读全文

posted @ 2018-02-28 18:06 王将军之武库 阅读(163) 评论(0) 推荐(0) |

摘要:def _next_request_from_scheduler(self, spider):#在引擎中处理一个请求 slot = self.slot request = slot.scheduler.next_request() if not request: return d = self._downlo... 阅读全文

posted @ 2018-02-28 16:15 王将军之武库 |

摘要:#reactorbase的主循环 def mainLoop(self): while self._started: try: while self._started: # Advance simulation time in delayed event ... 阅读全文

posted @ 2018-02-28 15:44 王将军之武库 阅读(310) 评论(0) 推荐(0) |

摘要:调用reactor.run(),就会调用到mainloop函数,从而调用到select或epoll,监控fd的读写。 posixbase.py: factory类负责connect的管理,比如connect的建立、丢失、失败等,procotol是负责数据的接收。 重要结论:调用 阅读全文

posted @ 2018-02-27 23:07 王将军之武库 阅读(319) 评论(0) 推荐(0) |

摘要:reactor的选择,不同平台会选择不同的reactor,比如linux会选epollreactor,从internet导入reactor.py时,执行下面代码 调用default.install()时就安装了reactor 阅读全文

posted @ 2018-02-27 18:38 王将军之武库 |

摘要:在Source Insight中看Python代码 http://blog.csdn.net/lvming404/archive/2009/03/18/4000394.aspx SI是个很强大的代码查看修改工具,以前用来看C,C++都是相当happy的。最近需要用Python,看了两天毫无颜色的Ul 阅读全文

posted @ 2018-02-27 17:39 王将军之武库 阅读(451) 评论(0) 推荐(0) |

摘要:每个请求对象的延迟对象经过_handle_downloader_output处理后,又会返回一个延迟对象。 engine的crawl函数 reactor.callLater(delay, self)通过timer触发deferred对象的callback。 阅读全文

posted @ 2018-02-26 23:21 王将军之武库 阅读(364) 评论(0) 推荐(0) |

摘要:没有return语句的函数的返回值: 阅读全文

posted @ 2018-02-26 18:08 王将军之武库 阅读(145) 评论(0) 推荐(0) |

摘要:@_oldStyle class Deferred: called = False#类变量,在实例中引用时会自动在实例中生成 paused = False _debugInfo = None _suppressAlreadyCalled = False # Are we currently running a user-installed c... 阅读全文

posted @ 2018-02-26 17:57 王将军之武库 阅读(488) 评论(0) 推荐(0) |

摘要:当运行scrapy crawl spider 时,会生成一个crawl命令对象,scrapy是调用execute函数(cmdlin.py)来执行命令的,execute函数会给命令对象添加crawler_process属性(cmd.crawler_process = CrawlerProcess(se 阅读全文

posted @ 2018-02-26 16:16 王将军之武库 阅读(574) 评论(0) 推荐(0) |

摘要:scrapy.Request(url, self.parse_detail) Request对象有回调函数。Request对象放到scheduler的队列中,engine会从schedule中取得request。 scrapy的crawl命令调用的函数 C:\Python27\Lib\site-pa 阅读全文

posted @ 2018-02-25 23:04 王将军之武库 阅读(277) 评论(0) 推荐(0) |

摘要:python 包 多个关系密切的模块应该组织成一个包,以便于维护和使用。这项技术能有效避免名字空间冲突。创建一个名字为包名字的文件夹并在该文件夹下创建一个__init__.py 文件就定义了一个包。你可以根据需要在该文件夹下存放资源文件、已编译扩展及子包。举例来说,一个包可能有以下结构: Graph 阅读全文

posted @ 2018-02-24 21:32 王将军之武库 阅读(288) 评论(0) 推荐(0) |

摘要:def get_handler(self, *args, **options): return get_internal_wsgi_application() def get_internal_wsgi_application(): from django.conf import settings 阅读全文

posted @ 2018-02-24 18:42 王将军之武库 阅读(649) 评论(0) 推荐(0) |

摘要:"""Generic socket server classes. This module tries to capture the various aspects of defining a server: For socket-based servers: - address family: - AF_INET{,6}: IP (Internet Protocol) s... 阅读全文

posted @ 2018-02-23 23:00 王将军之武库 阅读(281) 评论(0) 推荐(0) |

摘要:django的signal在djangobb中的使用: 以上代码使得每次新建一个post时,都会修改topic的内容 修饰器receiver调用信号的connect函数,添加了信号的处理器。 signal调用send函数时就会调用到signal的receiver,那post_save信号的send函 阅读全文

posted @ 2018-02-23 21:15 王将军之武库 阅读(292) 评论(0) 推荐(0) |

摘要:django的模板编译后变成一般text、tag、varible,然后根据上下文进行渲染。 class ForNode(Node): child_nodelists = ('nodelist_loop', 'nodelist_empty') def __init__(self, loopvars, 阅读全文

posted @ 2018-02-23 18:11 王将军之武库 阅读(245) 评论(0) 推荐(0) |

摘要:context作为view与template之间的桥梁,理解它的工作原理对于djagno的模板工作机制至关重要。 class ContextDict(dict)是用来保存数据的,它连接了context与dicts,该类可以作为with语句表达式。 class Context(BaseContext) 阅读全文

posted @ 2018-02-23 16:45 王将军之武库 阅读(2136) 评论(0) 推荐(1) |

摘要:python的with语句相当于try.....finally,它是如何实现的呢?下面就结合范例和伪指令的实现来分析一下。 with语句会汇编成:先调用with语句后面的表达式(open(...)),再与open的返回结果作为setup_with的参数,从setup_with的实现源码来看,它是先找 阅读全文

posted @ 2018-02-23 10:35 王将军之武库 阅读(175) 评论(0) 推荐(0) |

摘要:因为markdown,我接触到latex,因为latex,我花了几个月去看相关的书籍 我看了以下相关的资料 1.《LaTeX入门》 刘海洋 2.英文 TeX LaTeX Stack Exchange 3.中文 CTEX社区 高尔基 书籍是人类进步的阶梯 兴趣是最好的老师 阅读全文

posted @ 2018-02-09 09:10 王将军之武库 阅读(136) 评论(0) 推荐(0) |

摘要:二十号去比赛时,与同事闲聊时说起家庭服务器,后来搜到nas(网络附着存储器),找到freenas,突然觉得很有用,手机拍了大量的照片视频,存储在电脑,已经换过几次硬盘了,对于这些珍贵的资料,万一硬盘坏掉,就很麻烦。所以平时要做好备份,对照片视频进行处理。 从下载freenas时,版本选择,系统盘选择 阅读全文

posted @ 2018-02-08 21:14 王将军之武库 阅读(237) 评论(0) 推荐(0) |

摘要:2015年底移动送的华为g7,屏幕已经摔烂几个月了,运行速度也非常慢,打开uc,微信,东方财富要等很久,老提示程序没有反应,要关闭还是继续等待,超浪费时间。老婆说把她的荣耀8给我,她买苹果。成交。 阅读全文

posted @ 2018-02-08 20:45 王将军之武库 阅读(116) 评论(0) 推荐(0) |

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3