-
Notifications
You must be signed in to change notification settings - Fork 482
Async for files.py functions #586
base: main
Are you sure you want to change the base?
Conversation
| yield file_types.File(proto) | ||
|
|
||
|
|
||
| async def list_files_async(*args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will fail because we want an async iterator to be returned here.
Can you copy the list_files code and add the missing asyncs?
|
|
||
|
|
||
| async def get_file_async(*args, **kwargs): | ||
| return await asyncio.to_thread(get_file, *args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an async client, we should use it. Let's copy-paste the code, and add the missing asyncs
| client.delete_file(request=request) | ||
|
|
||
|
|
||
| async def delete_file_async(*args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
| # [END files_delete] | ||
|
|
||
|
|
||
| class AsyncTests(absltest.TestCase, unittest.IsolatedAsyncioTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test all the methods, I think list is broken right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When sieving through the code I saw that the SDK does have a FileServiceAsyncClient class in client.py, but there are no corresponding async examples in the samples/files.py file. There is missing AsyncTests class with async test method for checking the list. If the issue is open I would love to work on this.
|
Is this issue open? |
Added
asynciomethods for all the file methods.However, how should we test these
asynciomethods?