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

Type hints for snmp error handling function is incorrect #82

Open
stveit opened this issue Oct 6, 2023 · 0 comments
Open

Type hints for snmp error handling function is incorrect #82

stveit opened this issue Oct 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@stveit
Copy link
Contributor

stveit commented Oct 6, 2023

The current _handle_errors looks like this:

def _handle_errors(self, error_indication: str, error_status: str, error_index: int, *query: ObjectType) -> bool:

The values that are supposed to be put into this function are the return values from any of the pysnmp command functions (getCmd, bulkCmd etc). The typehints you see above are correct if you compare them to the docstring of these functions.

I am however pretty certain that the docstrings are outdated. I know for a fact that error_indication can be a pysnmp.proto.errind.RequestTimedOut object (see #76). This is a subclass of the errind.ErrorIndication class, so logically the error_indication value can probably be any type of errind.ErrorIndication. From examples online, I've seen that the value can also be None, but I have not seen any examples of it actually returning a str.

I've also seen error_status return an int, but I can't recall seeing it return a str as the docstring states it should.

@lunkwill42 lunkwill42 added the bug Something isn't working label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants