Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/cattrs/literals.py: 71%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from enum import Enum
2from typing import Any
4from ._compat import is_literal
6__all__ = ["is_literal", "is_literal_containing_enums"]
9def is_literal_containing_enums(type: Any) -> bool:
10 """Is this a literal containing at least one Enum?"""
11 return is_literal(type) and any(isinstance(val, Enum) for val in type.__args__)