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