This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. What is x? | |
| type(x) = x | |
| # 2. What's the output of the following code | |
| # What's wrong with it? | |
| # How to fix? | |
| def foo(x=1, a=[]): | |
| a.append(x) | |
| return a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from logging import getLogger | |
| from twisted.internet import protocol, reactor, task | |
| from twisted.internet.defer import inlineCallbacks, Deferred, returnValue, DeferredList | |
| from txamqp import spec | |
| from txamqp.protocol import AMQClient | |
| from txamqp.client import TwistedDelegate | |
| from txamqp.content import Content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from scrapy import log | |
| from scrapy.http import Request | |
| from scrapy.exceptions import IgnoreRequest | |
| from scrapy.utils.httpobj import urlparse_cached | |
| from scrapy.contrib.downloadermiddleware.redirect import RedirectMiddleware | |
| class RedirectOffsiteMiddleware(RedirectMiddleware): |