Andriy Kornatskyy avatar Andriy Kornatskyy committed 3d35c36

Fixed PEP8 warnings.

Comments (0)

Files changed (11)

 dist/
 env/
 src/*.egg-info/
+.cache/
 .coverage
 *.pyc
 *.pyo
 	find src/ -type d -name __pycache__ | xargs rm -rf
 	find src/ -name '*.py[co]' -delete
 	find src/ -name '*.mo' -delete
-	rm -rf dist/ build/ MANIFEST src/*.egg-info
+	rm -rf dist/ build/ MANIFEST src/*.egg-info .cache .coverage
 
 release:
 	$(PYTHON) setup.py -q bdist_egg
 upload-dir = doc/_build
 
 [pytest]
-
+pep8ignore =

src/wheezy/core/benchmark.py

 
     def report(self, name=None, baselines=None):
         baselines = baselines or {}
-        print("%s: %s x %s" % (
-                name or 'noname', len(self.targets), self.number))
-        print("%s %s %s %s" % (
-                "baseline", "throughput", "change", "target"))
+        print("%s: %s x %s" % (name or 'noname',
+                               len(self.targets), self.number))
+        print("%s %s %s %s" % ("baseline", "throughput", "change", "target"))
         base = None
         for (name, result) in self.run():
             if base is None:
             previous_relative = baselines.get(name, base_relative)
             delta = base_relative / previous_relative - 1.0
             print("%7.1f%% %7drps %+5.1f%% %s" % (
-                    base_relative * 100, rps, delta * 100, name))
+                base_relative * 100, rps, delta * 100, name))

src/wheezy/core/collections.py

     """
     size = 0
     crc = 0
-    gzip = zlib.compressobj(compress_level, zlib.DEFLATED,
-            -zlib.MAX_WBITS, zlib.DEF_MEM_LEVEL, 0)
+    gzip = zlib.compressobj(
+        compress_level, zlib.DEFLATED, -zlib.MAX_WBITS,
+        zlib.DEF_MEM_LEVEL, 0)
     yield GZIP_HEADER
     for item in items:
         size += len(item)

src/wheezy/core/comp.py

 else:  # pragma: nocover
     # perform absolute import
     __saved_import__ = __import__
-    __import__ = lambda n, g=None, l=None, f=None:\
-            __saved_import__(n, g, l, f, 0)
+    __import__ = lambda n, g=None, l=None, f=None: \
+        __saved_import__(n, g, l, f, 0)
 
 
 try:  # pragma: nocover
     #from collections import defaultdict
-    defaultdict = __import__('collections', None, None,
-            ['defaultdict']).defaultdict
+    defaultdict = __import__(
+        'collections', None, None, ['defaultdict']).defaultdict
 except AttributeError:  # pragma: nocover
 
     class defaultdict(dict):
 
         def __init__(self, default_factory=None, *args, **kwargs):
-            if default_factory and \
-                not hasattr(default_factory, '__call__'):
+            if default_factory and not hasattr(default_factory, '__call__'):
                 raise TypeError('first argument must be callable')
             super(defaultdict, self).__init__(*args, **kwargs)
             self.default_factory = default_factory
     ref_gettext = lambda t: t.ugettext
 
 if PY3 or PY2 and PY_MINOR >= 6:  # pragma: nocover
-    m = __import__('json', None, None,
-            ['JSONEncoder', 'dumps', 'loads'])
+    m = __import__('json', None, None, ['JSONEncoder', 'dumps', 'loads'])
     SimpleJSONEncoder = m.JSONEncoder
     json_dumps = m.dumps
     json_loads = m.loads

src/wheezy/core/datetime.py

 
 ZERO = timedelta(0)
 WEEKDAYS = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
-MONTHS = (None, "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+MONTHS = (
+    None, "Jan", "Feb", "Mar", "Apr", "May", "Jun",
     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
 
 
         return delta.seconds + delta.days * 86400
     else:
         raise TypeError('Expecting type datetime.timedelta '
-            'or int for seconds')
+                        'or int for seconds')
 
 
 class utc(tzinfo):

src/wheezy/core/i18n.py

         self.default_lang = default_lang
         self.fallbacks = {}
         self.translations = defaultdict(
-                lambda: defaultdict(lambda: null_translations))
+            lambda: defaultdict(lambda: null_translations))
         if directories:
             for localedir in directories:
                 self.load(localedir)
                     if lang not in self.fallbacks:
                         self.add_fallback((lang,))
                     self.translations[lang][domain] = gettext.translation(
-                            domain,
-                            localedir,
-                            languages=self.fallbacks[lang]
+                        domain,
+                        localedir,
+                        languages=self.fallbacks[lang]
                     )
 
     def __getitem__(self, lang):

src/wheezy/core/json.py

         embed javascript code.
     """
     return json_dumps(obj, cls=JSONEncoder, ensure_ascii=False,
-            separators=(',', ':')).replace('</', '<\\/')
+                      separators=(',', ':')).replace('</', '<\\/')
 
 
 def json_decode(s):

src/wheezy/core/tests/test_json.py

 
         def test_encode_date(self):
             self.assertEqual(
-                    json_encode({'d': date(2012, 2, 22)}),
-                    '{"d":"2012-02-22"}')
+                json_encode({'d': date(2012, 2, 22)}),
+                '{"d":"2012-02-22"}')
             self.assertEqual(
-                    json_encode({'d': date.min}),
-                    '{"d":""}')
+                json_encode({'d': date.min}),
+                '{"d":""}')
 
         def test_encode_datetime(self):
             self.assertEqual(
-                    json_encode({'d': datetime(2012, 2, 22)}),
-                    '{"d":"2012-02-22T00:00:00"}')
+                json_encode({'d': datetime(2012, 2, 22)}),
+                '{"d":"2012-02-22T00:00:00"}')
             self.assertEqual(
-                    json_encode({'d': datetime(2012, 2, 22, 14, 17, 39)}),
-                    '{"d":"2012-02-22T14:17:39"}')
+                json_encode({'d': datetime(2012, 2, 22, 14, 17, 39)}),
+                '{"d":"2012-02-22T14:17:39"}')
             self.assertEqual(
-                    json_encode({'d': datetime.min}),
-                    '{"d":""}')
+                json_encode({'d': datetime.min}),
+                '{"d":""}')
 
         def test_encode_time(self):
             self.assertEqual(
-                    json_encode({'d': time(14, 17, 39, 422)}),
-                    '{"d":"14:17:39"}')
+                json_encode({'d': time(14, 17, 39, 422)}),
+                '{"d":"14:17:39"}')
 
         def test_encode_decimal(self):
             self.assertEqual(
-                    json_encode({'d': Decimal('14.79')}),
-                    '{"d":"14.79"}')
+                json_encode({'d': Decimal('14.79')}),
+                '{"d":"14.79"}')
 
         def test_encode_unicode(self):
             from wheezy.core.comp import u
             self.assertEqual(
-                    json_encode({'d': u('x')}),
-                    '{"d":"x"}')
+                json_encode({'d': u('x')}),
+                '{"d":"x"}')
 
         def test_forward_slashes_escaped(self):
             self.assertEqual(
-                    json_encode({'d': '</script>'}),
-                    '{"d":"<\\/script>"}')
+                json_encode({'d': '</script>'}),
+                '{"d":"<\\/script>"}')
 
     class JSONDecodeTestCase(unittest.TestCase):
         """ Test the ``json_encode`` function.

src/wheezy/core/url.py

 
 
 def urlparts(parts=None, scheme=None, netloc=None, path=None,
-        query=None, fragment=None):
+             query=None, fragment=None):
     """ Factory function for :py:class:`~wheezy.core.url.UrlParts` that
         create an instance :py:class:`~wheezy.core.url.UrlParts` with
         partial content.
             'https://www.python.org/test'
         """
         parts = (
-                other[0] or self[0],
-                other[1] or self[1],
-                other[2] or self[2],
-                other[3],
-                other[4])
+            other[0] or self[0],
+            other[1] or self[1],
+            other[2] or self[2],
+            other[3],
+            other[4])
         return UrlParts(parts)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.