Brian Skinn <bsk...@alum.mit.edu> added the comment:
If I understand the problem correctly, these mis-attributions of roles (to 'data' instead of 'class' come about when a thing that is technically a class is defined in source using simple assignment, as with UnionType. Problematic entries will thus have 'data' as role, and their identifiers will be camel-cased. So, as a quick search to identify likely candidates: >>> import re, sphobjinv as soi >>> from pprint import pprint >>> inv = soi.Inventory(url="https://docs.python.org/3.10/objects.inv") # Find entries where the first character after the final period # is uppercase, and the second character after the final period # is lowercase. >>> pat = re.compile(r"([.][A-Z][a-z])[^.]*$") >>> pprint([obj.name for obj in inv.objects if obj.role == "data" and >>> pat.search(obj.name)]) ['_thread.LockType', 'ast.PyCF_ALLOW_TOP_LEVEL_AWAIT', 'ast.PyCF_ONLY_AST', 'ast.PyCF_TYPE_COMMENTS', 'importlib.resources.Package', 'importlib.resources.Resource', 'socket.SocketType', 'types.AsyncGeneratorType', 'types.BuiltinFunctionType', 'types.BuiltinMethodType', 'types.CellType', 'types.ClassMethodDescriptorType', 'types.CoroutineType', 'types.EllipsisType', 'types.FrameType', 'types.FunctionType', 'types.GeneratorType', 'types.GetSetDescriptorType', 'types.LambdaType', 'types.MemberDescriptorType', 'types.MethodDescriptorType', 'types.MethodType', 'types.MethodWrapperType', 'types.NoneType', 'types.NotImplementedType', 'types.UnionType', 'types.WrapperDescriptorType', 'typing.Annotated', 'typing.Any', 'typing.AnyStr', 'typing.Callable', 'typing.ClassVar', 'typing.Concatenate', 'typing.Final', 'typing.Literal', 'typing.NoReturn', 'typing.Optional', 'typing.ParamSpecArgs', 'typing.ParamSpecKwargs', 'typing.Tuple', 'typing.TypeAlias', 'typing.TypeGuard', 'typing.Union', 'weakref.CallableProxyType', 'weakref.ProxyType', 'weakref.ProxyTypes', 'weakref.ReferenceType'] I would guess those 'ast.PyCF...' objects can be ignored, they appear to be constants? ---------- nosy: +bskinn _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45391> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com