1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-01-17 08:48:05 +00:00

Fix syntax errors

This commit is contained in:
checktheroads 2019-07-07 22:38:46 -07:00
parent 22f382865b
commit 2f33a823e4

View file

@ -2,8 +2,6 @@
Global Constants for hyperglass
"""
__all__: ("code", "Supported")
class Status:
"""
@ -11,6 +9,8 @@ class Status:
hyperglass.
"""
# pylint: disable=too-few-public-methods
codes_dict = {
200: ("valid", "Valid Query"),
405: ("not_allowed", "Query Not Allowed"),
@ -22,8 +22,8 @@ class Status:
"""
Dynamically generates class attributes for codes in codes_dict.
"""
for (code, text) in Status.codes_dict.items():
setattr(self, text[0], code)
for (_code, text) in Status.codes_dict.items():
setattr(self, text[0], _code)
@staticmethod
def get_reason(search_code):
@ -31,9 +31,11 @@ class Status:
Maps and returns input code integer to associated reason text.
Mainly used for populating Prometheus fields.
"""
for (code, text) in Status.codes_dict.items():
if code == search_code:
return text[1]
reason = None
for (_code, text) in Status.codes_dict.items():
if _code == search_code:
reason = text[1]
return reason
code = Status()
@ -136,7 +138,7 @@ class Supported:
Returns boolean state of input Network Operating System against
rest OR scrape tuples.
"""
return bool(nos in (Supported.rest + Supported.scrape))
return bool(nos in Supported.rest + Supported.scrape)
@staticmethod
def is_scrape(nos):