From 87e18684811beff76c9f46c0e7698ef4b3abe460 Mon Sep 17 00:00:00 2001 From: Garrett Regier Date: Sun, 29 Mar 2015 20:30:46 -0700 Subject: Simplify __all__ support in the Python plugin loader No need to catch the AttributeError, instead simply use getattr with a default value. --- loaders/python/peas-python-internal.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'loaders') diff --git a/loaders/python/peas-python-internal.py b/loaders/python/peas-python-internal.py index 1f96ee1..f8881b5 100644 --- a/loaders/python/peas-python-internal.py +++ b/loaders/python/peas-python-internal.py @@ -130,13 +130,7 @@ class Hooks(object): except KeyError: pass - try: - keys = module.__all__ - - except AttributeError: - keys = module.__dict__ - - for key in keys: + for key in getattr(module, '__all__', module.__dict__): value = getattr(module, key) try: -- cgit v1.2.1