8000 Change to imports to fix go-to-declaration in editors (#747) · chnacib/client_python@da15e4a · GitHub
[go: up one dir, main page]

Skip to content

Commit da15e4a

Browse files
authored
Change to imports to fix go-to-declaration in editors (prometheus#747)
* Convert assignments to imports Signed-off-by: Angus Holder <aholder97@gmail.com> * Run isort Signed-off-by: Angus Holder <aholder97@gmail.com> * Suppress flake8 warning about unused imports in __init__.py - they're the entrypoint of the library! Signed-off-by: Angus Holder <aholder97@gmail.com>
1 parent 3ef865e commit da15e4a

File tree

2 files changed

+13
-31
lines changed

2 files changed

+13
-31
lines changed

prometheus_client/__init__.py

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,21 @@
44
exposition, gc_collector, metrics, metrics_core, platform_collector,
55
process_collector, registry,
66
)
7+
from .exposition import (
8+
CONTENT_TYPE_LATEST, delete_from_gateway, generate_latest,
9+
instance_ip_grouping_key, make_asgi_app, make_wsgi_app, MetricsHandler,
10+
push_to_gateway, pushadd_to_gateway, start_http_server, start_wsgi_server,
11+
write_to_textfile,
12+
)
13+
from .gc_collector import GC_COLLECTOR, GCCollector
14+
from .metrics import Counter, Enum, Gauge, Histogram, Info, Summary
15+
from .metrics_core import Metric
16+
from .platform_collector import PLATFORM_COLLECTOR, PlatformCollector
17+
from .process_collector import PROCESS_COLLECTOR, ProcessCollector
18+
from .registry import CollectorRegistry, REGISTRY
719

820
__all__ = ['Counter', 'Gauge', 'Summary', 'Histogram', 'Info', 'Enum']
921

10-
CollectorRegistry = registry.CollectorRegistry
11-
REGISTRY = registry.REGISTRY
12-
Metric = metrics_core.Metric
13-
Counter = metrics.Counter
14-
Gauge = metrics.Gauge
15-
Summary = metrics.Summary
16-
Histogram = metrics.Histogram
17-
Info = metrics.Info
18-
Enum = metrics.Enum
19-
20-
CONTENT_TYPE_LATEST = exposition.CONTENT_TYPE_LATEST
21-
generate_latest = exposition.generate_latest
22-
MetricsHandler = exposition.MetricsHandler
23-
make_wsgi_app = exposition.make_wsgi_app
24-
make_asgi_app = exposition.make_asgi_app
25-
start_http_server = exposition.start_http_server
26-
start_wsgi_server = exposition.start_wsgi_server
27-
write_to_textfile = exposition.write_to_textfile
28-
push_to_gateway = exposition.push_to_gateway
29-
pushadd_to_gateway = exposition.pushadd_to_gateway
30-
delete_from_gateway = exposition.delete_from_gateway
31-
instance_ip_grouping_key = exposition.instance_ip_grouping_key
32-
33-
ProcessCollector = process_collector.ProcessCollector
34-
PROCESS_COLLECTOR = process_collector.PROCESS_COLLECTOR
35-
36-
PlatformCollector = platform_collector.PlatformCollector
37-
PLATFORM_COLLECTOR = platform_collector.PLATFORM_COLLECTOR
38-
39-
GCCollector = gc_collector.GCCollector
40-
GC_COLLECTOR = gc_collector.GC_COLLECTOR
4122

4223
if __name__ == '__main__':
4324
c = Counter('cc', 'A counter')

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ignore =
6464
E129,
6565
E731
6666

67+
per-file-ignores = prometheus_client/__init__.py:F401
6768
import-order-style = google
6869
application-import-names = prometheus_client
6970

0 commit comments

Comments
 (0)
0