From 914d8ccb42befc04ec5b759dd84b242591bb5e91 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Mon, 5 Mar 2018 11:25:44 -0500 Subject: Enforce most pep8 compliance in tox Also fix some pep8 failings Change-Id: I6904c171c898d510ac2b7e2435b5a80dcdf1be13 Issue-ID: DCAEGEN2-348 Signed-off-by: Tommy Carpenter --- config_binding_service/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'config_binding_service/__init__.py') diff --git a/config_binding_service/__init__.py b/config_binding_service/__init__.py index 5f09f1e..2835511 100644 --- a/config_binding_service/__init__.py +++ b/config_binding_service/__init__.py @@ -19,7 +19,7 @@ import os import logging -'''Configures the module root logger''' +# Configures the module root logger root = logging.getLogger() if root.handlers: root.handlers.clear() @@ -29,13 +29,19 @@ handler.setFormatter(formatter) root.addHandler(handler) root.setLevel("DEBUG") + class BadEnviornmentENVNotFound(Exception): + """ + Specific exception to be raised when a required ENV varaible is missing + """ pass + def get_logger(module=None): '''Returns a module-specific logger or global logger if the module is None''' return root if module is None else root.getChild(module) + def get_consul_uri(): """ This method waterfalls reads an envioronmental variable called CONSUL_HOST @@ -48,5 +54,3 @@ def get_consul_uri(): return "http://{0}:{1}".format(os.environ["CONSUL_HOST"], 8500) else: raise BadEnviornmentENVNotFound("CONSUL_HOST") - - -- cgit 1.2.3-korg