diff --git a/docs/notes.md b/docs/notes.md index 1d53f93..f4ce8ee 100644 --- a/docs/notes.md +++ b/docs/notes.md @@ -15,6 +15,10 @@ # ``numerary`` release notes +## [0.4.4](https://github.com/posita/numerary/releases/tag/v0.4.4) + +* Fixes guerrilla patching of ``#!python RationalLikeMethods.__doc__`` to work with ``python -OO`. + ## [0.4.3](https://github.com/posita/numerary/releases/tag/v0.4.3) * Migrates from [``setuptools_scm``](https://pypi.org/project/setuptools-scm/) to [``versioningit``](https://pypi.org/project/versioningit/) for more flexible version number formatting. diff --git a/numerary/types.py b/numerary/types.py index b3d394e..8e4aa72 100644 --- a/numerary/types.py +++ b/numerary/types.py @@ -1313,14 +1313,15 @@ def __hash__(self) -> int: {RationalLikeMixedT!r} """ assert RationalLikeMixedU.__args__ == RationalLikeMixedT # type: ignore [attr-defined] -assert RationalLikeMethods.__doc__ -RationalLikeMethods.__doc__ += rf""" - ``` python - RationalLikeMixedU = {RationalLikeMixedU!r} - RationalLikeMixedT = ({", ".join(cls.__name__ for cls in RationalLikeMixedT)}) - ``` -""" +if RationalLikeMethods.__doc__: + RationalLikeMethods.__doc__ += rf""" + + ``` python + RationalLikeMixedU = {RationalLikeMixedU!r} + RationalLikeMixedT = ({", ".join(cls.__name__ for cls in RationalLikeMixedT)}) + ``` + """ @runtime_checkable diff --git a/setup.cfg b/setup.cfg index 7c680f1..972ae9b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -163,6 +163,9 @@ allowlist_externals = # * # * ignore = - E203, # whitespace before ':' - E501, # line too long (... > ... characters) - W503, # line break occurred before a binary operator + # whitespace before ':' + E203 + # line too long (... > ... characters) + E501 + # line break occurred before a binary operator + W503