Lines Matching defs:with
29 import re as stdlib_re # Avoid confusion with the re we export.
259 # `t` might be a tuple, when `ParamSpec` is substituted with
342 """Internal wrapper caching __getitem__ of generic types with a fallback to
367 recursive_guard is used to prevent infinite recursion with a recursive
419 """Mixin to prevent iteration, without being compatible with Iterable.
425 But this would make users of this mixin duck type-compatible with
471 raise TypeError(f"{self} cannot be used with isinstance()")
474 raise TypeError(f"{self} cannot be used with issubclass()")
491 raise TypeError("typing.Any cannot be used with isinstance()")
503 - Any is compatible with every type.
508 static type checkers. At runtime, Any should not be used with instance
605 with LiteralString. This provides a tool to help prevent
626 be used with isinstance() or issubclass().
757 ``Concatenate`` can be sed in conjunction with ``ParamSpec`` and
823 ``TypeGuard`` also works with type variables. For more information, see
996 Type variables defined with covariant=True or contravariant=True
1017 raise TypeError("Constraints cannot be combined with bound=...")
1048 Then we can parameterize that class with an arbitrary number of type
1244 This represents a generic version of type 'origin' with type arguments 'params'.
1301 raise TypeError("Subscripted generics cannot be used with"
1777 this class parameterized with one or more type variables.
1802 do `Foo[int]` - there, with `cls=Foo` and `params=int`.
1805 classes in the first place with `class Foo(Generic[T]): ...`.
1812 # Generic and Protocol can only be subscripted with unique type variables.
1914 # PEP 544 prohibits using issubclass() with protocols that have non-method members.
1983 raise TypeError("Instance and class checks can only be used with"
2009 Such classes are primarily used with static type checkers that recognize
2021 See PEP 544 for details. Protocol classes decorated with
2051 raise TypeError("Instance and class checks can only be used with"
2056 raise TypeError("Protocols with non-method members"
2104 with extra annotations. The alias behaves like a normal typing alias.
2161 - It's an error to call `Annotated` with less than two arguments.
2183 - Annotated cannot be used with an unpacked TypeVarTuple::
2204 "with at least two arguments (a type and an "
2207 raise TypeError("Annotated[...] should not be used with an "
2223 Such protocol can be used with isinstance() and issubclass().
2260 At runtime this does nothing: it returns the first argument unchanged with no
2283 'Annotated[T, ...]' with 'T' (unless 'include_extras=True').
2294 (unless you are familiar with how eval() and exec() work). The
2430 """Get type arguments with all substitutions performed.
2536 This wraps the decorator with something that wraps the decorated
2565 function in a row, each decorated with @overload. For example::
2575 follow it with an implementation. The implementation should *not*
2576 be decorated with @overload. For example::
2665 # A useful type variable with constraints. This represents string types.
2689 The subscription syntax must always be used with exactly two
2764 """An ABC with one abstract method __int__."""
2775 """An ABC with one abstract method __float__."""
2786 """An ABC with one abstract method __complex__."""
2797 """An ABC with one abstract method __bytes__."""
2808 """An ABC with one abstract method __index__."""
2819 """An ABC with one abstract method __abs__ that is covariant in its return type."""
2830 """An ABC with one abstract method __round__ that is covariant in its return type."""
3004 associated with a value of a consistent type. This expectation
3114 """NewType creates simple unique types with almost zero runtime overhead.
3400 Example usage with a decorator function::
3435 be treated by type checkers similarly to classes created with