|
@@ -2,30 +2,29 @@ from __future__ import generators
|
|
|
|
|
|
############## py3k #########################################################
|
|
############## py3k #########################################################
|
|
try:
|
|
try:
|
|
- from UserList import UserList
|
|
|
|
|
|
+ from UserList import UserList # noqa
|
|
except ImportError:
|
|
except ImportError:
|
|
- from collections import UserList
|
|
|
|
|
|
+ from collections import UserList # noqa
|
|
|
|
|
|
try:
|
|
try:
|
|
- from UserDict import UserDict
|
|
|
|
|
|
+ from UserDict import UserDict # noqa
|
|
except ImportError:
|
|
except ImportError:
|
|
- from collections import UserDict
|
|
|
|
|
|
+ from collections import UserDict # noqa
|
|
|
|
|
|
try:
|
|
try:
|
|
- from cStringIO import StringIO
|
|
|
|
|
|
+ from cStringIO import StringIO # noqa
|
|
except ImportError:
|
|
except ImportError:
|
|
try:
|
|
try:
|
|
- from StringIO import StringIO
|
|
|
|
|
|
+ from StringIO import StringIO # noqa
|
|
except ImportError:
|
|
except ImportError:
|
|
- from io import StringIO
|
|
|
|
|
|
+ from io import StringIO # noqa
|
|
|
|
|
|
############## urlparse.parse_qsl ###########################################
|
|
############## urlparse.parse_qsl ###########################################
|
|
|
|
|
|
try:
|
|
try:
|
|
from urlparse import parse_qsl
|
|
from urlparse import parse_qsl
|
|
except ImportError:
|
|
except ImportError:
|
|
- from cgi import parse_qsl
|
|
|
|
-parse_sql = parse_qsl
|
|
|
|
|
|
+ from cgi import parse_qsl # noqa
|
|
|
|
|
|
############## __builtin__.all ##############################################
|
|
############## __builtin__.all ##############################################
|
|
|
|
|
|
@@ -33,6 +32,7 @@ try:
|
|
all([True])
|
|
all([True])
|
|
all = all
|
|
all = all
|
|
except NameError:
|
|
except NameError:
|
|
|
|
+
|
|
def all(iterable):
|
|
def all(iterable):
|
|
for item in iterable:
|
|
for item in iterable:
|
|
if not item:
|
|
if not item:
|
|
@@ -45,6 +45,7 @@ try:
|
|
any([True])
|
|
any([True])
|
|
any = any
|
|
any = any
|
|
except NameError:
|
|
except NameError:
|
|
|
|
+
|
|
def any(iterable):
|
|
def any(iterable):
|
|
for item in iterable:
|
|
for item in iterable:
|
|
if item:
|
|
if item:
|
|
@@ -57,7 +58,7 @@ import weakref
|
|
try:
|
|
try:
|
|
from collections import MutableMapping
|
|
from collections import MutableMapping
|
|
except ImportError:
|
|
except ImportError:
|
|
- from UserDict import DictMixin as MutableMapping
|
|
|
|
|
|
+ from UserDict import DictMixin as MutableMapping # noqa
|
|
from itertools import imap as _imap
|
|
from itertools import imap as _imap
|
|
from operator import eq as _eq
|
|
from operator import eq as _eq
|
|
|
|
|
|
@@ -267,7 +268,7 @@ class CompatOrderedDict(dict, MutableMapping):
|
|
try:
|
|
try:
|
|
from collections import OrderedDict
|
|
from collections import OrderedDict
|
|
except ImportError:
|
|
except ImportError:
|
|
- OrderedDict = CompatOrderedDict
|
|
|
|
|
|
+ OrderedDict = CompatOrderedDict # noqa
|
|
|
|
|
|
############## collections.defaultdict ######################################
|
|
############## collections.defaultdict ######################################
|
|
|
|
|
|
@@ -276,7 +277,7 @@ try:
|
|
except ImportError:
|
|
except ImportError:
|
|
# Written by Jason Kirtland, taken from Python Cookbook:
|
|
# Written by Jason Kirtland, taken from Python Cookbook:
|
|
# <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/523034>
|
|
# <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/523034>
|
|
- class defaultdict(dict):
|
|
|
|
|
|
+ class defaultdict(dict): # noqa
|
|
|
|
|
|
def __init__(self, default_factory=None, *args, **kwargs):
|
|
def __init__(self, default_factory=None, *args, **kwargs):
|
|
dict.__init__(self, *args, **kwargs)
|
|
dict.__init__(self, *args, **kwargs)
|
|
@@ -322,7 +323,7 @@ import logging
|
|
try:
|
|
try:
|
|
import multiprocessing
|
|
import multiprocessing
|
|
except ImportError:
|
|
except ImportError:
|
|
- multiprocessing = None
|
|
|
|
|
|
+ multiprocessing = None # noqa
|
|
import sys
|
|
import sys
|
|
|
|
|
|
from logging import LogRecord
|
|
from logging import LogRecord
|
|
@@ -331,6 +332,7 @@ log_takes_extra = "extra" in inspect.getargspec(logging.Logger._log)[0]
|
|
|
|
|
|
# The func argument to LogRecord was added in 2.5
|
|
# The func argument to LogRecord was added in 2.5
|
|
if "func" not in inspect.getargspec(LogRecord.__init__)[0]:
|
|
if "func" not in inspect.getargspec(LogRecord.__init__)[0]:
|
|
|
|
+
|
|
def LogRecord(name, level, fn, lno, msg, args, exc_info, func):
|
|
def LogRecord(name, level, fn, lno, msg, args, exc_info, func):
|
|
return logging.LogRecord(name, level, fn, lno, msg, args, exc_info)
|
|
return logging.LogRecord(name, level, fn, lno, msg, args, exc_info)
|
|
|
|
|
|
@@ -437,7 +439,7 @@ class _CompatLoggerAdapter(object):
|
|
try:
|
|
try:
|
|
from logging import LoggerAdapter
|
|
from logging import LoggerAdapter
|
|
except ImportError:
|
|
except ImportError:
|
|
- LoggerAdapter = _CompatLoggerAdapter
|
|
|
|
|
|
+ LoggerAdapter = _CompatLoggerAdapter # noqa
|
|
|
|
|
|
|
|
|
|
def log_with_extra(logger, level, msg, *args, **kwargs):
|
|
def log_with_extra(logger, level, msg, *args, **kwargs):
|
|
@@ -452,7 +454,7 @@ try:
|
|
except ImportError:
|
|
except ImportError:
|
|
import itertools
|
|
import itertools
|
|
|
|
|
|
- def izip_longest(*args, **kwds):
|
|
|
|
|
|
+ def izip_longest(*args, **kwds): # noqa
|
|
fillvalue = kwds.get("fillvalue")
|
|
fillvalue = kwds.get("fillvalue")
|
|
|
|
|
|
def sentinel(counter=([fillvalue] * (len(args) - 1)).pop):
|
|
def sentinel(counter=([fillvalue] * (len(args) - 1)).pop):
|
|
@@ -495,7 +497,7 @@ else:
|
|
try:
|
|
try:
|
|
from logging.handlers import WatchedFileHandler
|
|
from logging.handlers import WatchedFileHandler
|
|
except ImportError:
|
|
except ImportError:
|
|
- class WatchedFileHandler(logging.FileHandler):
|
|
|
|
|
|
+ class WatchedFileHandler(logging.FileHandler): # noqa
|
|
"""
|
|
"""
|
|
A handler for logging to a file, which watches the file
|
|
A handler for logging to a file, which watches the file
|
|
to see if it has changed while in use. This can happen because of
|
|
to see if it has changed while in use. This can happen because of
|