Added YAPF configuration

Added YAPF config recently implemented into Spyglass.

Reformatted code using YAPF.
This commit is contained in:
Ian H. Pittwood 2019-05-02 09:58:58 -05:00
parent c74937c3d6
commit 2a323424ee
5 changed files with 15 additions and 8 deletions

6
.style.yapf Normal file
View 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

View File

@ -24,6 +24,7 @@ setup(
license='Apache 2.0', license='Apache 2.0',
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
'click==7.0',
'PyYAML==3.12', 'PyYAML==3.12',
'openpyxl==2.5.4', 'openpyxl==2.5.4',
], ],

View File

@ -18,6 +18,7 @@ class BaseError(Exception):
class NotEnoughIp(BaseError): class NotEnoughIp(BaseError):
def __init__(self, cidr, total_nodes): def __init__(self, cidr, total_nodes):
self.cidr = cidr self.cidr = cidr
self.total_nodes = total_nodes self.total_nodes = total_nodes
@ -27,6 +28,7 @@ class NotEnoughIp(BaseError):
class NoSpecMatched(BaseError): class NoSpecMatched(BaseError):
def __init__(self, excel_specs): def __init__(self, excel_specs):
self.specs = excel_specs self.specs = excel_specs

View File

@ -23,6 +23,7 @@ LOG = logging.getLogger(__name__)
class ExcelPlugin(BaseDataSourcePlugin): class ExcelPlugin(BaseDataSourcePlugin):
def __init__(self, region): def __init__(self, region):
LOG.info("Excel Plugin Initializing") LOG.info("Excel Plugin Initializing")
self.source_type = "excel" self.source_type = "excel"
@ -107,12 +108,9 @@ class ExcelPlugin(BaseDataSourcePlugin):
for rack in rackwise_hosts.keys(): for rack in rackwise_hosts.keys():
for host in rackwise_hosts[rack]: for host in rackwise_hosts[rack]:
host_list.append({ host_list.append({
"rack_name": "rack_name": rack,
rack, "name": host,
"name": "host_profile": ipmi_data[host]["host_profile"],
host,
"host_profile":
ipmi_data[host]["host_profile"],
}) })
return host_list return host_list

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = pep8, bandit, docs envlist = pep8, docs
minversion = 2.3.1 minversion = 2.3.1
skipsdist = True skipsdist = True
@ -24,7 +24,7 @@ basepython = python3
deps = deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = commands =
yapf -ir {toxinidir}/spyglass-plugin-xls yapf -ir {toxinidir}/spyglass-plugin-xls {toxinidir}/setup.py
[testenv:pep8] [testenv:pep8]
basepython = python3 basepython = python3