Upgrade yapf to 0.28

Upgrades yapf to newest version, 0.28.0, and runs the formatter to
update all existing code.

Adds entry to .gitignore to ignore pyenv installations.

Change-Id: I11512a8a522cc530165461cc8f52f7ff010dd092
This commit is contained in:
Ian H Pittwood 2019-08-14 11:16:34 -05:00 committed by Ian Pittwood
parent 166483d6ad
commit dae192efc6
8 changed files with 8 additions and 19 deletions

3
.gitignore vendored
View File

@ -114,3 +114,6 @@ AUTHORS
# Ansible # Ansible
*.retry *.retry
# *nix pyenv
*~

View File

@ -8,7 +8,7 @@ pbr = ">=2.0.0"
pytest = "*" pytest = "*"
pytest-xdist = "*" pytest-xdist = "*"
pytest-cov = "*" pytest-cov = "*"
yapf = "~=0.27.0" yapf = "~=0.28.0"
hacking = ">=1.1.0" hacking = ">=1.1.0"
bandit = ">=1.6.0" bandit = ">=1.6.0"
tox = "*" tox = "*"

8
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "d1c864960a43573d69498819934a7926b20dea9fa67d41ec1daa2a9e8f06bbb9" "sha256": "998682b3c6b9e786e008f8d48847ec5317eb9b8054cc6cee3a91f1d57b7c5bb7"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -431,11 +431,11 @@
}, },
"yapf": { "yapf": {
"hashes": [ "hashes": [
"sha256:34f6f80c446dcb2c44bd644c4037a2024b6645e293a4c9c4521983dd0bb247a1", "sha256:02ace10a00fa2e36c7ebd1df2ead91dbfbd7989686dc4ccbdc549e95d19f5780",
"sha256:613deba14233623ff3432d9d5032631b5f600be97b39f66932cbe67648bfa8ea" "sha256:6f94b6a176a7c114cfa6bad86d40f259bbe0f10cf2fa7f2f4b3596fc5802a41b"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.27.0" "version": "==0.28.0"
}, },
"zipp": { "zipp": {
"hashes": [ "hashes": [

View File

@ -22,7 +22,6 @@ LOG = logging.getLogger(__name__)
class BaseDataSourcePlugin(metaclass=abc.ABCMeta): class BaseDataSourcePlugin(metaclass=abc.ABCMeta):
"""Provide basic hooks for data source plugins""" """Provide basic hooks for data source plugins"""
def __init__(self, region, **kwargs): def __init__(self, region, **kwargs):
self.source_type = None self.source_type = None
self.source_name = None self.source_name = None

View File

@ -43,7 +43,6 @@ def _parse_ip(addr):
class ServerList(object): class ServerList(object):
"""Model for a list of servers""" """Model for a list of servers"""
def __init__(self, server_list): def __init__(self, server_list):
"""Validates a list of server IPs and creates a list of them """Validates a list of server IPs and creates a list of them
@ -84,7 +83,6 @@ class ServerList(object):
class IPList(object): class IPList(object):
"""Model for IP addresses for a baremetal host""" """Model for IP addresses for a baremetal host"""
def __init__( def __init__(
self, self,
oob=DATA_DEFAULT, oob=DATA_DEFAULT,
@ -173,7 +171,6 @@ class IPList(object):
class Host(object): class Host(object):
"""Model for a baremetal host""" """Model for a baremetal host"""
def __init__(self, name, **kwargs): def __init__(self, name, **kwargs):
"""Stores data for a baremetal host """Stores data for a baremetal host
@ -218,7 +215,6 @@ class Host(object):
class Rack(object): class Rack(object):
"""Model for a baremetal rack""" """Model for a baremetal rack"""
def __init__(self, name: str, host_list: list): def __init__(self, name: str, host_list: list):
"""Stores data for the top-level, baremetal rack """Stores data for the top-level, baremetal rack
@ -273,7 +269,6 @@ class Rack(object):
class VLANNetworkData(object): class VLANNetworkData(object):
"""Model for single entry of VLAN Network Data""" """Model for single entry of VLAN Network Data"""
def __init__(self, name: str, **kwargs): def __init__(self, name: str, **kwargs):
"""Stores single entry of VLAN Network Data """Stores single entry of VLAN Network Data
@ -384,7 +379,6 @@ class VLANNetworkData(object):
class Network(object): class Network(object):
"""Model for network configurations""" """Model for network configurations"""
def __init__(self, vlan_network_data: list, **kwargs): def __init__(self, vlan_network_data: list, **kwargs):
"""Stores data for Airship network configurations """Stores data for Airship network configurations
@ -450,7 +444,6 @@ class Network(object):
class SiteInfo(object): class SiteInfo(object):
"""Model for general site information""" """Model for general site information"""
def __init__(self, name, **kwargs): def __init__(self, name, **kwargs):
"""Stores general site information such as location data and site name """Stores general site information such as location data and site name
@ -542,7 +535,6 @@ class SiteInfo(object):
class SiteDocumentData(object): class SiteDocumentData(object):
"""High level model for site data""" """High level model for site data"""
def __init__( def __init__(
self, self,
site_info: SiteInfo, site_info: SiteInfo,

View File

@ -30,7 +30,6 @@ LOG_FORMAT = '%(asctime)s %(levelname)-8s %(name)s:' \
class JSONSchemaValidator(BaseDocumentValidator): class JSONSchemaValidator(BaseDocumentValidator):
"""Validator for validating documents using jsonschema""" """Validator for validating documents using jsonschema"""
def __init__( def __init__(
self, self,
document_path, document_path,

View File

@ -17,7 +17,6 @@ import abc
class BaseDocumentValidator(metaclass=abc.ABCMeta): class BaseDocumentValidator(metaclass=abc.ABCMeta):
"""Abstract class for document validation""" """Abstract class for document validation"""
def __init__(self): def __init__(self):
self.documents = [] self.documents = []
self.schemas = [] self.schemas = []

View File

@ -28,7 +28,6 @@ FIXTURE_DIR = os.path.join(
class TestParseIp(unittest.TestCase): class TestParseIp(unittest.TestCase):
"""Tests the _parse_ip validator for Spyglass models""" """Tests the _parse_ip validator for Spyglass models"""
def test__parse_ip(self): def test__parse_ip(self):
"""Tests basic function of _parse_ip validator""" """Tests basic function of _parse_ip validator"""
addr = '10.23.0.1' addr = '10.23.0.1'
@ -853,7 +852,6 @@ class TestSiteDocumentData(unittest.TestCase):
class TestValidateKeyInIntermediaryDict(unittest.TestCase): class TestValidateKeyInIntermediaryDict(unittest.TestCase):
"""Tests the _validate_key_in_intermediary_dict function""" """Tests the _validate_key_in_intermediary_dict function"""
def test__validate_key_in_intermediary_dict(self): def test__validate_key_in_intermediary_dict(self):
test_dictionary = {'test_key': 'value'} test_dictionary = {'test_key': 'value'}
key = 'test_key' key = 'test_key'
@ -869,7 +867,6 @@ class TestValidateKeyInIntermediaryDict(unittest.TestCase):
class TestSiteDocumentDataFactory(unittest.TestCase): class TestSiteDocumentDataFactory(unittest.TestCase):
"""Tests the site_document_data_factory function""" """Tests the site_document_data_factory function"""
def setUp(self) -> None: def setUp(self) -> None:
test_intermediary_path = os.path.join( test_intermediary_path = os.path.join(
FIXTURE_DIR, 'test_intermediary.yaml') FIXTURE_DIR, 'test_intermediary.yaml')