forked from mirrors/thatmattlove-hyperglass
Fix syntax errors
This commit is contained in:
parent
22f382865b
commit
2f33a823e4
1 changed files with 10 additions and 8 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue