question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect type in docstring

See original GitHub issue

Sphinx do not use typing, but a more classical system, with built-in types separted with or

Example, this is incorrect: https://github.com/Azure/azure-sdk-for-python/blob/3fdbaa75e5ef2cd9f0151a71992d50d0c7820739/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py#L69-L82

Should be more:

    :type body: str or bytes
    :keyword dict[str,any] application_properties: The user defined properties on the message.
    :keyword dict[str, any] session_id: The session identifier of the message for a sessionful entity.

Can can add or None if the optionality matters, but we should clarify it in the text.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lmazuelcommented, Jan 25, 2022

Short version: just keep it simple and use dict Long version: you can write anything you want as long as you don’t use space, and use [] for generics and or

Optional[Mapping[str,str]]
dict[str,str] or None

But rational is docstring are NOT typing, so you don’t need to restrain yourself to typing, just try to bring clarity for doc reader

0reactions
swathipilcommented, Nov 8, 2022

fix pylance error when # type: ignore is removed from eventhub/_pyamqp/_transport.py line 719 (except (WebSocketTimeoutException, ...) as exc:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to highlight incorrect type references in docstring ...
I'm using 2016.1. Sure, PyCharm highlights misspelled variables and classes, but only in code, not in docstrings. Unfortunately types mentioned ...
Read more >
Type hints in docstrings not handled correctly in combination ...
When using type hints in Python docstrings PyCharm 2020.2 gives false warnings about using the wrong type in combination with Union from pythons...
Read more >
Incorrect type in docstring of add_label method? · Issue #438 · aplpy ...
The type of the relative parameter of the add_label method in aplpy/core.py is given as str, optional in the method's docstring. However, judging...
Read more >
Support for NumPy and Google style docstrings
PEP 484 introduced a standard way to express types in Python code. This is an alternative to expressing types directly in docstrings. One...
Read more >
example_google — Solutions 0.0.1 documentation
[docs]def function_with_types_in_docstring(param1, param2): """Example function with types documented in the docstring. `PEP 484`_ type annotations are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found