(
cls,
classname: str,
bases: Tuple[Type[Any], ...],
dict_: Dict[str, Any],
**kw: Any,
)
| 1728 | |
| 1729 | class _IntFlagMeta(type): |
| 1730 | def __init__( |
| 1731 | cls, |
| 1732 | classname: str, |
| 1733 | bases: Tuple[Type[Any], ...], |
| 1734 | dict_: Dict[str, Any], |
| 1735 | **kw: Any, |
| 1736 | ) -> None: |
| 1737 | items: List[symbol] |
| 1738 | cls._items = items = [] |
| 1739 | for k, v in dict_.items(): |
| 1740 | if re.match(r"^__.*__$", k): |
| 1741 | continue |
| 1742 | if isinstance(v, int): |
| 1743 | sym = symbol(k, canonical=v) |
| 1744 | elif not k.startswith("_"): |
| 1745 | raise TypeError("Expected integer values for IntFlag") |
| 1746 | else: |
| 1747 | continue |
| 1748 | setattr(cls, k, sym) |
| 1749 | items.append(sym) |
| 1750 | |
| 1751 | cls.__members__ = _collections.immutabledict( |
| 1752 | {sym.name: sym for sym in items} |
| 1753 | ) |
| 1754 | |
| 1755 | def __iter__(self) -> Iterator[symbol]: |
| 1756 | raise NotImplementedError( |
nothing calls this directly
no test coverage detected