transformers
517197f7 - Update type hints in tokenization_utils.py to use | syntax (#41713)

Commit
69 days ago
Update type hints in tokenization_utils.py to use | syntax (#41713) * Update type hints to use | syntax for Union types - Replace Union[str, os.PathLike] with str | os.PathLike - Replace Optional[Union[str, dict]] with str | dict | None - Keep Union for forward references like 'torch.dtype' - Update imports to remove unused Union import where possible This modernizes the type hints to use Python 3.10+ syntax while maintaining compatibility with forward references. * Update type hints in tokenization_utils.py to use | syntax - Replace Union[AddedToken, str] with AddedToken | str - Replace Union[list[str], list[AddedToken]] with list[str] | list[AddedToken] - Replace Union[str, list[str]] with str | list[str] - Replace Union[int, list[int]] with int | list[int] - Update error messages to use | syntax - Maintain backward compatibility This modernizes the type hints to use Python 3.10+ syntax. * Fix error message formatting in tokenization_utils.py - Fix error message to use Union syntax instead of | syntax in string - This prevents potential issues with error message formatting - Maintains type hint modernization while fixing error messages
Author
Parents
Loading