diff --git a/prometheus_client/decorator.py b/prometheus_client/decorator.py index 50876c6f..78623853 100644 --- a/prometheus_client/decorator.py +++ b/prometheus_client/decorator.py @@ -42,7 +42,7 @@ __version__ = '4.0.10' -if sys.version >= '3': +if sys.version_info >= (3,): from inspect import getfullargspec def get_init(cls): @@ -109,7 +109,7 @@ def __init__(self, func=None, name=None, signature=None, setattr(self, a, getattr(argspec, a)) for i, arg in enumerate(self.args): setattr(self, 'arg%d' % i, arg) - if sys.version < '3': # easy way + if sys.version_info < (3,): # easy way self.shortsignature = self.signature = ( inspect.formatargspec( formatvalue=lambda val: "", *argspec)[1:-1]) diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py index b79b0d07..a271df1a 100644 --- a/prometheus_client/exposition.py +++ b/prometheus_client/exposition.py @@ -28,7 +28,7 @@ CONTENT_TYPE_LATEST = str('text/plain; version=0.0.4; charset=utf-8') '''Content type of the latest text format''' -PYTHON26_OR_OLDER = tuple(int(val) for val in sys.version.split()[0].split('.')) < (2, 7, 0) +PYTHON26_OR_OLDER = sys.version_info < (2, 7) def make_wsgi_app(registry=core.REGISTRY): '''Create a WSGI app which serves the metrics from a registry.'''