From 9acb9e9b5efbc0d2e0d58c8f39f914b6020879a2 Mon Sep 17 00:00:00 2001 From: uggla Date: Thu, 9 Jul 2015 14:49:25 +0200 Subject: [PATCH] Cleanup to respect pep8 coding standard. --- alexandria/config.py | 15 +++++++-------- alexandria/drivers.py | 20 +++++++++----------- alexandria/models.py | 18 ++++++++---------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/alexandria/config.py b/alexandria/config.py index 9395eae..85c2440 100644 --- a/alexandria/config.py +++ b/alexandria/config.py @@ -4,23 +4,22 @@ import ConfigParser class AlexandriaConfiguration(object): - + def __init__(self, configuration_file): self.config = ConfigParser.ConfigParser(allow_no_value=True) self.config.read(configuration_file) - + def get_drivers(self): drivers = self.config.sections() drivers.remove("alexandria") return drivers - - - + + + return self.config.sections() - + def get_driver_info(self,driver): return self.config.options(driver) - + def get_alexandria_port(self): return self.config.get("alexandria", "port") - \ No newline at end of file diff --git a/alexandria/drivers.py b/alexandria/drivers.py index c944c09..56508db 100644 --- a/alexandria/drivers.py +++ b/alexandria/drivers.py @@ -3,37 +3,37 @@ import types class Driver(object): - + def __init__(self): self.driver_type = self.__class__.__name__ - # Get credentials from conf files for CMDB + # Get credentials from conf files for CMDB pass - + def get_driver_type(self): return self.driver_type - + def get_ci(self): pass - + def push_ci(self): pass class Itop(Driver): - + def get_ci(self): print "Get from itop" return True - + def push_ci(self): pass class Redfish(Driver): - + def get_ci(self): print "Get from redfish" return True - + pass class Ironic(Driver): @@ -51,5 +51,3 @@ class Fakeprovider(Driver): class DriverCollection(list): pass - - \ No newline at end of file diff --git a/alexandria/models.py b/alexandria/models.py index 8160fdc..06148c5 100644 --- a/alexandria/models.py +++ b/alexandria/models.py @@ -5,33 +5,31 @@ import glob import os import re + class Model(object): """Implements Alexandria reference model.""" def __init__(self): - + self.reference_items = [] - + self.read_ref_files() pass - - + def read_ref_files(self): cwd = os.getcwd() - model_files = glob.glob(cwd + "/model/redfish/*.json") # hierarchy model/std/*.json - + # Hierarchy model/std/*.json + model_files = glob.glob(cwd + "/model/redfish/*.json") for file in model_files: # Derive attribute name from file. attr_name = os.path.basename(file) attr_name = re.sub(r"\..*$", "", attr_name) - + # read json file with open(file) as json_data: data_structure = json.load(json_data) json_data.close() - + # Create an class attribute for that structure setattr(self, attr_name, data_structure) self.reference_items.append(attr_name) return True - - \ No newline at end of file