def format_unit(value, unit):
"""
Formats the given value as a human readable string using the given units.
:param float|int value: a numeric value
:param str unit: the unit for the value (kg, m, etc.)
:rtype: str
"""
return f"{value} {unit}"
We produce this
from typing import Union
def format_unit(value: Union[float, int], unit: str) -> str:
"""
Formats the given value as a human readable string using the given units.
:param value: a numeric value
:param unit: the unit for the value (kg, m, etc.)
"""
return f"{value} {unit}"
I would also like a flag that disables types for parameters / return types (especially for Google style docstrings), so that sphinx-autodoc-typehints can do its thing.
https://pypi.org/project/sphinx-autodoc-typehints/
Instead of
We produce this
wdyt