Skip to content

Commit

Permalink
chore: resolve flake8 linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncoulton committed Oct 2, 2019
1 parent 2c9bb59 commit ab799c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion watson/routing/__init__.py
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '1.2.3'
__version__ = '1.2.4'
1 change: 1 addition & 0 deletions watson/routing/routers.py
Expand Up @@ -292,6 +292,7 @@ def __init__(self, routes=None, build_strategies=None):
self.add_definition(route_definition)
self.sort()


# Deprecated, will be removed in the next major version

ListRouter = List
Expand Down
12 changes: 7 additions & 5 deletions watson/routing/routes.py
Expand Up @@ -134,7 +134,7 @@ def match(self, request):
"""
params = self.defaults.copy()
requires = self.requires.copy()
if not request.method in self._accepts:
if request.method not in self._accepts:
return None
if 'subdomain' in self.requires:
del requires['subdomain']
Expand Down Expand Up @@ -173,8 +173,9 @@ def __repr__(self):
self.path)
)

segments_pattern = re.compile('(?P<static>[^:\[\]]*)(?P<token>[:\[\]]|$)')
token_pattern = re.compile('(?P<name>[^:/\[\]]+)')

segments_pattern = re.compile(r'(?P<static>[^:\[\]]*)(?P<token>[:\[\]]|$)')
token_pattern = re.compile(r'(?P<name>[^:/\[\]]+)')
optional_segment_string = '(?:{value})?'
value_pattern_string = '(?P<{value}>{end})'
end_pattern_string = '[^/]+'
Expand Down Expand Up @@ -359,8 +360,8 @@ def match(self, request):
@classmethod
def builder(cls, **definition):
if ('regex' in definition
or ('path' in definition
and any((c in {'[', ':'}) for c in definition['path']))):
or ('path' in definition # noqa
and any((c in {'[', ':'}) for c in definition['path']))): # noqa
return cls(**definition)
raise TypeError('Not a valid Segment')

Expand Down Expand Up @@ -413,6 +414,7 @@ def match(self, request):
def builder(cls, **definition):
return cls(**definition)


# Deprecated, will be removed in the next major version

BaseRoute = Base
Expand Down

0 comments on commit ab799c9

Please sign in to comment.