Repository navigation
Conversation
AsyncApiClient.get_default does cls._default = ApiClient(), but ApiClient is not imported in the async modules (only AsyncApiClient exists there), so any call to get_default raises NameError: name 'ApiClient' is not defined. The classmethod already receives the right class, so cls() is the fix. The same generated pattern appears in the other v3 async_api_client modules; I can extend this to all of them in this PR if you prefer. Verified with pyflakes: undefined name 'ApiClient' no longer reported. Signed-off-by: Henrique Godoy <95002561+herniqeu@users.noreply.github.com>
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the generated async clients,
get_default()points at a class that does not exist in that module:ApiClientis the sync class name; the async module only definesAsyncApiClient. Any call toget_default()(documented as the way to reuse a default client) raisesNameError: name 'ApiClient' is not defined.Fix
cls._default = cls()— the classmethod already gets the right class.Scope
The same generated pattern exists in the other
linebot/v3/*/async_api_client.pymodules. I kept this PR to one file so the change is trivial to review; say the word and I extend it to all of them, or point me to the generator template if these files are produced from one.Verification
python3 -m pyflakes linebot/v3/audience/async_api_client.py— before:undefined name 'ApiClient'(line 140); after: gone.