Andriy Kornatskyy avatar Andriy Kornatskyy committed 5be1f7f

Fixed PEP8 warnings.

Comments (0)

Files changed (15)

 dist/
 env/
 src/*.egg-info/
+.cache
 .coverage
 *.pyc
 *.pyo
 clean:
 	find src/ demos/ -type d -name __pycache__ | xargs rm -rf
 	find src/ demos/ -name '*.py[co]' -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

demos/hello/test_helloworld.py

 
         environ = {'PATH_INFO': '/'}
         response = list(map(lambda c: c.decode('utf-8'),
-            main(environ, start_response)))
+                            main(environ, start_response)))
 
         self.assertEquals(['Hello World!'], response)
 
         for path in ('/a', '/b'):
             environ = {'PATH_INFO': path}
             response = list(map(lambda c: c.decode('utf-8'),
-                main(environ, start_response)))
+                                main(environ, start_response)))
 
             self.assertEquals([''], response)

demos/time/app.py

     handler, kwargs = router.match(environ['PATH_INFO'].lstrip('/'))
     environ['routing.kwargs'] = kwargs
     return map(lambda chunk: chunk.encode('utf8'),
-            handler(environ, start_response))
+               handler(environ, start_response))
 
 if __name__ == '__main__':
     from wsgiref.simple_server import make_server

demos/time/test_functional.py

 
         environ = {'PATH_INFO': path}
         return ''.join(map(lambda chunk: chunk.decode('utf-8'),
-            main(environ, start_response)))
+                           main(environ, start_response)))
 
     def test_welcome(self):
         """ Welcome page must have a valid path
             intended request processors (views).
         """
         for path in ('/server', '/server/', '/server/time/x',
-            '/x', '/abc'):
+                     '/x', '/abc'):
             response = self.go(path, '404 Not Found')
 
             assert 'Not Found' in response
 upload-dir = doc/_build
 
 [pytest]
+pep8ignore =

src/wheezy/routing/comp.py

 
     #import collections
     #callable = lambda obj: isinstance(obj, collections.Callable)
-    callable = lambda obj: any("__call__" in klass.__dict__
-            for klass in type(obj).__mro__)
+    callable = lambda obj: any(
+        "__call__" in klass.__dict__ for klass in type(obj).__mro__)
 else:  # pragma: nocover
     basestring = basestring
 

src/wheezy/routing/route.py

         self.matched = len(pattern)
         # Choose match strategy
         self.match = finishing and self.equals_match \
-                or self.startswith_match
+            or self.startswith_match
 
     def equals_match(self, path):
         """ If the ``path`` exactly equals pattern string,
     if len(parts) % 2 == 1 and not parts[-1]:
         parts = parts[:-1]
     parts[1::2] = [value_provider(RE_SPLIT.split(p)[1])
-            for p in parts[1::2]]
+                   for p in parts[1::2]]
     return parts
 
 

src/wheezy/routing/router.py

         self.mapping = []
         self.route_map = {}
         self.routers = []
-        self.route_builders = route_builders or \
-                default_route_builders
+        self.route_builders = route_builders or default_route_builders
 
-    def add_route(self, pattern, handler,
-            kwargs=None, name=None):
+    def add_route(self, pattern, handler, kwargs=None, name=None):
         """ Adds a pattern to route table
 
             >>> r = PathRouter()

src/wheezy/routing/tests/test_builders.py

         r = PlainRoute('', True)
 
         self.assertRaises(LookupError,
-                lambda: build_route(r, False, None, []))
+                          lambda: build_route(r, False, None, []))
 
     def test_found(self):
         """ Sutable route strategy has been found.
         m.replay()
 
         self.assertRaises(LookupError,
-                lambda: build_route(r'abc', False, None, builders))
+                          lambda: build_route(r'abc', False, None, builders))
         m.verify()
 
 
         from wheezy.routing.route import RegexRoute
 
         r = build_route(
-                r'abc/{id}',
-                False,
-                None,
-                config.route_builders
+            r'abc/{id}',
+            False,
+            None,
+            config.route_builders
         )
 
         assert isinstance(r, RegexRoute)
         from wheezy.routing.route import RegexRoute
 
         r = build_route(
-                r'abc/{id}',
-                True,
-                None,
-                config.route_builders
+            r'abc/{id}',
+            True,
+            None,
+            config.route_builders
         )
 
         assert isinstance(r, RegexRoute)
         from wheezy.routing.route import RegexRoute
 
         r = build_route(
-                r'abc/(?P<id>\d+)',
-                False,
-                None,
-                config.route_builders
+            r'abc/(?P<id>\d+)',
+            False,
+            None,
+            config.route_builders
         )
 
         assert isinstance(r, RegexRoute)

src/wheezy/routing/tests/test_config.py

             assert builder
             assert callable(builder)
             args, varargs, keywords, defaults = \
-                    inspect.getargspec(builder)
+                inspect.getargspec(builder)
             self.assertEqual(['pattern', 'finishing', 'kwargs'], args)
             self.assertEqual(None, varargs)
             self.assertEqual(None, keywords)

src/wheezy/routing/tests/test_curly.py

         self.assertEquals('abc', group_name)
         self.assertEquals('s', pattern_name)
         self.assertEquals(
-                config.curly_default_pattern,
-                pattern_name
+            config.curly_default_pattern,
+            pattern_name
         )
 
     def test_with_colon(self):
         """ there is colon in input string
         """
         from wheezy.routing.curly import parse
-        from wheezy.routing import config
 
         group_name, pattern_name = parse('abc:i')
 

src/wheezy/routing/tests/test_import.py

         from inspect import ismodule
 
         x = [x for x in dir(routing) if x[:2] != '__'
-                and not ismodule(eval('routing.' + x))]
+             and not ismodule(eval('routing.' + x))]
 
         self.assertEqual(['PathRouter', 'url'], x)

src/wheezy/routing/tests/test_route.py

 
         r = Route()
         self.assertRaises(NotImplementedError,
-                lambda: r.match(''))
+                          lambda: r.match(''))
 
     def test_path_raise_error(self):
         """ ``Route.match`` raises error
 
         r = Route()
         self.assertRaises(NotImplementedError,
-                lambda: r.path())
+                          lambda: r.path())
 
 
 class PlainRouteInitTestCase(unittest.TestCase):

src/wheezy/routing/tests/test_router.py

         expect(mock_route.path)
         mock_build_route = self.m.replace(builders.build_route)
         expect(
-                mock_build_route('', True,
-                    {'route_name': 'x'},
-                    self.r.route_builders)
+            mock_build_route(
+                '', True,
+                {'route_name': 'x'},
+                self.r.route_builders
+            )
         ).result(mock_route)
         expect(mock_route.match('')).result((0, None))
         self.m.replay()
     def test_merge_inner_override_outer(self):
         """ inner match kwargs override outer kwargs.
         """
-        expect(self.mock_inner.match('de')).result(('h',
-            {'a': 1000, 'b': 2}))
+        expect(self.mock_inner.match('de')).result((
+            'h', {'a': 1000, 'b': 2}))
         self.m.replay()
 
         self.r.include('abc/', [], {'a': 1})
         expect(mock_route.match)
         mock_build_route = self.m.replace(builders.build_route)
         expect(
-                mock_build_route(
-                    'abc',
-                    True,
-                    {'route_name': 'n'},
-                    self.r.route_builders)
+            mock_build_route(
+                'abc',
+                True,
+                {'route_name': 'n'},
+                self.r.route_builders)
         ).result(mock_route)
         expect(mock_route.path({'a': 1})).result('abc')
         self.m.replay()
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.