Skip to content

Commit

Permalink
Fix flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marctc committed May 3, 2016
1 parent 4dd027a commit b0589e8
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
0.4 (2016-04-28)
~~~~~~~~~~~~~~~~
Add support to run Kaneda in asynchronous mode.
---------------------------------------------
-----------------------------------------------
* Add Celery and RQ queue classes and tasks with backend reporting.
* Add the option to configure Kaneda with a settings file.
* Add utils.py file to handle the settings.
Expand All @@ -18,7 +18,7 @@ Add Django support.
* Improve Django documentation

0.3.1 (2016-03-29)
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
* ElasticBackend now can be configured passing a list of 'hosts' or a list of 'connection_urls'.

0.3 (2016-03-28)
Expand Down
4 changes: 2 additions & 2 deletions kaneda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
__email__ = '[email protected]'
__version__ = '0.4'

import logging
import logging # NOQA

from .base import Metrics
from .base import Metrics # NOQA

try: # Python 2.7+
from logging import NullHandler
Expand Down
8 changes: 4 additions & 4 deletions kaneda/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .base import BaseBackend
from .elasticsearch import ElasticsearchBackend
from .mongodb import MongoBackend
from .logger import LoggerBackend
from .base import BaseBackend # NOQA
from .elasticsearch import ElasticsearchBackend # NOQA
from .mongodb import MongoBackend # NOQA
from .logger import LoggerBackend # NOQA
1 change: 0 additions & 1 deletion kaneda/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ def _get_payload(self, name, value, tags):
if tags:
payload['tags'] = tags
return payload

1 change: 0 additions & 1 deletion kaneda/backends/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ def _get_payload(self, name, value, metric, tags, id_):
def report(self, name, metric, value, tags, id_):
payload = self._get_payload(name, value, metric, tags, id_)
return self.logger.info(payload)

5 changes: 2 additions & 3 deletions kaneda/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from time import time
from functools import wraps

from kaneda.utils import get_backend, get_kaneda_objects
from kaneda.utils import get_kaneda_objects


class Metrics(object):
Expand Down Expand Up @@ -65,7 +65,7 @@ def custom(self, name, metric, value, tags=None, id_=None):
"""
Send a custom metric report.
>>> metrics.custom('hotel.availability.response_data', metric='xml', value={'status': 'ok', 'xml': ...}, id_='2B75D750')
>>> metrics.custom('hotel.response_data', metric='xml', value={'status': 'ok', 'xml': ...}, id_='2B75D750')
"""
self._report(name, metric, value, tags, id_)

Expand Down Expand Up @@ -124,4 +124,3 @@ def _report(self, name, metric, value, tags, id_=None):
return self.backend.report(name, metric, value, tags, id_)
elif self.queue:
return self.queue.report(name, metric, value, tags, id_)

2 changes: 1 addition & 1 deletion kaneda/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ class UnexistingKanedaClass(ImportError):
class SettingsError(Exception):
"""
Kaneda is configured without a settings file or needs a required settings variable.
"""
"""
6 changes: 3 additions & 3 deletions kaneda/queues/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .base import BaseQueue
from .celery import CeleryQueue
from .rq import RQQueue
from .base import BaseQueue # NOQA
from .celery import CeleryQueue # NOQA
from .rq import RQQueue # NOQA
1 change: 0 additions & 1 deletion kaneda/queues/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ def report(self, name, metric, value, tags, id_):
except Exception as e:
logger = logging.getLogger(__name__)
logger.exception(e)

2 changes: 1 addition & 1 deletion tests/integration/django/test_django.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from kaneda.backends import LoggerBackend, ElasticsearchBackend
from kaneda.queues import CeleryQueue
from django_kaneda import settings
from django_kaneda import settings # NOQA


class TestDjango(object):
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ def test_logger_metric(self, logger_backend, logger_filename):
result = lines[-1].split(' - ')[2]
assert result
assert 'test_gauge' in result


1 change: 0 additions & 1 deletion tests/unit/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ def test_base_backend_structured_payload(self, mocker, dummy_backend, structured
value={'val0': 1, 'val2': 'str', 'val3': [1, 2]}, tags=['tag1', 'tags2'])
reported_data = dummy_backend.reported_data['test.structured']
assert reported_data == structured_payload

0 comments on commit b0589e8

Please sign in to comment.