Add yapf configuration file
Some of the default behaviors of yapf do not match the styling preferences of Airship and OpenDev, such as line breaks between dictionary key/value pairs. This change sets the style template for yapf (PEP-8) and sets a few knobs to help remedy problematic behavior. Adds .style.yapf configuration file. Updates styling of existing files using new configuration. Change-Id: Ifea58ef2d7be93f47dd8e4f42cac6aea514b83bd
This commit is contained in:
parent
6fefe5233e
commit
7cf016e05f
6
.style.yapf
Normal file
6
.style.yapf
Normal file
@ -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
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
class BaseProcessor(object):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user