You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
I have read and followed the docs and still think this is a bug
Description
This commit introduced a check to verify that DocList is not used with an object:
if (
isinstance(item, object)
and not is_typevar(item)
and not isinstance(item, str)
and item is not Any
):
raise TypeError('Expecting a type, got object instead')
This is quite a broad condition (it breaks things like DocList[TorchTensor], or nested DocList[DocList[...]] for me for instance) as:
Almost everything will be an object so the first line if almost a catch-all.
is_typevar only checks for TypeVar objects.
Should this not check as well for something not isinstance(item, type) instead of not is_typevar to allow for classes ?
This way only non class objects (like instances of class object that are not classes themselves) will raise the TypeError.
Activity
JoanFM commentedon Oct 30, 2023
Hello @corentinmarek,
It would be very helpful if you could provide a draft PR with your idea for a better implementatiom of this.
corentinmarek commentedon Oct 31, 2023
👍: #1829. Waiting for checks.
JoanFM commentedon Oct 31, 2023
However, I am not sure
DocList[TorchTensor]andDocList[DocList[...]]will work as now, because they are notBaseDoc