From dae192efc6299c31980cb6b07ef3a92d689cc4c7 Mon Sep 17 00:00:00 2001 From: Ian H Pittwood Date: Wed, 14 Aug 2019 11:16:34 -0500 Subject: [PATCH] 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 --- .gitignore | 3 +++ Pipfile | 2 +- Pipfile.lock | 8 ++++---- spyglass/data_extractor/base.py | 1 - spyglass/data_extractor/models.py | 8 -------- spyglass/validators/json_validator.py | 1 - spyglass/validators/validator.py | 1 - tests/unit/data_extractor/test_models.py | 3 --- 8 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index a741440..9222abf 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,6 @@ AUTHORS # Ansible *.retry + +# *nix pyenv +*~ diff --git a/Pipfile b/Pipfile index 0ad47d6..a91a991 100644 --- a/Pipfile +++ b/Pipfile @@ -8,7 +8,7 @@ pbr = ">=2.0.0" pytest = "*" pytest-xdist = "*" pytest-cov = "*" -yapf = "~=0.27.0" +yapf = "~=0.28.0" hacking = ">=1.1.0" bandit = ">=1.6.0" tox = "*" diff --git a/Pipfile.lock b/Pipfile.lock index e0fdc37..3dd3a7d 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "d1c864960a43573d69498819934a7926b20dea9fa67d41ec1daa2a9e8f06bbb9" + "sha256": "998682b3c6b9e786e008f8d48847ec5317eb9b8054cc6cee3a91f1d57b7c5bb7" }, "pipfile-spec": 6, "requires": { @@ -431,11 +431,11 @@ }, "yapf": { "hashes": [ - "sha256:34f6f80c446dcb2c44bd644c4037a2024b6645e293a4c9c4521983dd0bb247a1", - "sha256:613deba14233623ff3432d9d5032631b5f600be97b39f66932cbe67648bfa8ea" + "sha256:02ace10a00fa2e36c7ebd1df2ead91dbfbd7989686dc4ccbdc549e95d19f5780", + "sha256:6f94b6a176a7c114cfa6bad86d40f259bbe0f10cf2fa7f2f4b3596fc5802a41b" ], "index": "pypi", - "version": "==0.27.0" + "version": "==0.28.0" }, "zipp": { "hashes": [ diff --git a/spyglass/data_extractor/base.py b/spyglass/data_extractor/base.py index 7f4f68c..9d9d827 100755 --- a/spyglass/data_extractor/base.py +++ b/spyglass/data_extractor/base.py @@ -22,7 +22,6 @@ LOG = logging.getLogger(__name__) class BaseDataSourcePlugin(metaclass=abc.ABCMeta): """Provide basic hooks for data source plugins""" - def __init__(self, region, **kwargs): self.source_type = None self.source_name = None diff --git a/spyglass/data_extractor/models.py b/spyglass/data_extractor/models.py index 090af45..e055797 100644 --- a/spyglass/data_extractor/models.py +++ b/spyglass/data_extractor/models.py @@ -43,7 +43,6 @@ def _parse_ip(addr): class ServerList(object): """Model for a list of servers""" - def __init__(self, server_list): """Validates a list of server IPs and creates a list of them @@ -84,7 +83,6 @@ class ServerList(object): class IPList(object): """Model for IP addresses for a baremetal host""" - def __init__( self, oob=DATA_DEFAULT, @@ -173,7 +171,6 @@ class IPList(object): class Host(object): """Model for a baremetal host""" - def __init__(self, name, **kwargs): """Stores data for a baremetal host @@ -218,7 +215,6 @@ class Host(object): class Rack(object): """Model for a baremetal rack""" - def __init__(self, name: str, host_list: list): """Stores data for the top-level, baremetal rack @@ -273,7 +269,6 @@ class Rack(object): class VLANNetworkData(object): """Model for single entry of VLAN Network Data""" - def __init__(self, name: str, **kwargs): """Stores single entry of VLAN Network Data @@ -384,7 +379,6 @@ class VLANNetworkData(object): class Network(object): """Model for network configurations""" - def __init__(self, vlan_network_data: list, **kwargs): """Stores data for Airship network configurations @@ -450,7 +444,6 @@ class Network(object): class SiteInfo(object): """Model for general site information""" - def __init__(self, name, **kwargs): """Stores general site information such as location data and site name @@ -542,7 +535,6 @@ class SiteInfo(object): class SiteDocumentData(object): """High level model for site data""" - def __init__( self, site_info: SiteInfo, diff --git a/spyglass/validators/json_validator.py b/spyglass/validators/json_validator.py index 48561ff..0c21952 100644 --- a/spyglass/validators/json_validator.py +++ b/spyglass/validators/json_validator.py @@ -30,7 +30,6 @@ LOG_FORMAT = '%(asctime)s %(levelname)-8s %(name)s:' \ class JSONSchemaValidator(BaseDocumentValidator): """Validator for validating documents using jsonschema""" - def __init__( self, document_path, diff --git a/spyglass/validators/validator.py b/spyglass/validators/validator.py index 9c011ca..e6d1065 100644 --- a/spyglass/validators/validator.py +++ b/spyglass/validators/validator.py @@ -17,7 +17,6 @@ import abc class BaseDocumentValidator(metaclass=abc.ABCMeta): """Abstract class for document validation""" - def __init__(self): self.documents = [] self.schemas = [] diff --git a/tests/unit/data_extractor/test_models.py b/tests/unit/data_extractor/test_models.py index 49d0f72..d67efbf 100644 --- a/tests/unit/data_extractor/test_models.py +++ b/tests/unit/data_extractor/test_models.py @@ -28,7 +28,6 @@ FIXTURE_DIR = os.path.join( class TestParseIp(unittest.TestCase): """Tests the _parse_ip validator for Spyglass models""" - def test__parse_ip(self): """Tests basic function of _parse_ip validator""" addr = '10.23.0.1' @@ -853,7 +852,6 @@ class TestSiteDocumentData(unittest.TestCase): class TestValidateKeyInIntermediaryDict(unittest.TestCase): """Tests the _validate_key_in_intermediary_dict function""" - def test__validate_key_in_intermediary_dict(self): test_dictionary = {'test_key': 'value'} key = 'test_key' @@ -869,7 +867,6 @@ class TestValidateKeyInIntermediaryDict(unittest.TestCase): class TestSiteDocumentDataFactory(unittest.TestCase): """Tests the site_document_data_factory function""" - def setUp(self) -> None: test_intermediary_path = os.path.join( FIXTURE_DIR, 'test_intermediary.yaml')