summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Regier <garrettregier@gmail.com>2015-03-29 20:30:46 -0700
committerGarrett Regier <gregier@garrett.regier>2015-04-21 11:39:27 -0400
commit87e18684811beff76c9f46c0e7698ef4b3abe460 (patch)
tree956df86cab7b1504e4e78d7a50c689c38ff638fd
parentbf58b9ca98c7bde43aea9fc41edc8c131121f746 (diff)
downloadlibpeas-87e18684811beff76c9f46c0e7698ef4b3abe460.tar.gz
Simplify __all__ support in the Python plugin loader
No need to catch the AttributeError, instead simply use getattr with a default value.
-rw-r--r--loaders/python/peas-python-internal.py8
1 files changed, 1 insertions, 7 deletions
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: