Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f33f47c2b3 |
|||
|
ddf310d3ad |
|||
|
281a8f383e |
|||
|
ff6e13e09f |
1 changed files with 7 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Generic, Iterable, TypeVar, override
|
||||
from typing import TYPE_CHECKING, Any, Generic, Iterable, TypeGuard, TypeVar, override
|
||||
|
||||
from .log import ERR, OFF, log, parse_log_level
|
||||
|
||||
|
|
@ -15,6 +15,9 @@ if TYPE_CHECKING:
|
|||
|
||||
T = TypeVar('T')
|
||||
|
||||
def is_abc_class(c: type[object]) -> TypeGuard[abc.ABCMeta]:
|
||||
return isinstance(c, abc.ABCMeta)
|
||||
|
||||
class Types(abc.ABC, Iterable[type[T]], Generic[T]): # export
|
||||
|
||||
@override
|
||||
|
|
@ -101,6 +104,9 @@ class LoadTypes(Types[T]): # export
|
|||
if rx is not None and not re.match(rx, member_name):
|
||||
self._debug(f'o "{name}" has wrong name')
|
||||
continue
|
||||
if not is_abc_class(c):
|
||||
self._debug(f'o "{name}" is not derived from ABCMeta')
|
||||
continue
|
||||
if inspect.isabstract(c):
|
||||
self._debug(f'o "{name}" is abstract: {c.__abstractmethods__}')
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue