-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
botostubs showing details for get_paginator, but not actual api call #10
Comments
Hello Julio, paginator = org_client.get_paginator("list_policies") # type: botostubs.Organizations.ListPoliciesPaginator |
Let me know if I misunderstood your question |
Will test that out. However, I would prefer it would figure that out automatically, without me having to add separate type hints everywhere I use paginators. For instance, when doing calls without paginating, I don't have to add separate type hints, just having the main type hint when I declare the client, is sufficient. |
org_client = boto3.client("organizations") # type: botostubs.Organizations Example where it works nicely (without paginators), without me adding type hints to each API call |
it be great, if botostubs handled that automatically, whenever it saw "get_paginator" being used. Other reason why its helpful, is so that its easy to comment out botostubs when no longer needed, or being deployed as a solution. Only have to comment the import line and the type hints in the client lines. If I have to add this for paginators separately, that is more lines to add comments too. On another note, put in another ticket I think, to see if there is a method to use botostubs, without having to add type hints at all to each line, instead import botostubs, and then all works. that would be sweet. I primarily use Visual Studio Code, fyi. |
Yeah but I only included type hints that will work in many IDEs. Such feature that you're describing needs expertise on IDE-specific plugin dev which I don't have.
Instead of commenting it, I suggest you write it like this: try:
import botostubs
except:
pass
If you're using the type hints as comments, then you don't need to comment them, right? |
try/except worked out great. errors I was still getting was my linters, and doing try/except got rid of those errors too. I was thinking something like function overloads, similar to boto3-stubs (https://pypi.org/project/boto3-stubs/), and it doesn't require any IDE extensions to make it work. Or using pylance that just got released by microsoft visual studio code, where you can point at stubs in a directory, and it dynamically reads it. Just thoughts. thanks for the help. much appreciated. |
botostubs type hinting, hover for get_paginator works fine. hover over "list_policies" doesn't work. autocomplete where "list_policies" doesn't work. It be nice if botostubs can be updated to handle things, when we have to use pagination.
`
import boto3
import botostubs
org_client = boto3.client("organizations") # type: botostubs.Organizations
def get_policies(filter):
paginator = org_client.get_paginator("list_policies")
policies = []
for page in paginator.paginate(Filter=filter):
policies.extend(page.get("Policies"))
return policies
`
The text was updated successfully, but these errors were encountered: