lib.Types: Restrict LoadTypes to ABC-derived classes #90
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/feature/20260907-lib-types-restrict-loadtypes-to-abc-derived-classes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
lib.Types: Restrict LoadTypes to ABC-derived classes
The previous commit reads
__abstractmethods__via agetattr()with an empty frozenset fallback, because in mypy 2.3.1 the scanned classes are typed astype[object], which does not declare the attribute.Add
is_abc_class()as aTypeGuard, and skip the classes it rejects with a debug line: LoadTypes now yields only ABC-derived classes. The guard narrows to the classes that carry the attribute, so that the debug line can now read__abstractmethods__directly.The command loaders are unaffected: every class they load is derived from AbstractCmd, and hence from ABC. For loads that rely on the name filter alone, plain classes are now skipped instead of being yielded.