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

Wrong return type in doc creation docstrings, provides incorrect guidance to type checkers #18

Open
bennylope opened this issue Sep 15, 2023 · 0 comments

Comments

@bennylope
Copy link

The DocApi.create_doc() method's docstring includes the wrong return type:

:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: str

Similarly for DocApi.create_doc_with_http_info:

:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))

The correct return type here are bytes and tuple(bytes, status_code(int), headers(HTTPHeaderDict)), respectively.

Since Python 3, str is reserved for unicode strings, not the byte strings return by HTTP calls.

I know a picture isn't proof but absent a share environment, here's the best I can do.

CleanShot 2023-09-15 at 16 07 57@2x

Why does this matter?

It doesn't affect the working of the library, but it does anyone using any type checking or type hints, e.g. PyCharm below:

CleanShot 2023-09-15 at 16 01 48@2x
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

1 participant