Browse Source

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
changes/53/676453/2
Ian H Pittwood 3 years ago committed by Ian Pittwood
parent
commit
dae192efc6
  1. 3
      .gitignore
  2. 2
      Pipfile
  3. 8
      Pipfile.lock
  4. 1
      spyglass/data_extractor/base.py
  5. 8
      spyglass/data_extractor/models.py
  6. 1
      spyglass/validators/json_validator.py
  7. 1
      spyglass/validators/validator.py
  8. 3
      tests/unit/data_extractor/test_models.py

3
.gitignore vendored

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

2
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 = "*"

8
Pipfile.lock generated

@ -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": [

1
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

8
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,

1
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,

1
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 = []

3
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')

Loading…
Cancel
Save