Skip to content
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

Missing type definition on dulwich.client.get_ssh_vendor #1471

Open
aph3rson opened this issue Dec 24, 2024 · 1 comment
Open

Missing type definition on dulwich.client.get_ssh_vendor #1471

aph3rson opened this issue Dec 24, 2024 · 1 comment

Comments

@aph3rson
Copy link

Wtihin dulwich.client, the get_ssh_vendor attribute is designed to be overridden by library callers:

dulwich/dulwich/client.py

Lines 2104 to 2105 in 1c07def

# Can be overridden by users
get_ssh_vendor = SubprocessSSHVendor

A common example of this is for using Paramiko, where the ParamikoSSHVendor docs specifically instruct users to change this attribute:

To use this implementation as the SSH implementation in Dulwich, override
the dulwich.client.get_ssh_vendor attribute:
>>> from dulwich import client as _mod_client
>>> from dulwich.contrib.paramiko_vendor import ParamikoSSHVendor
>>> _mod_client.get_ssh_vendor = ParamikoSSHVendor

However, there's no typing on get_ssh_vendor, which causes mypy to complain about the variable being assigned to another (thought-to-be-incompatible) type:

/my/module.py:92: error:
Incompatible types in assignment (expression has type
[ParamikoSSHVendor] "type", variable has type "type[SubprocessSSHVendor]")
[assignment]
            dulwich.client.get_ssh_vendor = ParamikoSSHVendor
                                            ^~~~~~~~~~~~~~~~~

Presumably, this should be typed to SSHVendor, given that anything assigned to that attribute needs to implement that class.

@jelmer
Copy link
Owner

jelmer commented Dec 25, 2024

Can you submit a PR to address this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants