From a9b64432a59d6ea6921dd94b4cbcde0cf4971e05 Mon Sep 17 00:00:00 2001 From: Matthias Adler Date: Thu, 9 May 2019 12:58:59 +0200 Subject: [PATCH] chore: rename arguments 'async' to 'is_async' Improve python 3.7 compatibility by not using the same symbol name as the upcoming reserved word `async`. Fixes notices like this one: `DeprecationWarning: 'async' and 'await' will become reserved keywords in Python 3.7` --- facebook_business/asyncobjects.py | 16 ++++++++-------- facebook_business/asyncobjects/__init__.py | 16 ++++++++-------- facebook_business/test/async_adaccount_docs.py | 2 +- facebook_business/test/async_insights_docs.py | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/facebook_business/asyncobjects.py b/facebook_business/asyncobjects.py index 8d5a52c0..8799c161 100644 --- a/facebook_business/asyncobjects.py +++ b/facebook_business/asyncobjects.py @@ -705,9 +705,9 @@ def get_custom_conversions_aio(self, fields=None, params=None, limit=1000): def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None, has_filters=False, for_date=None): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that @@ -748,9 +748,9 @@ def get_ads_aio(self, fields=None, params=None, limit=1000): def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None, for_date=None): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that @@ -783,9 +783,9 @@ def get_ad_creatives_aio(self, fields=None, params=None, limit=1000): def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that @@ -894,9 +894,9 @@ def get_leads_aio(self, fields=None, params=None, limit=1000): def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that diff --git a/facebook_business/asyncobjects/__init__.py b/facebook_business/asyncobjects/__init__.py index 0dbcd9d4..56bb0db1 100644 --- a/facebook_business/asyncobjects/__init__.py +++ b/facebook_business/asyncobjects/__init__.py @@ -146,9 +146,9 @@ def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None, has_filters=False, for_date=None, needs_carousel_name=False): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that @@ -183,9 +183,9 @@ def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None, has_filters=False, for_date=None, needs_carousel_name=False): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that @@ -220,9 +220,9 @@ def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None, has_filters=False, for_date=None, needs_carousel_name=False): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that @@ -342,9 +342,9 @@ def get_insights_aio(self, fields=None, params=None, limit=1000, is_async=False, has_action=None, needs_action_device=None, has_filters=False, for_date=None, needs_carousel_name=False): """ - If async is False, returns EdgeIterator. + If 'is_async' is False, returns EdgeIterator. - If async is True, creates a job and job iterator for it and + If 'is_async' is True, creates a job and job iterator for it and returns the job iterator (AsyncAioJobIterator class, subclass of EdgeIterator). Regardless the async parameter, it puts the iterator to the queue so that diff --git a/facebook_business/test/async_adaccount_docs.py b/facebook_business/test/async_adaccount_docs.py index d2c857d2..e7adc8ee 100644 --- a/facebook_business/test/async_adaccount_docs.py +++ b/facebook_business/test/async_adaccount_docs.py @@ -44,7 +44,7 @@ def test_get_insights_async(self): ], params={ 'level': Insights.Level.campaign, 'date_preset': Insights.Preset.last_week, - }, async=True) + }, is_async=True) while not job: time.sleep(0.3) job.remote_read() diff --git a/facebook_business/test/async_insights_docs.py b/facebook_business/test/async_insights_docs.py index f612b89d..8bc1f1d3 100644 --- a/facebook_business/test/async_insights_docs.py +++ b/facebook_business/test/async_insights_docs.py @@ -28,7 +28,7 @@ def test_get_insights_async(self): ], params={ 'level': Insights.Level.campaign, 'date_preset': Insights.Preset.last_week, - }, async=True) + }, is_async=True) while not job: time.sleep(0.3) job.remote_read()