Skip to content

Commit 47d2b41

Browse files
authored
Do not use global when only reading variable (#1133)
The global keyword is only necessary when writing to a variable, this will fix the lint failures that came with a newer version of flake8. Signed-off-by: Chris Marchbanks <[email protected]>
1 parent 4de31ee commit 47d2b41

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

prometheus_client/validation.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def _init_legacy_validation() -> bool:
1616

1717
def get_legacy_validation() -> bool:
1818
"""Return the current status of the legacy validation setting."""
19-
global _legacy_validation
2019
return _legacy_validation
2120

2221

@@ -39,7 +38,6 @@ def _validate_metric_name(name: str) -> None:
3938
"""
4039
if not name:
4140
raise ValueError("metric name cannot be empty")
42-
global _legacy_validation
4341
if _legacy_validation:
4442
if not METRIC_NAME_RE.match(name):
4543
raise ValueError("invalid metric name " + name)
@@ -63,7 +61,6 @@ def _validate_metric_label_name_token(tok: str) -> None:
6361
"""
6462
if not tok:
6563
raise ValueError("invalid label name token " + tok)
66-
global _legacy_validation
6764
quoted = tok[0] == '"' and tok[-1] == '"'
6865
if not quoted or _legacy_validation:
6966
if not METRIC_LABEL_NAME_RE.match(tok):

0 commit comments

Comments
 (0)