From d0903a2a49b8d038082f5754011173f9ce7d2e07 Mon Sep 17 00:00:00 2001 From: Sriharivignesh Date: Mon, 1 May 2017 15:31:34 -0700 Subject: [PATCH 1/5] Add check to exclude hidden files --- eventhandler.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/eventhandler.py b/eventhandler.py index cfd91f4..51cff7d 100644 --- a/eventhandler.py +++ b/eventhandler.py @@ -60,12 +60,13 @@ def get_handlers(): handlers = [] possible_handlers = os.listdir('handlers') for i in possible_handlers: - location = os.path.join('handlers', i) - try: - module = imp.load_module('handlers.' + i, None, location, + if not i.startswith('.'): + location = os.path.join('handlers', i) + try: + module = imp.load_module('handlers.' + i, None, location, ('', '', imp.PKG_DIRECTORY)) - handlers.append(module.handler_interface()) - modules.append((module, location)) - except ImportError: - pass + handlers.append(module.handler_interface()) + modules.append((module, location)) + except ImportError: + pass return (modules, handlers) From ef3d15b7faabbe06a56a4cef6f53eb03f82cfa29 Mon Sep 17 00:00:00 2001 From: Sriharivignesh Date: Mon, 1 May 2017 15:41:52 -0700 Subject: [PATCH 2/5] Fixed line indentation for flake8 --- eventhandler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eventhandler.py b/eventhandler.py index 51cff7d..396a41a 100644 --- a/eventhandler.py +++ b/eventhandler.py @@ -63,8 +63,8 @@ def get_handlers(): if not i.startswith('.'): location = os.path.join('handlers', i) try: - module = imp.load_module('handlers.' + i, None, location, - ('', '', imp.PKG_DIRECTORY)) + module = imp.load_module('handlers.' + i, None, location, + ('', '', imp.PKG_DIRECTORY)) handlers.append(module.handler_interface()) modules.append((module, location)) except ImportError: From 7e1efed31ff6065f6f552b598839185ad09aa4a4 Mon Sep 17 00:00:00 2001 From: Sriharivignesh Date: Mon, 1 May 2017 15:44:47 -0700 Subject: [PATCH 3/5] Flake8 appeasement --- eventhandler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eventhandler.py b/eventhandler.py index 396a41a..32f5739 100644 --- a/eventhandler.py +++ b/eventhandler.py @@ -63,8 +63,8 @@ def get_handlers(): if not i.startswith('.'): location = os.path.join('handlers', i) try: - module = imp.load_module('handlers.' + i, None, location, - ('', '', imp.PKG_DIRECTORY)) + module = imp.load_module('handlers.' + i, None, location, + ('', '', imp.PKG_DIRECTORY)) handlers.append(module.handler_interface()) modules.append((module, location)) except ImportError: From 137e41b67a4c74d8be6c82dff04c6379ab43f1ae Mon Sep 17 00:00:00 2001 From: Sriharivignesh Date: Mon, 1 May 2017 16:02:31 -0700 Subject: [PATCH 4/5] Flake8 appeasement --- eventhandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eventhandler.py b/eventhandler.py index 32f5739..cfed43e 100644 --- a/eventhandler.py +++ b/eventhandler.py @@ -64,7 +64,7 @@ def get_handlers(): location = os.path.join('handlers', i) try: module = imp.load_module('handlers.' + i, None, location, - ('', '', imp.PKG_DIRECTORY)) + ('', '', imp.PKG_DIRECTORY)) handlers.append(module.handler_interface()) modules.append((module, location)) except ImportError: From de24cc57794b065a5497d6c3e9b444898939ac7f Mon Sep 17 00:00:00 2001 From: Sriharivignesh Date: Mon, 1 May 2017 16:07:27 -0700 Subject: [PATCH 5/5] flake8 appeasement --- eventhandler.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/eventhandler.py b/eventhandler.py index cfed43e..a33db34 100644 --- a/eventhandler.py +++ b/eventhandler.py @@ -60,13 +60,14 @@ def get_handlers(): handlers = [] possible_handlers = os.listdir('handlers') for i in possible_handlers: - if not i.startswith('.'): - location = os.path.join('handlers', i) - try: - module = imp.load_module('handlers.' + i, None, location, - ('', '', imp.PKG_DIRECTORY)) - handlers.append(module.handler_interface()) - modules.append((module, location)) - except ImportError: - pass + if i.startswith('.'): + continue + location = os.path.join('handlers', i) + try: + module = imp.load_module('handlers.' + i, None, location, + ('', '', imp.PKG_DIRECTORY)) + handlers.append(module.handler_interface()) + modules.append((module, location)) + except ImportError: + pass return (modules, handlers)