diff --git a/.style.yapf b/.style.yapf new file mode 100644 index 0000000..7dca927 --- /dev/null +++ b/.style.yapf @@ -0,0 +1,6 @@ +[style] +based_on_style = pep8 +allow_split_before_dict_value = false +blank_line_before_nested_class_or_def = true +blank_line_before_module_docstring = true +split_before_logical_operator = false diff --git a/spyglass/data_extractor/custom_exceptions.py b/spyglass/data_extractor/custom_exceptions.py index e2f5387..c98456b 100644 --- a/spyglass/data_extractor/custom_exceptions.py +++ b/spyglass/data_extractor/custom_exceptions.py @@ -19,6 +19,7 @@ LOG = logging.getLogger(__name__) class BaseError(Exception): + def __init__(self, msg): self.msg = msg @@ -28,6 +29,7 @@ class BaseError(Exception): class NoSpecMatched(BaseError): + def __init__(self, excel_specs): self.specs = excel_specs diff --git a/spyglass/data_extractor/plugins/formation.py b/spyglass/data_extractor/plugins/formation.py index 569f483..d905e32 100755 --- a/spyglass/data_extractor/plugins/formation.py +++ b/spyglass/data_extractor/plugins/formation.py @@ -29,6 +29,7 @@ LOG = logging.getLogger(__name__) class FormationPlugin(BaseDataSourcePlugin): + def __init__(self, region): # Save site name is valid if not region: @@ -365,8 +366,8 @@ class FormationPlugin(BaseDataSourcePlugin): for vlan_ in vlans: if len(vlan_.vlan.ipv4) != 0: tmp_vlan = { - "name": - self._get_network_name_from_vlan_name(vlan_.vlan.name), + "name": self._get_network_name_from_vlan_name( + vlan_.vlan.name), "vlan": vlan_.vlan.vlan_id, "subnet": vlan_.vlan.subnet_range, "gateway": vlan_.ipv4_gateway, diff --git a/spyglass/data_extractor/plugins/tugboat/check_exceptions.py b/spyglass/data_extractor/plugins/tugboat/check_exceptions.py index f09ebe5..94bc0f2 100644 --- a/spyglass/data_extractor/plugins/tugboat/check_exceptions.py +++ b/spyglass/data_extractor/plugins/tugboat/check_exceptions.py @@ -18,6 +18,7 @@ class BaseError(Exception): class NotEnoughIp(BaseError): + def __init__(self, cidr, total_nodes): self.cidr = cidr self.total_nodes = total_nodes @@ -27,6 +28,7 @@ class NotEnoughIp(BaseError): class NoSpecMatched(BaseError): + def __init__(self, excel_specs): self.specs = excel_specs diff --git a/spyglass/data_extractor/plugins/tugboat/tugboat.py b/spyglass/data_extractor/plugins/tugboat/tugboat.py index 126a56a..15b047f 100755 --- a/spyglass/data_extractor/plugins/tugboat/tugboat.py +++ b/spyglass/data_extractor/plugins/tugboat/tugboat.py @@ -24,6 +24,7 @@ LOG = logging.getLogger(__name__) class TugboatPlugin(BaseDataSourcePlugin): + def __init__(self, region): LOG.info("Tugboat Initializing") self.source_type = "excel" @@ -108,12 +109,9 @@ class TugboatPlugin(BaseDataSourcePlugin): for rack in rackwise_hosts.keys(): for host in rackwise_hosts[rack]: host_list.append({ - "rack_name": - rack, - "name": - host, - "host_profile": - ipmi_data[host]["host_profile"], + "rack_name": rack, + "name": host, + "host_profile": ipmi_data[host]["host_profile"], }) return host_list diff --git a/spyglass/parser/engine.py b/spyglass/parser/engine.py index 86f3777..20fdeb8 100755 --- a/spyglass/parser/engine.py +++ b/spyglass/parser/engine.py @@ -27,6 +27,7 @@ LOG = logging.getLogger(__name__) class ProcessDataSource(object): + def __init__(self, site_type): # Initialize intermediary and save site type self._initialize_intermediary() @@ -315,6 +316,7 @@ class ProcessDataSource(object): """ # TBR(pg710r): for internal testing + """ raw_data = self._read_file('extracted_data.yaml') extracted_data = yaml.safe_load(raw_data) diff --git a/spyglass/site_processors/base.py b/spyglass/site_processors/base.py index 8fe63d9..625388f 100644 --- a/spyglass/site_processors/base.py +++ b/spyglass/site_processors/base.py @@ -14,6 +14,7 @@ class BaseProcessor(object): + def __init__(self): pass diff --git a/spyglass/site_processors/site_processor.py b/spyglass/site_processors/site_processor.py index 56a687d..18c6b17 100644 --- a/spyglass/site_processors/site_processor.py +++ b/spyglass/site_processors/site_processor.py @@ -24,6 +24,7 @@ LOG = logging.getLogger(__name__) class SiteProcessor(BaseProcessor): + def __init__(self, intermediary_yaml, manifest_dir): super().__init__() self.yaml_data = intermediary_yaml