-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
type hint and example out-of-sync #1521
Comments
Hmmmm, sorry I've messed up my description or I'm confused. I'm going to close this and then re-open if I find something real. |
OK, I've updated the description of this issue to include a missing step. Sorry about the confusion. I'm mainly just wondering if MemoryRepo is safe to use with GitClient.fetch. And this might also be a type hint that needs updating. |
It should be safe to use MemoryRepo with GitClient.fetch, and the typehint should just be updated. I don't think we have any explicit tests today that try to use GitClient.fetch with MemoryRepo though. |
Can you send a PR to fix the type hint? |
OK, sounds good. |
The
target
parameter of theGitClient.fetch
method isRepo
:dulwich/dulwich/client.py
Line 925 in 50df0ca
and
porcelain.fetch
calls the above function with therepo
parameter ofporcelain.fetch
dulwich/dulwich/porcelain.py
Line 1750 in 50df0ca
(via
open_repo_closing
which in this case is a no-op passthrough).But the
examples/memoryrepo.py
is using aMemoryRepo
argument for thetarget
parameter:dulwich/examples/memoryrepo.py
Line 20 in 50df0ca
but
MemoryRepo
is not a subclass ofRepo
, only aBaseRepo
. So thisMemoryRepo
object will get passed down intotarget
which is typed to aRepo
.Not sure if this is an issue with the type hint or whether the example is showing something that sometimes fails at runtime.
Is it safe to use a MemoryRepo with GitClient.fetch?
The text was updated successfully, but these errors were encountered: