forked from mirrors/thatmattlove-hyperglass
Remove unused imports, fix syntax errors
This commit is contained in:
parent
7e0bea6a38
commit
e940195631
1 changed files with 15 additions and 11 deletions
|
|
@ -7,21 +7,15 @@ Validates input for overridden parameters.
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import List, Union
|
||||||
from ipaddress import IPv4Address, IPv6Address
|
from ipaddress import IPv4Address, IPv6Address
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from pydantic import (
|
from pydantic import (
|
||||||
BaseSettings,
|
BaseSettings,
|
||||||
ConstrainedStr,
|
|
||||||
DirectoryPath,
|
|
||||||
FilePath,
|
|
||||||
IPvAnyNetwork,
|
IPvAnyNetwork,
|
||||||
IPvAnyAddress,
|
IPvAnyAddress,
|
||||||
UrlStr,
|
UrlStr,
|
||||||
constr,
|
constr,
|
||||||
validator,
|
validator,
|
||||||
create_model,
|
|
||||||
SecretStr,
|
SecretStr,
|
||||||
)
|
)
|
||||||
from pydantic.color import Color
|
from pydantic.color import Color
|
||||||
|
|
@ -71,6 +65,7 @@ class Router(BaseSettings):
|
||||||
class Routers(BaseSettings):
|
class Routers(BaseSettings):
|
||||||
"""Base model for devices class."""
|
"""Base model for devices class."""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def build_network_lists(valid_devices):
|
def build_network_lists(valid_devices):
|
||||||
"""
|
"""
|
||||||
Builds locations dict, which is converted to JSON and passed to
|
Builds locations dict, which is converted to JSON and passed to
|
||||||
|
|
@ -108,7 +103,7 @@ class Routers(BaseSettings):
|
||||||
return (locations_dict, networks_dict)
|
return (locations_dict, networks_dict)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_params(Routers, input_params):
|
def import_params(cls, input_params):
|
||||||
"""
|
"""
|
||||||
Imports passed dict from YAML config, removes unsupported
|
Imports passed dict from YAML config, removes unsupported
|
||||||
characters from device names, dynamically sets attributes for
|
characters from device names, dynamically sets attributes for
|
||||||
|
|
@ -132,6 +127,8 @@ class Routers(BaseSettings):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic Config"""
|
"""Pydantic Config"""
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
validate_all = True
|
validate_all = True
|
||||||
validate_assignment = True
|
validate_assignment = True
|
||||||
|
|
||||||
|
|
@ -147,7 +144,7 @@ class Credentials(BaseSettings):
|
||||||
"""Base model for credentials class"""
|
"""Base model for credentials class"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_params(Credentials, input_params):
|
def import_params(cls, input_params):
|
||||||
"""
|
"""
|
||||||
Imports passed dict from YAML config, removes unsupported
|
Imports passed dict from YAML config, removes unsupported
|
||||||
characters from device names, dynamically sets attributes for
|
characters from device names, dynamically sets attributes for
|
||||||
|
|
@ -162,6 +159,8 @@ class Credentials(BaseSettings):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic Config"""
|
"""Pydantic Config"""
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
validate_all = True
|
validate_all = True
|
||||||
validate_assignment = True
|
validate_assignment = True
|
||||||
|
|
||||||
|
|
@ -187,7 +186,7 @@ class Proxies(BaseSettings):
|
||||||
"""Base model for proxies class"""
|
"""Base model for proxies class"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_params(Proxies, input_params):
|
def import_params(cls, input_params):
|
||||||
"""
|
"""
|
||||||
Imports passed dict from YAML config, removes unsupported
|
Imports passed dict from YAML config, removes unsupported
|
||||||
characters from device names, dynamically sets attributes for
|
characters from device names, dynamically sets attributes for
|
||||||
|
|
@ -202,6 +201,8 @@ class Proxies(BaseSettings):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic Config"""
|
"""Pydantic Config"""
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
validate_all = True
|
validate_all = True
|
||||||
validate_assignment = True
|
validate_assignment = True
|
||||||
|
|
||||||
|
|
@ -476,6 +477,7 @@ class Params(BaseSettings):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic Config"""
|
"""Pydantic Config"""
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
validate_all = True
|
validate_all = True
|
||||||
validate_assignment = True
|
validate_assignment = True
|
||||||
|
|
||||||
|
|
@ -512,7 +514,7 @@ class Commands(BaseSettings):
|
||||||
"""Base class for commands class"""
|
"""Base class for commands class"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_params(Commands, input_params):
|
def import_params(cls, input_params):
|
||||||
"""
|
"""
|
||||||
Imports passed dict from YAML config, dynamically sets
|
Imports passed dict from YAML config, dynamically sets
|
||||||
attributes for the commands class.
|
attributes for the commands class.
|
||||||
|
|
@ -622,5 +624,7 @@ class Commands(BaseSettings):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic Config"""
|
"""Pydantic Config"""
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
validate_all = False
|
validate_all = False
|
||||||
validate_assignment = True
|
validate_assignment = True
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue