Skip to content

Commit

Permalink
Update flake8 to 3.7 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jd committed Mar 30, 2019
1 parent 8a26318 commit d73b1e7
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ddtrace/contrib/pyramid/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def insert_tween_if_needed(settings):
# pyramid. We need our tween to be before it, otherwise unhandled
# exceptions will be caught before they reach our tween.
idx = tweens.find(pyramid.tweens.EXCVIEW)
if idx is -1:
if idx == -1:
settings['pyramid.tweens'] = tweens + '\n' + DD_TWEEN_NAME
else:
settings['pyramid.tweens'] = tweens[:idx] + DD_TWEEN_NAME + "\n" + tweens[idx:]
2 changes: 1 addition & 1 deletion ddtrace/contrib/tornado/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def notify(self):
'analytics_enabled': False,
'settings': {
'FILTERS': [
FilterRequestsOnUrl(r'http://test\.example\.com'),
FilterRequestsOnUrl(r'http://test\\.example\\.com'),
],
},
},
Expand Down
6 changes: 3 additions & 3 deletions ddtrace/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class FilterRequestsOnUrl(object):
To filter out http calls to domain api.example.com::
FilterRequestsOnUrl(r'http://api\.example\.com')
FilterRequestsOnUrl(r'http://api\\.example\\.com')
To filter out http calls to all first level subdomains from example.com::
FilterRequestOnUrl(r'http://.*+\.example\.com')
FilterRequestOnUrl(r'http://.*+\\.example\\.com')
To filter out calls to both http://test.example.com and http://example.com/healthcheck::
FilterRequestOnUrl([r'http://test\.example\.com', r'http://example\.com/healthcheck'])
FilterRequestOnUrl([r'http://test\\.example\\.com', r'http://example\\.com/healthcheck'])
"""
def __init__(self, regexps):
if isinstance(regexps, str):
Expand Down
4 changes: 2 additions & 2 deletions ddtrace/monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def on_import(hook):
def patch_all(**patch_modules):
"""Automatically patches all available modules.
:param dict \**patch_modules: Override whether particular modules are patched or not.
:param dict patch_modules: Override whether particular modules are patched or not.
>>> patch_all(redis=False, cassandra=False)
"""
Expand All @@ -110,7 +110,7 @@ def patch(raise_errors=True, **patch_modules):
"""Patch only a set of given modules.
:param bool raise_errors: Raise error if one patch fail.
:param dict \**patch_modules: List of modules to patch.
:param dict patch_modules: List of modules to patch.
>>> patch(psycopg=True, elasticsearch=True)
"""
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def service(self):
return self._config['service_name']

def __setattr__(self, name, value):
if getattr(self, '_initialized', False) and name is not '_target':
if getattr(self, '_initialized', False) and name != '_target':
raise AttributeError("can't mutate a pin, use override() or clone() instead")
super(Pin, self).__setattr__(name, value)

Expand Down
1 change: 1 addition & 0 deletions tests/contrib/dbapi/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ddtrace import Pin
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.dbapi import FetchTracedCursor, TracedCursor, TracedConnection
from ddtrace.span import Span
from ...base import BaseTracerTestCase


Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/falcon/test_distributed_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ def test_distributred_tracing_disabled(self):
eq_(len(traces), 1)
eq_(len(traces[0]), 1)

ok_(traces[0][0].parent_id is not 42)
ok_(traces[0][0].trace_id is not 100)
ok_(traces[0][0].parent_id != 42)
ok_(traces[0][0].trace_id != 100)
1 change: 1 addition & 0 deletions tests/contrib/httplib/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def test_httplib_request_and_response_headers(self):

# Enabled when configured
with self.override_config('hhtplib', {}):
from ddtrace.settings import IntegrationConfig
integration_config = config.httplib # type: IntegrationConfig
integration_config.http.trace_headers(['my-header', 'access-control-allow-origin'])
conn = self.get_http_connection(SOCKET)
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/tornado/test_stack_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ def test_propagation_without_stack_context(self):
traces = self.tracer.writer.pop_traces()
eq_(len(traces), 1)
eq_(len(traces[0]), 1)
ok_(traces[0][0].trace_id is not 100)
ok_(traces[0][0].parent_id is not 101)
ok_(traces[0][0].trace_id != 100)
ok_(traces[0][0].parent_id != 101)
2 changes: 1 addition & 1 deletion tests/opentracer/test_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def test_start_active_span_child_finish_after_parent(self, ot_tracer, writer):
span2.finish()

spans = writer.pop()
assert len(spans) is 2
assert len(spans) == 2
assert spans[0].parent_id is None
assert spans[1].parent_id is span1._dd_span.span_id
assert spans[1].duration > spans[0].duration
Expand Down
4 changes: 2 additions & 2 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def test_is_not_match(self):
def test_list_match(self):
span = Span(name='Name', tracer=None)
span.set_tag(URL, r'http://anotherdomain.example.com')
filtr = FilterRequestsOnUrl(['http://domain\.example\.com', 'http://anotherdomain\.example\.com'])
filtr = FilterRequestsOnUrl([r'http://domain\.example\.com', r'http://anotherdomain\.example\.com'])
trace = filtr.process_trace([span])
self.assertIsNone(trace)

def test_list_no_match(self):
span = Span(name='Name', tracer=None)
span.set_tag(URL, r'http://cooldomain.example.com')
filtr = FilterRequestsOnUrl(['http://domain\.example\.com', 'http://anotherdomain\.example\.com'])
filtr = FilterRequestsOnUrl([r'http://domain\.example\.com', r'http://anotherdomain\.example\.com'])
trace = filtr.process_trace([span])
self.assertIsNotNone(trace)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ deps=
ignore_outcome=true

[testenv:flake8]
deps=flake8==3.5.0
deps=flake8>=3.7,<=3.8
commands=flake8 .
basepython=python2

Expand Down

0 comments on commit d73b1e7

Please sign in to comment.