Hello community,

here is the log from the commit of package python-prometheus_client for 
openSUSE:Factory checked in at 2020-11-21 12:43:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-prometheus_client (Old)
 and      /work/SRC/openSUSE:Factory/.python-prometheus_client.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-prometheus_client"

Sat Nov 21 12:43:09 2020 rev:11 rq:849681 version:0.9.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-prometheus_client/python-prometheus_client.changes
        2020-05-29 21:36:13.542444237 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-prometheus_client.new.5913/python-prometheus_client.changes
      2020-11-23 10:45:25.374298532 +0100
@@ -1,0 +2,7 @@
+Fri Nov 20 12:56:42 UTC 2020 - Stefano Torresi <stefano.torr...@suse.com>
+
+- Update to upstream 0.9.0 release
+  * [ENHANCEMENT] Add support for python3.9 (#600)
+  * [ENHANCEMENT] Various updates for latest OpenMetrics draft spec (#576 #577)
+
+-------------------------------------------------------------------

Old:
----
  v0.8.0.tar.gz

New:
----
  v0.9.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-prometheus_client.spec ++++++
--- /var/tmp/diff_new_pack.R7GQzd/_old  2020-11-23 10:45:25.886299042 +0100
+++ /var/tmp/diff_new_pack.R7GQzd/_new  2020-11-23 10:45:25.886299042 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-prometheus_client
-Version:        0.8.0
+Version:        0.9.0
 Release:        0
 Summary:        Python client for the Prometheus monitoring system
 License:        Apache-2.0

++++++ v0.8.0.tar.gz -> v0.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/.travis.yml 
new/client_python-0.9.0/.travis.yml
--- old/client_python-0.8.0/.travis.yml 2020-05-25 13:59:25.000000000 +0200
+++ new/client_python-0.9.0/.travis.yml 2020-11-16 14:26:28.000000000 +0100
@@ -1,38 +1,57 @@
+os: linux
 dist: xenial
-sudo: false
 cache:
   directories:
     - $HOME/.cache/pip
 
 language: python
 
-matrix:
+jobs:
   include:
-    - python: "2.6"
+    - stage: lint
+      name: flake8_lint
+      script: 
+        - tox -e flake8 
+    - stage: lint
+      name: isort_lint
+      script: 
+        - tox -e isort
+    - stage: test
+      python: "2.6"
       env: TOXENV=py26
       dist: trusty
-    - python: "2.7"
+    - stage: test
+      python: "2.7"
       env: TOXENV=py27
-    - python: "2.7"
+    - stage: test
+      python: "2.7"
       env: TOXENV=py27-nooptionals
-    - python: "3.4"
+    - stage: test
+      python: "3.4"
       env: TOXENV=py34
-    - python: "3.5"
+    - stage: test
+      python: "3.5"
       env: TOXENV=py35
-    - python: "3.6"
+    - stage: test
+      python: "3.6"
       env: TOXENV=py36
-    - python: "3.7"
+    - stage: test
+      python: "3.7"
       env: TOXENV=py37
-      sudo: true
-    - python: "3.8"
+    - stage: test
+      python: "3.8"
       env: TOXENV=py38
-      sudo: true
-    - python: "3.8"
-      env: TOXENV=py38-nooptionals
-      sudo: true
-    - python: "pypy"
+    - stage: test
+      python: "3.9"
+      env: TOXENV=py39
+    - stage: test
+      python: "3.9"
+      env: TOXENV=py39-nooptionals
+    - stage: test
+      python: "pypy"
       env: TOXENV=pypy
-    - python: "pypy3"
+    - stage: test
+      python: "pypy3"
       env: TOXENV=pypy3
 
 install:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/CODE_OF_CONDUCT.md 
new/client_python-0.9.0/CODE_OF_CONDUCT.md
--- old/client_python-0.8.0/CODE_OF_CONDUCT.md  1970-01-01 01:00:00.000000000 
+0100
+++ new/client_python-0.9.0/CODE_OF_CONDUCT.md  2020-11-16 14:26:28.000000000 
+0100
@@ -0,0 +1,3 @@
+## Prometheus Community Code of Conduct
+
+Prometheus follows the [CNCF Code of 
Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/README.md 
new/client_python-0.9.0/README.md
--- old/client_python-0.8.0/README.md   2020-05-25 13:59:25.000000000 +0200
+++ new/client_python-0.9.0/README.md   2020-11-16 14:26:28.000000000 +0100
@@ -220,6 +220,17 @@
 c.labels(method='post', endpoint='/submit').inc()
 ```
 
+Metrics with labels are not initialized when declared, because the client can't
+know what values the label can have. It is recommended to initialize the label
+values by calling the `.labels()` method alone:
+
+```python
+from prometheus_client import Counter
+c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint'])
+c.labels('get', '/')
+c.labels('post', '/submit')
+```
+
 ### Process Collector
 
 The Python client automatically exports metrics about process CPU usage, RAM,
@@ -334,7 +345,7 @@
 app = Flask(__name__)
 
 # Add prometheus wsgi middleware to route /metrics requests
-app_dispatch = DispatcherMiddleware(app, {
+app.wsgi_app = DispatcherMiddleware(app.wsgi_app, {
     '/metrics': make_wsgi_app()
 })
 ```
@@ -344,7 +355,7 @@
 ```bash
 # Install uwsgi if you do not have it
 pip install uwsgi
-uwsgi --http 127.0.0.1:8000 --wsgi-file myapp.py --callable app_dispatch
+uwsgi --http 127.0.0.1:8000 --wsgi-file myapp.py --callable app
 ```
 
 Visit http://localhost:8000/metrics to see the metrics
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/prometheus_client/__init__.py 
new/client_python-0.9.0/prometheus_client/__init__.py
--- old/client_python-0.8.0/prometheus_client/__init__.py       2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/__init__.py       2020-11-16 
14:26:28.000000000 +0100
@@ -1,12 +1,9 @@
 #!/usr/bin/python
 
-from . import exposition
-from . import gc_collector
-from . import metrics
-from . import metrics_core
-from . import platform_collector
-from . import process_collector
-from . import registry
+from . import (
+    exposition, gc_collector, metrics, metrics_core, platform_collector,
+    process_collector, registry,
+)
 
 __all__ = ['Counter', 'Gauge', 'Summary', 'Histogram', 'Info', 'Enum']
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/prometheus_client/core.py 
new/client_python-0.9.0/prometheus_client/core.py
--- old/client_python-0.8.0/prometheus_client/core.py   2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/core.py   2020-11-16 
14:26:28.000000000 +0100
@@ -2,8 +2,10 @@
 
 from .metrics import Counter, Enum, Gauge, Histogram, Info, Summary
 from .metrics_core import (
-    CounterMetricFamily, GaugeHistogramMetricFamily, GaugeMetricFamily, 
HistogramMetricFamily, InfoMetricFamily,
-    Metric, StateSetMetricFamily, SummaryMetricFamily, UnknownMetricFamily, 
UntypedMetricFamily)
+    CounterMetricFamily, GaugeHistogramMetricFamily, GaugeMetricFamily,
+    HistogramMetricFamily, InfoMetricFamily, Metric, StateSetMetricFamily,
+    SummaryMetricFamily, UnknownMetricFamily, UntypedMetricFamily,
+)
 from .registry import CollectorRegistry, REGISTRY
 from .samples import Exemplar, Sample, Timestamp
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/prometheus_client/exposition.py 
new/client_python-0.9.0/prometheus_client/exposition.py
--- old/client_python-0.8.0/prometheus_client/exposition.py     2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/exposition.py     2020-11-16 
14:26:28.000000000 +0100
@@ -6,24 +6,25 @@
 import socket
 import sys
 import threading
-from wsgiref.simple_server import make_server, WSGIServer, WSGIRequestHandler
+from wsgiref.simple_server import make_server, WSGIRequestHandler, WSGIServer
 
 from .openmetrics import exposition as openmetrics
 from .registry import REGISTRY
 from .utils import floatToGoString
 
 try:
-    from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
-    from SocketServer import ThreadingMixIn
-    from urllib2 import build_opener, Request, HTTPHandler
     from urllib import quote_plus
+
+    from BaseHTTPServer import BaseHTTPRequestHandler
+    from SocketServer import ThreadingMixIn
+    from urllib2 import build_opener, HTTPHandler, Request
     from urlparse import parse_qs, urlparse
 except ImportError:
     # Python 3
-    from http.server import BaseHTTPRequestHandler, HTTPServer
+    from http.server import BaseHTTPRequestHandler
     from socketserver import ThreadingMixIn
-    from urllib.request import build_opener, Request, HTTPHandler
-    from urllib.parse import quote_plus, parse_qs, urlparse
+    from urllib.parse import parse_qs, quote_plus, urlparse
+    from urllib.request import build_opener, HTTPHandler, Request
 
 CONTENT_TYPE_LATEST = str('text/plain; version=0.0.4; charset=utf-8')
 """Content type of the latest text format"""
@@ -362,7 +363,7 @@
 
 
 def _escape_grouping_key(k, v):
-    if v == "" :
+    if v == "":
         # Per https://github.com/prometheus/pushgateway/pull/346.
         return k + "@base64", "="
     elif '/' in v:
@@ -381,6 +382,6 @@
 
 try:
     # Python >3.5 only
-    from .asgi import make_asgi_app
+    from .asgi import make_asgi_app  # noqa
 except:
     pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/client_python-0.8.0/prometheus_client/metrics_core.py 
new/client_python-0.9.0/prometheus_client/metrics_core.py
--- old/client_python-0.8.0/prometheus_client/metrics_core.py   2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/metrics_core.py   2020-11-16 
14:26:28.000000000 +0100
@@ -42,12 +42,12 @@
         self.samples.append(Sample(name, labels, value, timestamp, exemplar))
 
     def __eq__(self, other):
-        return (isinstance(other, Metric) and
-                self.name == other.name and
-                self.documentation == other.documentation and
-                self.type == other.type and
-                self.unit == other.unit and
-                self.samples == other.samples)
+        return (isinstance(other, Metric)
+                and self.name == other.name 
+                and self.documentation == other.documentation
+                and self.type == other.type
+                and self.unit == other.unit
+                and self.samples == other.samples)
 
     def __repr__(self):
         return "Metric(%s, %s, %s, %s, %s)" % (
@@ -216,13 +216,13 @@
                 timestamp,
                 exemplar,
             ))
-        # +Inf is last and provides the count value.
-        self.samples.append(
-                Sample(self.name + '_count', dict(zip(self._labelnames, 
labels)), buckets[-1][1], timestamp))
-        # Don't iunclude sum if there's negative buckets.
+        # Don't include sum and thus count if there's negative buckets.
         if float(buckets[0][0]) >= 0 and sum_value is not None:
+            # +Inf is last and provides the count value.
+            self.samples.append(
+                Sample(self.name + '_count', dict(zip(self._labelnames, 
labels)), buckets[-1][1], timestamp))
             self.samples.append(
-                    Sample(self.name + '_sum', dict(zip(self._labelnames, 
labels)), sum_value, timestamp))
+                Sample(self.name + '_sum', dict(zip(self._labelnames, 
labels)), sum_value, timestamp))
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/prometheus_client/mmap_dict.py 
new/client_python-0.9.0/prometheus_client/mmap_dict.py
--- old/client_python-0.8.0/prometheus_client/mmap_dict.py      2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/mmap_dict.py      2020-11-16 
14:26:28.000000000 +0100
@@ -37,7 +37,7 @@
         if encoded_len + pos > used:
             raise RuntimeError('Read beyond file size detected, file is 
corrupted.')
         pos += 4
-        encoded_key = data[pos : pos + encoded_len]
+        encoded_key = data[pos:pos + encoded_len]
         padded_len = encoded_len + (8 - (encoded_len + 4) % 8)
         pos += padded_len
         value = _unpack_double(data, pos)[0]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/client_python-0.8.0/prometheus_client/openmetrics/parser.py 
new/client_python-0.9.0/prometheus_client/openmetrics/parser.py
--- old/client_python-0.8.0/prometheus_client/openmetrics/parser.py     
2020-05-25 13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/openmetrics/parser.py     
2020-11-16 14:26:28.000000000 +0100
@@ -15,6 +15,7 @@
     # Python 3
     import io as StringIO
 
+
 def text_string_to_metric_families(text):
     """Parse Openmetrics text format from a unicode string.
 
@@ -24,7 +25,7 @@
         yield metric_family
 
 
-_CANONICAL_NUMBERS = set([i / 1000.0 for i in range(10000)] + [10.0**i for i 
in range(-10, 11)] + [float("inf")])
+_CANONICAL_NUMBERS = set([float("inf")])
 
 
 def _isUncanonicalNumber(s):
@@ -113,8 +114,8 @@
 
 def _is_character_escaped(s, charpos):
     num_bslashes = 0
-    while (charpos > num_bslashes and
-           s[charpos - 1 - num_bslashes] == '\\'):
+    while (charpos > num_bslashes
+           and s[charpos - 1 - num_bslashes] == '\\'):
         num_bslashes += 1
     return num_bslashes % 2 == 1
 
@@ -359,7 +360,7 @@
     exemplar = None
     if exemplar_labels is not None:
         exemplar_length = sum([len(k) + len(v) for k, v in 
exemplar_labels.items()])
-        if exemplar_length > 64:
+        if exemplar_length > 128:
             raise ValueError("Exmplar labels are too long: " + text)
         exemplar = Exemplar(
             exemplar_labels,
@@ -398,6 +399,12 @@
             raise ValueError("+Inf bucket missing: " + name)
         if count is not None and value != count:
             raise ValueError("Count does not match +Inf value: " + name)
+        if has_sum and count is None:
+            raise ValueError("_count must be present if _sum is present: " + 
name)
+        if has_gsum and count is None:
+            raise ValueError("_gcount must be present if _gsum is present: " + 
name)
+        if not (has_sum or has_gsum) and count is not None:
+            raise ValueError("_sum/_gsum must be present if _count is present: 
" + name)
         if has_negative_buckets and has_sum:
             raise ValueError("Cannot have _sum with negative buckets: " + name)
         if not has_negative_buckets and has_negative_gsum:
@@ -413,6 +420,7 @@
             bucket = None
             has_negative_buckets = False
             has_sum = False
+            has_gsum = False
             has_negative_gsum = False
             value = 0
         group = g
@@ -432,8 +440,10 @@
             count = s.value
         elif suffix in ['_sum']:
             has_sum = True
-        elif suffix in ['_gsum'] and s.value < 0:
-            has_negative_gsum = True
+        elif suffix in ['_gsum']:
+            has_gsum = True
+            if s.value < 0:
+                has_negative_gsum = True
 
     if group is not None:
         do_checks()
@@ -452,14 +462,22 @@
     allowed_names = []
     eof = False
 
-    seen_metrics = set()
+    seen_names = set()
+    type_suffixes = {
+        'counter': ['_total', '_created'],
+        'summary': ['', '_count', '_sum', '_created'],
+        'histogram': ['_count', '_sum', '_bucket', '_created'],
+        'gaugehistogram': ['_gcount', '_gsum', '_bucket'],
+        'info': ['_info'],
+    }
 
     def build_metric(name, documentation, typ, unit, samples):
-        if name in seen_metrics:
-            raise ValueError("Duplicate metric: " + name)
-        seen_metrics.add(name)
         if typ is None:
             typ = 'unknown'
+        for suffix in set(type_suffixes.get(typ, []) + [""]):
+            if name + suffix in seen_names:
+                raise ValueError("Clashing name: " + name + suffix)
+            seen_names.add(name + suffix)
         if documentation is None:
             documentation = ''
         if unit is None:
@@ -482,6 +500,9 @@
         if eof:
             raise ValueError("Received line after # EOF: " + line)
 
+        if not line:
+            raise ValueError("Received blank line")
+
         if line == '# EOF':
             eof = True
         elif line.startswith('#'):
@@ -518,14 +539,7 @@
                 typ = parts[3]
                 if typ == 'untyped':
                     raise ValueError("Invalid TYPE for metric: " + line)
-                allowed_names = {
-                    'counter': ['_total', '_created'],
-                    'summary': ['_count', '_sum', '', '_created'],
-                    'histogram': ['_count', '_sum', '_bucket', '_created'],
-                    'gaugehistogram': ['_gcount', '_gsum', '_bucket'],
-                    'info': ['_info'],
-                }.get(typ, [''])
-                allowed_names = [name + n for n in allowed_names]
+                allowed_names = [name + n for n in type_suffixes.get(typ, 
[''])]
             elif parts[1] == 'UNIT':
                 if unit is not None:
                     raise ValueError("More than one UNIT for metric: " + line)
@@ -557,7 +571,7 @@
                 raise ValueError("Invalid le label: " + line)
             if (typ == 'summary' and name == sample.name
                     and (not (0 <= float(sample.labels.get('quantile', -1)) <= 
1)
-                          or _isUncanonicalNumber(sample.labels['quantile']))):
+                         or _isUncanonicalNumber(sample.labels['quantile']))):
                 raise ValueError("Invalid quantile label: " + line)
 
             g = tuple(sorted(_group_for_sample(sample, name, typ).items()))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/prometheus_client/parser.py 
new/client_python-0.9.0/prometheus_client/parser.py
--- old/client_python-0.8.0/prometheus_client/parser.py 2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/parser.py 2020-11-16 
14:26:28.000000000 +0100
@@ -46,8 +46,8 @@
 
 def _is_character_escaped(s, charpos):
     num_bslashes = 0
-    while (charpos > num_bslashes and
-           s[charpos - 1 - num_bslashes] == '\\'):
+    while (charpos > num_bslashes
+           and s[charpos - 1 - num_bslashes] == '\\'):
         num_bslashes += 1
     return num_bslashes % 2 == 1
 
@@ -112,7 +112,7 @@
     if not values:
         return float(s), None
     value = float(values[0])
-    timestamp = (float(values[-1])/1000) if len(values) > 1 else None
+    timestamp = (float(values[-1]) / 1000) if len(values) > 1 else None
     return value, timestamp
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/prometheus_client/registry.py 
new/client_python-0.9.0/prometheus_client/registry.py
--- old/client_python-0.8.0/prometheus_client/registry.py       2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/registry.py       2020-11-16 
14:26:28.000000000 +0100
@@ -41,7 +41,7 @@
             del self._collector_to_names[collector]
 
     def _get_names(self, collector):
-        """Get names of timeseries the collector produces."""
+        """Get names of timeseries the collector produces and clashes with."""
         desc_func = None
         # If there's a describe function, use it.
         try:
@@ -58,13 +58,14 @@
         result = []
         type_suffixes = {
             'counter': ['_total', '_created'],
-            'summary': ['', '_sum', '_count', '_created'],
+            'summary': ['_sum', '_count', '_created'],
             'histogram': ['_bucket', '_sum', '_count', '_created'],
             'gaugehistogram': ['_bucket', '_gsum', '_gcount'],
             'info': ['_info'],
         }
         for metric in desc_func():
-            for suffix in type_suffixes.get(metric.type, ['']):
+            result.append(metric.name)
+            for suffix in type_suffixes.get(metric.type, []):
                 result.append(metric.name + suffix)
         return result
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/client_python-0.8.0/prometheus_client/twisted/_exposition.py 
new/client_python-0.9.0/prometheus_client/twisted/_exposition.py
--- old/client_python-0.8.0/prometheus_client/twisted/_exposition.py    
2020-05-25 13:59:25.000000000 +0200
+++ new/client_python-0.9.0/prometheus_client/twisted/_exposition.py    
2020-11-16 14:26:28.000000000 +0100
@@ -1,7 +1,7 @@
 from __future__ import absolute_import, unicode_literals
 
-from twisted.web.wsgi import WSGIResource
 from twisted.internet import reactor
+from twisted.web.wsgi import WSGIResource
 
 from .. import exposition, REGISTRY
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/setup.py 
new/client_python-0.9.0/setup.py
--- old/client_python-0.8.0/setup.py    2020-05-25 13:59:25.000000000 +0200
+++ new/client_python-0.9.0/setup.py    2020-11-16 14:26:28.000000000 +0100
@@ -1,17 +1,18 @@
-from setuptools import setup
-import sys
 from os import path
+import sys
+
+from setuptools import setup
 
 if sys.version_info >= (2, 7):
     with open(path.join(path.abspath(path.dirname(__file__)), 'README.md')) as 
f:
         long_description = f.read()
-else: # Assuming we don't run setup in order to publish under python 2.6
+else:  # Assuming we don't run setup in order to publish under python 2.6
     long_description = "NA"
 
 
 setup(
     name="prometheus_client",
-    version="0.8.0",
+    version="0.9.0",
     author="Brian Brazil",
     author_email="brian.bra...@robustperception.io",
     description="Python client for the Prometheus monitoring system.",
@@ -45,6 +46,7 @@
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy",
         "Topic :: System :: Monitoring",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tests/openmetrics/test_parser.py 
new/client_python-0.9.0/tests/openmetrics/test_parser.py
--- old/client_python-0.8.0/tests/openmetrics/test_parser.py    2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/tests/openmetrics/test_parser.py    2020-11-16 
14:26:28.000000000 +0100
@@ -102,12 +102,14 @@
 a_count 1
 a_sum 2
 a{quantile="0.5"} 0.7
+a{quantile="1"} 0.8
 # EOF
 """)
         # The Python client doesn't support quantiles, but we
         # still need to be able to parse them.
         metric_family = SummaryMetricFamily("a", "help", count_value=1, 
sum_value=2)
         metric_family.add_sample("a", {"quantile": "0.5"}, 0.7)
