From 03a1887c0bf9474e66c29fca579e96889ed8b68d Mon Sep 17 00:00:00 2001 From: Paulina Khew Date: Mon, 8 Feb 2021 10:58:16 -0500 Subject: [PATCH 1/4] Fix 'object of type "filter" has no len()' issue --- scripts/shopify_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/shopify_api.py b/scripts/shopify_api.py index 60f48065..e73f8fc9 100755 --- a/scripts/shopify_api.py +++ b/scripts/shopify_api.py @@ -51,7 +51,7 @@ def run_task(cls, task=None, *args): # Allow unambigious abbreviations of tasks if task not in cls._tasks: - matches = filter(lambda item: item.startswith(task), cls._tasks) + matches = list(filter(lambda item: item.startswith(task), cls._tasks)) if len(matches) == 1: task = matches[0] else: From c28ca0538614fe08323708327481e4c0285ec60b Mon Sep 17 00:00:00 2001 From: Paulina Khew Date: Mon, 8 Feb 2021 11:59:37 -0500 Subject: [PATCH 2/4] Try to fix python 3.6 issue --- scripts/shopify_api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/shopify_api.py b/scripts/shopify_api.py index e73f8fc9..5a448743 100755 --- a/scripts/shopify_api.py +++ b/scripts/shopify_api.py @@ -51,9 +51,9 @@ def run_task(cls, task=None, *args): # Allow unambigious abbreviations of tasks if task not in cls._tasks: - matches = list(filter(lambda item: item.startswith(task), cls._tasks)) - if len(matches) == 1: - task = matches[0] + matches = filter(lambda item: item.startswith(task), cls._tasks) + if len(list(matches)) == 1: + task = list(matches)[0] else: sys.stderr.write('Could not find task "%s".\n' % (task)) From 4fad266cc0951034e4998c0e08ca904a693ea819 Mon Sep 17 00:00:00 2001 From: Paulina Khew Date: Mon, 8 Feb 2021 12:06:39 -0500 Subject: [PATCH 3/4] Update CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index c5ce222d..795baab5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ - Added support for Fulfillment.update_tracking ([#432](https://github.com/Shopify/shopify_python_api/pull/432)) - Add FulfillmentEvent resource ([#454](https://github.com/Shopify/shopify_python_api/pull/454)) +- Fix for being unable to get the len() of a filter ([#456](https://github.com/Shopify/shopify_python_api/pull/456)) == Version 8.2.0 - [Feature] Add support for Dynamic API Versioning. When the library is initialized, it will now make a request to From f2202c72e0016dab8495a56be5569944f1011059 Mon Sep 17 00:00:00 2001 From: Paulina Khew Date: Mon, 8 Feb 2021 12:09:57 -0500 Subject: [PATCH 4/4] Avoid duplicate type change to list --- scripts/shopify_api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/shopify_api.py b/scripts/shopify_api.py index 5a448743..75c8acc7 100755 --- a/scripts/shopify_api.py +++ b/scripts/shopify_api.py @@ -52,8 +52,9 @@ def run_task(cls, task=None, *args): # Allow unambigious abbreviations of tasks if task not in cls._tasks: matches = filter(lambda item: item.startswith(task), cls._tasks) - if len(list(matches)) == 1: - task = list(matches)[0] + list_of_matches = list(matches) + if len(list_of_matches) == 1: + task = list_of_matches[0] else: sys.stderr.write('Could not find task "%s".\n' % (task))