You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to use the ls() method on a Bucket object obtained from b2sdk.v2.B2Api.get_bucket_by_name(), I encountered a TypeError stating that the Bucket argument type is incompatible with the expected 'Bucket' parameter type. It appears that get_bucket_by_name() may be returning an internal SDK type not intended for direct use, despite being accessed through the public API.
Steps to Reproduce
Setup a basic environment with b2sdk.v2 configured with valid Backblaze B2 credentials.
Fetch a Bucket using B2Api.get_bucket_by_name().
Attempt to list directories or files using the Bucket.ls() method.
Observe the TypeError related to incompatible type assignment.
Expected Behavior
The Bucket object returned from get_bucket_by_name() should be fully compatible with other methods expecting a Bucket type as defined in the b2sdk.v2 public API.
Actual Behavior
A TypeError is raised suggesting type incompatibility, indicating possible exposure of internal types in what should be a public API method.
Environment
Python version: 3.12
b2sdk version: 2.1
Additional Context
This issue seems to stem from recent changes in the SDK where non-api packages were moved to b2sdk._internal as noted in the changelog for version 2.0.0. It would be helpful to confirm whether get_bucket_by_name() should return a type from b2sdk.v2 or if there's a recommended workaround for this type mismatch.
This looks type checker specific and not like a runtime problem that will prevent you from running your application.
The recommended workaround right now is to disable type checking in such cases.
It is unlikely this issue is specific to b2sdk>=2, as this is more of problem of IDE understanding ApiVer modules and wrappers which are in b2sdk for a long time already.
While we do try to use type hints, we currently cannot declare that it will work properly with all of type checkers available for Python.
If you wish for your type checker of choice to be supported, please make sure to report the exact version and way of running it, that way we will be able to see how much interests is there in support such configuration among b2 users community.
@patrickwasp are you still experiencing this issue?
I tried to reproduce it using both the recent sdk version and the one you specified (2.1), but wasn't able to.
Issue Description
When attempting to use the
ls()
method on aBucket
object obtained fromb2sdk.v2.B2Api.get_bucket_by_name()
, I encountered a TypeError stating that theBucket
argument type is incompatible with the expected 'Bucket' parameter type. It appears thatget_bucket_by_name()
may be returning an internal SDK type not intended for direct use, despite being accessed through the public API.Steps to Reproduce
Bucket
usingB2Api.get_bucket_by_name()
.Bucket.ls()
method.Expected Behavior
The
Bucket
object returned fromget_bucket_by_name()
should be fully compatible with other methods expecting aBucket
type as defined in theb2sdk.v2
public API.Actual Behavior
A TypeError is raised suggesting type incompatibility, indicating possible exposure of internal types in what should be a public API method.
Environment
Additional Context
This issue seems to stem from recent changes in the SDK where non-api packages were moved to
b2sdk._internal
as noted in the changelog for version 2.0.0. It would be helpful to confirm whetherget_bucket_by_name()
should return a type fromb2sdk.v2
or if there's a recommended workaround for this type mismatch.The text was updated successfully, but these errors were encountered: