doc-builder
doc-builder copied to clipboard
Replace inequality with non-identity for inspect._empty
The inspect package uses is/is not (instead of ==/!=) with inspect._empty:
- This is useful because the user might override
__eq__/__ne__(with unexpected behavior). - For singletons,
is/is notguarantees comparison based on object identity.
See examples in inspect:
- https://github.com/python/cpython/blob/3.10/Lib/inspect.py#L2635
- https://github.com/python/cpython/blob/3.10/Lib/inspect.py#L2643
Note I discovered this issue because of datasets.Version. I am also proposing an improvement in its implementation, but I think this PR makes sense anyway.
The CI issue: https://github.com/huggingface/doc-builder/runs/6452663012?check_suite_focus=true
src/doc_builder/__init__.py:23: in <module>
from .build_doc import build_doc
src/doc_builder/build_doc.py:30: in <module>
from .convert_to_notebook import generate_notebooks_from_file
src/doc_builder/convert_to_notebook.py:20: in <module>
import nbformat
/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/nbformat/__init__.py:9: in <module>
from traitlets.log import get_logger
/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/traitlets/__init__.py:5: in <module>
from ._version import __version__, version_info
/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/traitlets/_version.py:8: in <module>
".".join(map(str, version_info)).replace(".b", "b").replace(".a", "a").replace(".rc", "rc")
E AssertionError
has to do with the update of traitlets (from 5.2.0 to 5.2.1):
- ipython/traitlets#729