@@ -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
185185class 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 ,
0 commit comments