From e873008d78e8ba4d271c41722f78864252d28570 Mon Sep 17 00:00:00 2001 From: Martin Packman Date: Fri, 16 Feb 2018 00:05:31 +0000 Subject: [PATCH] Fix lint around operator spacing Resolves E222, E225, E226, E231, and E251. --- prometheus_client/core.py | 4 ++-- prometheus_client/exposition.py | 7 ++++--- setup.py | 26 ++++++++++++++++---------- tests/test_core.py | 2 +- tests/test_graphite_bridge.py | 2 +- tox.ini | 5 ----- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/prometheus_client/core.py b/prometheus_client/core.py index f4af1b7a..803fb835 100644 --- a/prometheus_client/core.py +++ b/prometheus_client/core.py @@ -28,7 +28,7 @@ _RESERVED_METRIC_LABEL_NAME_RE = re.compile(r'^__.*$') _INF = float("inf") _MINUS_INF = float("-inf") -_INITIAL_MMAP_SIZE = 1024*1024 +_INITIAL_MMAP_SIZE = 1 << 20 class CollectorRegistry(object): @@ -440,7 +440,7 @@ def __init__(self, typ, metric_name, name, labelnames, labelvalues, multiprocess def __reset(self): typ, metric_name, name, labelnames, labelvalues, multiprocess_mode = self._params if typ == 'gauge': - file_prefix = typ + '_' + multiprocess_mode + file_prefix = typ + '_' + multiprocess_mode else: file_prefix = typ if file_prefix not in files: diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py index aff3bffb..0c4e96d6 100644 --- a/prometheus_client/exposition.py +++ b/prometheus_client/exposition.py @@ -290,9 +290,10 @@ def _use_gateway(method, gateway, job, registry, grouping_key, timeout, handler) '/{0}/{1}'.format(quote_plus(str(k)), quote_plus(str(v))) for k, v in sorted(grouping_key.items())) - headers=[('Content-Type', CONTENT_TYPE_LATEST)] - handler(url=url, method=method, timeout=timeout, - headers=headers, data=data)() + handler( + url=url, method=method, timeout=timeout, + headers=[('Content-Type', CONTENT_TYPE_LATEST)], data=data, + )() def instance_ip_grouping_key(): diff --git a/setup.py b/setup.py index aefa8854..a2737296 100644 --- a/setup.py +++ b/setup.py @@ -2,16 +2,22 @@ from setuptools import setup setup( - name = "prometheus_client", - version = "0.1.0", - author = "Brian Brazil", - author_email = "brian.brazil@robustperception.io", - description = ("Python client for the Prometheus monitoring system."), - long_description = ("See https://github.com/prometheus/client_python/blob/master/README.md for documentation."), - license = "Apache Software License 2.0", - keywords = "prometheus monitoring instrumentation client", - url = "https://github.com/prometheus/client_python", - packages=['prometheus_client', 'prometheus_client.bridge', 'prometheus_client.twisted'], + name="prometheus_client", + version="0.1.0", + author="Brian Brazil", + author_email="brian.brazil@robustperception.io", + description="Python client for the Prometheus monitoring system.", + long_description=( + "See https://github.com/prometheus/client_python/blob/master/README.md" + " for documentation."), + license="Apache Software License 2.0", + keywords="prometheus monitoring instrumentation client", + url="https://github.com/prometheus/client_python", + packages=[ + 'prometheus_client', + 'prometheus_client.bridge', + 'prometheus_client.twisted', + ], extras_require={ 'twisted': ['twisted'], }, diff --git a/tests/test_core.py b/tests/test_core.py index 7417ce07..024cdba4 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -349,7 +349,7 @@ def test_gauge_labels(self): cmf = GaugeMetricFamily('g', 'help', labels=['a']) cmf.add_metric(['b'], 2) self.custom_collector(cmf) - self.assertEqual(2, self.registry.get_sample_value('g', {'a':'b'})) + self.assertEqual(2, self.registry.get_sample_value('g', {'a': 'b'})) def test_summary(self): self.custom_collector(SummaryMetricFamily('s', 'help', count_value=1, sum_value=2)) diff --git a/tests/test_graphite_bridge.py b/tests/test_graphite_bridge.py index ecbd7b8c..2992b0f5 100644 --- a/tests/test_graphite_bridge.py +++ b/tests/test_graphite_bridge.py @@ -53,7 +53,7 @@ def test_prefix(self): labels = Counter('labels', 'help', ['a', 'b'], registry=self.registry) labels.labels('c', 'd').inc() - self.gb.push(prefix = 'pre.fix') + self.gb.push(prefix='pre.fix') self.t.join() self.assertEqual(b'pre.fix.labels.a.c.b.d 1.0 1434898897\n', self.data) diff --git a/tox.ini b/tox.ini index 6ee6dd18..f2ce53e9 100644 --- a/tox.ini +++ b/tox.ini @@ -61,11 +61,6 @@ ignore = D, I, E123, - E231, - E222, - E225, - E226, - E251, E302, E303, E305,