[libpeas] Simplify __all__ support in the Python plugin loader



commit 87e18684811beff76c9f46c0e7698ef4b3abe460
Author: Garrett Regier <garrettregier gmail com>
Date:   Sun Mar 29 20:30:46 2015 -0700

    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 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:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]