You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2019/06/28 21:09:10 UTC

[libcloud] 01/02: Fix predicate method so it also works on older Python version.

This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 8d814f4cf7d2a456c9d9127868eef1a498982f84
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 23:06:41 2019 +0200

    Fix predicate method so it also works on older Python version.
---
 contrib/generate_provider_feature_matrix_table.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/contrib/generate_provider_feature_matrix_table.py b/contrib/generate_provider_feature_matrix_table.py
index f74374a..57bb6e4 100755
--- a/contrib/generate_provider_feature_matrix_table.py
+++ b/contrib/generate_provider_feature_matrix_table.py
@@ -287,10 +287,14 @@ def generate_providers_table(api):
         if name.lower() in IGNORED_PROVIDERS:
             continue
 
+        def is_function_or_method(*args, **kwargs):
+            return (inspect.isfunction(*args, **kwargs) or
+                    inspect.ismethod(*args, **kwargs))
+
         driver_methods = dict(inspect.getmembers(cls,
-                                                 predicate=inspect.ismethod))
+                                                 predicate=is_function_or_method))
         base_methods = dict(inspect.getmembers(driver,
-                                               predicate=inspect.ismethod))
+                                               predicate=is_function_or_method))
         base_api_methods = BASE_API_METHODS[api]
 
         result[name] = {'name': cls.name, 'website': cls.website,
@@ -299,6 +303,8 @@ def generate_providers_table(api):
                         'cls': cls,
                         'methods': {}}
 
+        print('Generating tables for provider: %s' % (name))
+
         for method_name in base_api_methods:
             base_method = base_methods[method_name]
             driver_method = driver_methods[method_name]