From b0589e81f5305000eadc025ea81fa7a99837332f Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 3 May 2016 22:57:20 +0200 Subject: [PATCH] Fix flake8 issues --- CHANGELOG | 4 ++-- kaneda/__init__.py | 4 ++-- kaneda/backends/__init__.py | 8 ++++---- kaneda/backends/base.py | 1 - kaneda/backends/logger.py | 1 - kaneda/base.py | 5 ++--- kaneda/exceptions.py | 2 +- kaneda/queues/__init__.py | 6 +++--- kaneda/queues/celery.py | 1 - tests/integration/django/test_django.py | 2 +- tests/integration/test_metrics.py | 2 -- tests/unit/test_backends.py | 1 - 12 files changed, 15 insertions(+), 22 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3567c82..58a79df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. @@ -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) diff --git a/kaneda/__init__.py b/kaneda/__init__.py index b1106e0..ef09031 100644 --- a/kaneda/__init__.py +++ b/kaneda/__init__.py @@ -3,9 +3,9 @@ __email__ = 'mtuduri@apsl.net' __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 diff --git a/kaneda/backends/__init__.py b/kaneda/backends/__init__.py index ed7eb08..22846dc 100644 --- a/kaneda/backends/__init__.py +++ b/kaneda/backends/__init__.py @@ -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 diff --git a/kaneda/backends/base.py b/kaneda/backends/base.py index 0d1a0b0..1f5a24b 100644 --- a/kaneda/backends/base.py +++ b/kaneda/backends/base.py @@ -22,4 +22,3 @@ def _get_payload(self, name, value, tags): if tags: payload['tags'] = tags return payload - diff --git a/kaneda/backends/logger.py b/kaneda/backends/logger.py index 482dabe..84352b9 100644 --- a/kaneda/backends/logger.py +++ b/kaneda/backends/logger.py @@ -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) - diff --git a/kaneda/base.py b/kaneda/base.py index 09aa3cc..34e75f2 100644 --- a/kaneda/base.py +++ b/kaneda/base.py @@ -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): @@ -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_) @@ -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_) - diff --git a/kaneda/exceptions.py b/kaneda/exceptions.py index f480ca0..e8ba91e 100644 --- a/kaneda/exceptions.py +++ b/kaneda/exceptions.py @@ -16,4 +16,4 @@ class UnexistingKanedaClass(ImportError): class SettingsError(Exception): """ Kaneda is configured without a settings file or needs a required settings variable. - """ \ No newline at end of file + """ diff --git a/kaneda/queues/__init__.py b/kaneda/queues/__init__.py index c469fe9..9ea9657 100644 --- a/kaneda/queues/__init__.py +++ b/kaneda/queues/__init__.py @@ -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 diff --git a/kaneda/queues/celery.py b/kaneda/queues/celery.py index e34eefe..e666d35 100644 --- a/kaneda/queues/celery.py +++ b/kaneda/queues/celery.py @@ -40,4 +40,3 @@ def report(self, name, metric, value, tags, id_): except Exception as e: logger = logging.getLogger(__name__) logger.exception(e) - diff --git a/tests/integration/django/test_django.py b/tests/integration/django/test_django.py index 1cb6e3d..1c5c547 100644 --- a/tests/integration/django/test_django.py +++ b/tests/integration/django/test_django.py @@ -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): diff --git a/tests/integration/test_metrics.py b/tests/integration/test_metrics.py index 07ffa8d..e8084c0 100644 --- a/tests/integration/test_metrics.py +++ b/tests/integration/test_metrics.py @@ -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 - - diff --git a/tests/unit/test_backends.py b/tests/unit/test_backends.py index 364c025..255d103 100644 --- a/tests/unit/test_backends.py +++ b/tests/unit/test_backends.py @@ -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 -