Deprecated since 3.13, removed in 3.18. Deprecated in favor of the new type parameter syntax. Use class A[T: (str, bytes)]: ... instead of importing AnyStr. See PEP 695 for more details. In Python 3.16, AnyStr will be removed from typing.__all__, and deprecation warnings will be emitted at runtime when it is accessed or imported from typing. AnyStr will be removed from typing in Python 3.18.