mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
fix docstrings
This commit is contained in:
@ -25,8 +25,7 @@ LOG_HANDLER = {"sink": sys.stdout, "format": LOG_FMT, "level": "INFO"}
|
|||||||
|
|
||||||
|
|
||||||
class Supported:
|
class Supported:
|
||||||
"""
|
"""Define items supported by hyperglass.
|
||||||
Defines items supported by hyperglass.
|
|
||||||
|
|
||||||
query_types: Supported query types used to validate Flask input.
|
query_types: Supported query types used to validate Flask input.
|
||||||
|
|
||||||
@ -120,41 +119,61 @@ class Supported:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_supported(nos):
|
def is_supported(nos):
|
||||||
"""
|
"""Verify if NOS is supported.
|
||||||
Returns boolean state of input Network Operating System against
|
|
||||||
rest OR scrape tuples.
|
Arguments:
|
||||||
|
nos {str} -- NOS short name
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
{bool} -- True if supported
|
||||||
"""
|
"""
|
||||||
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):
|
||||||
"""
|
"""Verify if NOS transport is scrape.
|
||||||
Returns boolean state of input Network Operating System against
|
|
||||||
scrape tuple.
|
Arguments:
|
||||||
|
nos {str} -- NOS short name
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
{bool} -- True if scrape
|
||||||
"""
|
"""
|
||||||
return bool(nos in Supported.scrape)
|
return bool(nos in Supported.scrape)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_rest(nos):
|
def is_rest(nos):
|
||||||
"""
|
"""Verify if NOS transport is REST.
|
||||||
Returns boolean state of input Network Operating System against
|
|
||||||
rest tuple.
|
Arguments:
|
||||||
|
nos {str} -- NOS short name
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
{bool} -- True if REST
|
||||||
"""
|
"""
|
||||||
return bool(nos in Supported.rest)
|
return bool(nos in Supported.rest)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_supported_query(query_type):
|
def is_supported_query(query_type):
|
||||||
"""
|
"""Verify if query type is supported.
|
||||||
Returns boolean state of input Network Operating System against
|
|
||||||
query_type tuple.
|
Arguments:
|
||||||
|
query_type {str} -- query type
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
{bool} -- True if supported
|
||||||
"""
|
"""
|
||||||
return bool(query_type in Supported.query_types)
|
return bool(query_type in Supported.query_types)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def map_transport(nos):
|
def map_transport(nos):
|
||||||
"""
|
"""Map NOS to transport name.
|
||||||
Returns "scrape" if input nos is in Supported.scrape tuple, or
|
|
||||||
"rest" if input nos is in Supported.rest tuple.
|
Arguments:
|
||||||
|
nos {str} -- NOS short name
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
{str} -- Transport name
|
||||||
"""
|
"""
|
||||||
transport = None
|
transport = None
|
||||||
if nos in Supported.scrape:
|
if nos in Supported.scrape:
|
||||||
@ -162,8 +181,3 @@ class Supported:
|
|||||||
elif nos in Supported.rest:
|
elif nos in Supported.rest:
|
||||||
transport = "rest"
|
transport = "rest"
|
||||||
return transport
|
return transport
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def map_rest(nos):
|
|
||||||
uri_map = {"frr": "frr", "bird": "bird"}
|
|
||||||
return uri_map.get(nos)
|
|
||||||
|
Reference in New Issue
Block a user