Skip to content

Conversation

shilpakancharla
Copy link
Collaborator

Added asyncio methods for all the file methods.

However, how should we test these asyncio methods?

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels Oct 5, 2024
yield file_types.File(proto)


async def list_files_async(*args, **kwargs):
Copy link
Collaborator

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)
Copy link
Collaborator

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):
Copy link
Collaborator

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):
Copy link
Collaborator

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.

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.

@demoncoder-crypto
Copy link

Is this issue open?

@Annhiluc Annhiluc added type:feature request New feature request/enhancement status:triaged Issue/PR triaged to the corresponding sub-team p3 labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:python sdk Issue/PR related to Python SDK p3 status:awaiting review PR awaiting review from a maintainer status:triaged Issue/PR triaged to the corresponding sub-team type:feature request New feature request/enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants