8000 Fix lint related to operator positioning (#273) · ashokrj/client_python@ec1a9f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit ec1a9f6

Browse files
bz2brian-brazil
authored andcommitted
Fix lint related to operator positioning (prometheus#273)
Resolves W503. Also drive-by move definition of gauge multiprocess modes. Signed-off-by: Martin Packman <martin@zegami.com>
1 parent 2783ff8 commit ec1a9f6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

prometheus_client/core.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ def add_sample(self, name, labels, value):
175175
self.samples.append((name, labels, value))
176176

177177
def __eq__(self, other):
178-
return (isinstance(other, Metric)
179-
and self.name == other.name
180-
and self.documentation == other.documentation
181-
and self.type == other.type
182-
and self.samples == other.samples)
178+
return (isinstance(other, Metric) and
179+
self.name == other.name and
180+
self.documentation == other.documentation and
181+
self.type == other.type and
182+
self.samples == other.samples)
183183

184184

185185
class UntypedMetricFamily(Metric):
@@ -722,10 +722,11 @@ def f():
722722
'''
723723
_type = 'gauge'
724724
_reserved_labelnames = []
725+
_MULTIPROC_MODES = frozenset(('min', 'max', 'livesum', 'liveall', 'all'))
725726

726727
def __init__(self, name, labelnames, labelvalues, multiprocess_mode='all'):
727-
if (_ValueClass._multiprocess
728-
and multiprocess_mode not in ['min', 'max', 'livesum', 'liveall', 'all']):
728+
if (_ValueClass._multiprocess and
729+
multiprocess_mode not in self._MULTIPROC_MODES):
729730
raise ValueError('Invalid multiprocess mode: ' + multiprocess_mode)
730731
self._value = _ValueClass(
731732
self._type, name, name, labelnames, labelvalues,

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ ignore =
6666
E741,
6767
F841,
6868
W293,
69-
W503
7069
import-order-style = google
7170
application-import-names = prometheus_client

0 commit comments

Comments
 (0)
0