Lines Matching refs:str

9   All subscripted types like X[int], Union[int, str] are generic aliases.
163 if isinstance(arg, str):
173 special forms like Union are not valid, while Union[int, str] is OK, etc.
212 collections.abc.Callable[[int, int], str].__args__ == (int, int, str)
213 collections.abc.Callable[ParamSpec, str].__args__ == (ParamSpec, str)
375 ForwardRef(arg) if isinstance(arg, str) else arg
551 def int_or_str(arg: int | str) -> None:
556 case str():
557 print("It's a str")
595 def caller(arbitrary_string: str, literal_string: LiteralString) -> None:
620 stats: ClassVar[Dict[str, int]] = {} # class variable
661 To define a union, use e.g. Union[int, str]. Details:
667 assert Union[Union[int, str], float] == Union[int, str, float]
675 assert Union[int, str, int] == Union[int, str]
679 assert Union[int, str] == Union[str, int]
716 def open_helper(file: str, mode: MODE) -> str:
807 def is_str(val: Union[str, float]):
809 if isinstance(val, str):
810 # Type of ``val`` is narrowed to ``str``
819 narrowing ``List[object]`` to ``List[str]`` even though the latter is not
839 if not isinstance(arg, str):
974 A = TypeVar('A', str, bytes) # Must be str or bytes
990 of (str, str) -> str and (bytes, bytes) -> bytes. Also note
991 that if the arguments are instances of some subclass of str,
992 the return type is still plain str.
1007 A.__constraints__ == (str, bytes)
1052 C[int, str] # Also fine
1229 # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
1414 # C = B[str]
1415 # `B.__args__` is `(int, T3)`, so `C.__args__` should be `(int, str)`.
1421 # In the example above, this would be {T3: str}
1460 # C = Callable[[int], str]
1461 # Here, `C.__args__` should be (int, str) - NOT ([int], str).
1466 # D = C[[int, str], float]
1468 # `(int, str, float)` rather than `([int, str], float)`.
1475 # B[float, int, str]
1477 # `new_arg` corresponding to `*Ts` will be `(int, str)`. We
1479 # `(float, int, str)` - so again, we should `extend`.
1716 such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For
1720 Foo[Unpack[tuple[int, str]]] # Equivalent to Foo[int, str]
1729 Bar[int, str] # Also valid
1733 Foo[*tuple[int, str]]
1873 s_vars = ', '.join(str(t) for t in tvars if t not in gvarset)
1874 s_args = ', '.join(str(g) for g in gvars)
2266 def greet(name: str) -> None:
2267 assert_type(name, str) # ok
2334 if isinstance(value, str):
2365 if isinstance(value, str):
2436 assert get_args(Dict[str, int]) == (str, int)
2438 assert get_args(Union[int, Union[T, int], str][int]) == (int, str)
2439 assert get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
2460 title: str
2464 is_typeddict(Union[list, str]) # => False
2477 def int_or_str(arg: int | str) -> None:
2481 case str():
2482 print("It's a str")
2572 def utf8(value: str) -> bytes: ...
2583 def utf8(value: str) -> bytes: ...
2667 AnyStr = TypeVar('AnyStr', bytes, str)
2688 Callable[[int], str] signifies a function of (int) -> str.
2713 to type variables T1 and T2. Tuple[int, float, str] is a tuple
2899 name: str
2911 Employee = NamedTuple('Employee', [('name', str), ('id', int)])
3012 label: str
3023 Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
3079 title: Required[str]
3101 title: str
3122 def name_by_id(user_id: UserId) -> str:
3173 # Python-version-specific alias (Python 2: unicode; Python 3: str)
3174 Text = str
3198 def mode(self) -> str:
3203 def name(self) -> str:
3294 class TextIO(IO[str]):
3306 def encoding(self) -> str:
3311 def errors(self) -> Optional[str]:
3412 name: str
3421 name: str
3432 name: str