+        metric_family.add_sample("a", {"quantile": "1"}, 0.8)
         self.assertEqual([metric_family], list(families))
 
     def test_simple_histogram(self):
@@ -125,9 +127,16 @@
     def test_histogram_noncanonical(self):
         families = text_string_to_metric_families("""# TYPE a histogram
 # HELP a help
+a_bucket{le="0"} 0
 a_bucket{le="0.00000000001"} 0
+a_bucket{le="0.0000000001"} 0
+a_bucket{le="1e-04"} 0
 a_bucket{le="1.1e-4"} 0
 a_bucket{le="1.1e-3"} 0
+a_bucket{le="1.1e-2"} 0
+a_bucket{le="1"} 0
+a_bucket{le="1e+05"} 0
+a_bucket{le="10000000000"} 0
 a_bucket{le="100000000000.0"} 0
 a_bucket{le="+Inf"} 3
 a_count 3
@@ -142,7 +151,6 @@
 a_bucket{le="-1.0"} 0
 a_bucket{le="1.0"} 1
 a_bucket{le="+Inf"} 3
-a_count 3
 # EOF
 """)
         self.assertEqual([HistogramMetricFamily("a", "help", buckets=[("-1.0", 
0.0), ("1.0", 1.0), ("+Inf", 3.0)])],
@@ -153,14 +161,14 @@
 # HELP a help
 a_bucket{le="1.0"} 0 # {a="b"} 0.5
 a_bucket{le="2.0"} 2 # {a="c"} 0.5
-a_bucket{le="+Inf"} 3 # 
{a="1234567890123456789012345678901234567890123456789012345678"} 4 123
+a_bucket{le="+Inf"} 3 # 
{a="2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"}
 4 123
 # EOF
 """)
         hfm = HistogramMetricFamily("a", "help")
         hfm.add_sample("a_bucket", {"le": "1.0"}, 0.0, None, Exemplar({"a": 
"b"}, 0.5))
         hfm.add_sample("a_bucket", {"le": "2.0"}, 2.0, None, Exemplar({"a": 
"c"}, 0.5)),
         hfm.add_sample("a_bucket", {"le": "+Inf"}, 3.0, None,
-                       Exemplar({"a": 
"1234567890123456789012345678901234567890123456789012345678"}, 4,
+                       Exemplar({"a": 
"2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"},
 4,
                                 Timestamp(123, 0)))
         self.assertEqual([hfm], list(families))
 
@@ -468,6 +476,7 @@
     @unittest.skipIf(sys.version_info < (3, 3), "Test requires Python 3.3+.")
     def test_fallback_to_state_machine_label_parsing(self):
         from unittest.mock import patch
+
         from prometheus_client.openmetrics.parser import _parse_sample
 
         parse_sample_function = 
"prometheus_client.openmetrics.parser._parse_sample"
@@ -598,6 +607,8 @@
         for case in [
             # No EOF.
             (''),
+            # Blank line
+            ('a 1\n\n# EOF\n'),
             # Text after EOF.
             ('a 1\n# EOF\nblah'),
             ('a 1\n# EOFblah'),
@@ -692,7 +703,7 @@
             ('# TYPE a histogram\na_bucket{le="+Inf"} 1 # {} 1 \n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="+Inf"} 1 # {} 1 1 \n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="+Inf"} 1 # '
-             
'{a="2345678901234567890123456789012345678901234567890123456789012345"} 1 1\n# 
EOF\n'),
+             
'{a="23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"}
 1 1\n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="+Inf"} 1 # {} 0x1p-3\n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="+Inf"} 1 # {} 1 0x1p-3\n# 
EOF\n'),
             # Exemplars on unallowed samples.
@@ -715,7 +726,6 @@
             ('# TYPE a summary\na{quantile="foo"} 0\n# EOF\n'),
             ('# TYPE a summary\na{quantile="1.01"} 0\n# EOF\n'),
             ('# TYPE a summary\na{quantile="NaN"} 0\n# EOF\n'),
-            ('# TYPE a summary\na{quantile="1"} 0\n# EOF\n'),
             ('# TYPE a histogram\na_bucket 0\n# EOF\n'),
             ('# TYPE a gaugehistogram\na_bucket 0\n# EOF\n'),
             ('# TYPE a stateset\na 0\n# EOF\n'),
@@ -742,16 +752,13 @@
             ('# TYPE a summary\na{quantile="0.5"} -1\n# EOF\n'),
             # Bad histograms.
             ('# TYPE a histogram\na_sum 1\n# EOF\n'),
+            ('# TYPE a histogram\na_bucket{le="+Inf"} 0\n#a_sum 0\n# EOF\n'),
+            ('# TYPE a histogram\na_bucket{le="+Inf"} 0\n#a_count 0\n# EOF\n'),
             ('# TYPE a gaugehistogram\na_gsum 1\n# EOF\n'),
+            ('# TYPE a gaugehistogram\na_bucket{le="+Inf"} 0\na_gsum 0\n# 
EOF\n'),
+            ('# TYPE a gaugehistogram\na_bucket{le="+Inf"} 0\na_gcount 0\n# 
EOF\n'),
             ('# TYPE a histogram\na_count 1\na_bucket{le="+Inf"} 0\n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="+Inf"} 0\na_count 1\n# EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="0"} 0\na_bucket{le="+Inf"} 0\n# 
EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="1"} 0\na_bucket{le="+Inf"} 0\n# 
EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="0.0000000001"} 
0\na_bucket{le="+Inf"} 0\n# EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="1.1e-2"} 0\na_bucket{le="+Inf"} 
0\n# EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="1e-04"} 0\na_bucket{le="+Inf"} 
0\n# EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="1e+05"} 0\na_bucket{le="+Inf"} 
0\n# EOF\n'),
-            ('# TYPE a histogram\na_bucket{le="10000000000"} 
0\na_bucket{le="+Inf"} 0\n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="+INF"} 0\n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="2"} 0\na_bucket{le="1"} 
0\na_bucket{le="+Inf"} 0\n# EOF\n'),
             ('# TYPE a histogram\na_bucket{le="1"} 1\na_bucket{le="2"} 
1\na_bucket{le="+Inf"} 0\n# EOF\n'),
@@ -768,6 +775,10 @@
             ('# TYPE a gauge\na 0 1\na 0 0\n# EOF\n'),
             ('# TYPE a gauge\na 0\na 0 0\n# EOF\n'),
             ('# TYPE a gauge\na 0 0\na 0\n# EOF\n'),
+            # Clashing names.
+            ('# TYPE a counter\n# TYPE a counter\n# EOF\n'),
+            ('# TYPE a info\n# TYPE a counter\n# EOF\n'),
+            ('# TYPE a_created gauge\n# TYPE a counter\n# EOF\n'),
         ]:
             with self.assertRaises(ValueError, msg=case):
                 list(text_string_to_metric_families(case))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tests/test_asgi.py 
new/client_python-0.9.0/tests/test_asgi.py
--- old/client_python-0.8.0/tests/test_asgi.py  2020-05-25 13:59:25.000000000 
+0200
+++ new/client_python-0.9.0/tests/test_asgi.py  2020-11-16 14:26:28.000000000 
+0100
@@ -3,7 +3,7 @@
 import sys
 from unittest import TestCase
 
-from prometheus_client import CollectorRegistry, Counter, generate_latest
+from prometheus_client import CollectorRegistry, Counter
 from prometheus_client.exposition import CONTENT_TYPE_LATEST
 
 if sys.version_info < (2, 7):
@@ -13,9 +13,11 @@
 
 try:
     # Python >3.5 only
-    from prometheus_client import make_asgi_app
     import asyncio
+
     from asgiref.testing import ApplicationCommunicator
+
+    from prometheus_client import make_asgi_app
     HAVE_ASYNCIO_AND_ASGI = True
 except ImportError:
     HAVE_ASYNCIO_AND_ASGI = False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tests/test_core.py 
new/client_python-0.9.0/tests/test_core.py
--- old/client_python-0.8.0/tests/test_core.py  2020-05-25 13:59:25.000000000 
+0200
+++ new/client_python-0.9.0/tests/test_core.py  2020-11-16 14:26:28.000000000 
+0100
@@ -1,7 +1,6 @@
 from __future__ import unicode_literals
 
 from concurrent.futures import ThreadPoolExecutor
-import inspect
 import time
 
 import pytest
@@ -12,6 +11,7 @@
     HistogramMetricFamily, Info, InfoMetricFamily, Metric, Sample,
     StateSetMetricFamily, Summary, SummaryMetricFamily, UntypedMetricFamily,
 )
+from prometheus_client.decorator import getargspec
 
 try:
     import unittest2 as unittest
@@ -46,7 +46,7 @@
             else:
                 raise TypeError
 
-        self.assertEqual((["r"], None, None, None), inspect.getargspec(f))
+        self.assertEqual((["r"], None, None, None), getargspec(f))
 
         try:
             f(False)
@@ -107,7 +107,7 @@
         def f():
             self.assertEqual(1, self.registry.get_sample_value('g'))
 
-        self.assertEqual(([], None, None, None), inspect.getargspec(f))
+        self.assertEqual(([], None, None, None), getargspec(f))
 
         f()
         self.assertEqual(0, self.registry.get_sample_value('g'))
@@ -134,7 +134,7 @@
         def f():
             time.sleep(.001)
 
-        self.assertEqual(([], None, None, None), inspect.getargspec(f))
+        self.assertEqual(([], None, None, None), getargspec(f))
 
         f()
         self.assertNotEqual(0, self.registry.get_sample_value('g'))
@@ -204,7 +204,7 @@
         def f():
             pass
 
-        self.assertEqual(([], None, None, None), inspect.getargspec(f))
+        self.assertEqual(([], None, None, None), getargspec(f))
 
         f()
         self.assertEqual(1, self.registry.get_sample_value('s_count'))
@@ -345,7 +345,7 @@
         def f():
             pass
 
-        self.assertEqual(([], None, None, None), inspect.getargspec(f))
+        self.assertEqual(([], None, None, None), getargspec(f))
 
         f()
         self.assertEqual(1, self.registry.get_sample_value('h_count'))
@@ -528,9 +528,8 @@
         self.assertRaises(ValueError, Enum, 'foo', 'help', unit="x")
 
     def test_name_cleanup_before_unit_append(self):
-        self.assertEqual(self.counter._name, 'c')
-        self.c = Counter('c_total', 'help', unit="total", labelnames=['l'], 
registry=self.registry)
-        self.assertEqual(self.c._name, 'c_total')
+        c = Counter('b_total', 'help', unit="total", labelnames=['l'], 
registry=self.registry)
+        self.assertEqual(c._name, 'b_total')
 
 
 class TestMetricFamilies(unittest.TestCase):
@@ -717,8 +716,8 @@
         self.assertRaises(ValueError, Gauge, 'h_sum', 'help', 
registry=registry)
         self.assertRaises(ValueError, Gauge, 'h_bucket', 'help', 
registry=registry)
         self.assertRaises(ValueError, Gauge, 'h_created', 'help', 
registry=registry)
-        # The name of the histogram itself isn't taken.
-        Gauge('h', 'help', registry=registry)
+        # The name of the histogram itself is also taken.
+        self.assertRaises(ValueError, Gauge, 'h', 'help', registry=registry)
 
         Info('i', 'help', registry=registry)
         self.assertRaises(ValueError, Gauge, 'i_info', 'help', 
registry=registry)
@@ -753,7 +752,7 @@
 
         m = Metric('s', 'help', 'summary')
         m.samples = [Sample('s_sum', {}, 7)]
-        self.assertEquals([m], 
registry.restricted_registry(['s_sum']).collect())
+        self.assertEqual([m], 
registry.restricted_registry(['s_sum']).collect())
 
     def test_target_info_injected(self):
         registry = CollectorRegistry(target_info={'foo': 'bar'})
@@ -777,11 +776,11 @@
 
         m = Metric('s', 'help', 'summary')
         m.samples = [Sample('s_sum', {}, 7)]
-        self.assertEquals([m], 
registry.restricted_registry(['s_sum']).collect())
+        self.assertEqual([m], 
registry.restricted_registry(['s_sum']).collect())
 
         m = Metric('target', 'Target metadata', 'info')
         m.samples = [Sample('target_info', {'foo': 'bar'}, 1)]
-        self.assertEquals([m], 
registry.restricted_registry(['target_info']).collect())
+        self.assertEqual([m], 
registry.restricted_registry(['target_info']).collect())
 
 
 if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tests/test_exposition.py 
new/client_python-0.9.0/tests/test_exposition.py
--- old/client_python-0.8.0/tests/test_exposition.py    2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/tests/test_exposition.py    2020-11-16 
14:26:28.000000000 +0100
@@ -7,14 +7,13 @@
 import pytest
 
 from prometheus_client import (
-    CollectorRegistry, CONTENT_TYPE_LATEST, Counter, delete_from_gateway, Enum,
-    Gauge, generate_latest, Histogram, Info, instance_ip_grouping_key, Metric,
-    push_to_gateway, pushadd_to_gateway, Summary,
+    CollectorRegistry, CONTENT_TYPE_LATEST, core, Counter, delete_from_gateway,
+    Enum, Gauge, generate_latest, Histogram, Info, instance_ip_grouping_key,
+    Metric, push_to_gateway, pushadd_to_gateway, Summary,
 )
-from prometheus_client import core
 from prometheus_client.core import GaugeHistogramMetricFamily, Timestamp
 from prometheus_client.exposition import (
-    basic_auth_handler, default_handler, MetricsHandler
+    basic_auth_handler, default_handler, MetricsHandler,
 )
 
 if sys.version_info < (2, 7):
@@ -24,12 +23,10 @@
     import unittest
 
 try:
-    from BaseHTTPServer import BaseHTTPRequestHandler
-    from BaseHTTPServer import HTTPServer
+    from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
 except ImportError:
     # Python 3
-    from http.server import BaseHTTPRequestHandler
-    from http.server import HTTPServer
+    from http.server import BaseHTTPRequestHandler, HTTPServer
 
 
 class TestGenerateText(unittest.TestCase):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tests/test_twisted.py 
new/client_python-0.9.0/tests/test_twisted.py
--- old/client_python-0.8.0/tests/test_twisted.py       2020-05-25 
13:59:25.000000000 +0200
+++ new/client_python-0.9.0/tests/test_twisted.py       2020-11-16 
14:26:28.000000000 +0100
@@ -10,14 +10,13 @@
     from unittest import skipUnless
 
 try:
-    from prometheus_client.twisted import MetricsResource
-
+    from twisted.internet import reactor
     from twisted.trial.unittest import TestCase
-    from twisted.web.server import Site
+    from twisted.web.client import Agent, readBody
     from twisted.web.resource import Resource
-    from twisted.internet import reactor
-    from twisted.web.client import Agent
-    from twisted.web.client import readBody
+    from twisted.web.server import Site
+
+    from prometheus_client.twisted import MetricsResource
 
     HAVE_TWISTED = True
 except ImportError:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tests/test_wsgi.py 
new/client_python-0.9.0/tests/test_wsgi.py
--- old/client_python-0.8.0/tests/test_wsgi.py  2020-05-25 13:59:25.000000000 
+0200
+++ new/client_python-0.9.0/tests/test_wsgi.py  2020-11-16 14:26:28.000000000 
+0100
@@ -1,11 +1,9 @@
 from __future__ import absolute_import, unicode_literals
 
-import sys
 from unittest import TestCase
 from wsgiref.util import setup_testing_defaults
-from prometheus_client import make_wsgi_app
 
-from prometheus_client import CollectorRegistry, Counter, generate_latest
+from prometheus_client import CollectorRegistry, Counter, make_wsgi_app
 from prometheus_client.exposition import CONTENT_TYPE_LATEST
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.8.0/tox.ini 
new/client_python-0.9.0/tox.ini
--- old/client_python-0.8.0/tox.ini     2020-05-25 13:59:25.000000000 +0200
+++ new/client_python-0.9.0/tox.ini     2020-11-16 14:26:28.000000000 +0100
@@ -1,5 +1,5 @@
 [tox]
-envlist = 
coverage-clean,py26,py27,py34,py35,py36,py37,py38,pypy,pypy3,{py27,py38}-nooptionals,coverage-report,flake8
+envlist = 
coverage-clean,py26,py27,py34,py35,py36,py37,py38,py39,pypy,pypy3,{py27,py39}-nooptionals,coverage-report,flake8,isort
 
 
 [base]
@@ -40,7 +40,7 @@
     futures
 commands = coverage run --parallel -m pytest {posargs}
 
-[testenv:py38-nooptionals]
+[testenv:py39-nooptionals]
 commands = coverage run --parallel -m pytest {posargs}
 
 [testenv:coverage-clean]
@@ -66,6 +66,12 @@
 commands =
     flake8 prometheus_client/ tests/ setup.py
 
+[testenv:isort]
+deps =
+    isort==5.5.4
+skip_install = true
+commands =
+    isort --check prometheus_client/ tests/ setup.py
 
 [flake8]
 ignore =
@@ -80,7 +86,9 @@
     W291,
     W293,
     W503,
-    E129
+    E129,
+    E731
+
 import-order-style = google
 application-import-names = prometheus_client
 
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to