CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[CodeStyle][Ruff] Update target version to py39 #72935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CodeStyle][Ruff] Update target version to py39 #72935
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Ruff linting target to Python 3.9 and modernizes the codebase by replacing older typing constructs and compatibility code with built-in generics and newer string methods.
- Switched
Tuple
,List
,Dict
, etc. imports to use PEP 585 built-in generics (tuple[...]
,list[...]
,dict[...]
) across multiple modules. - Removed Python <3.9 compatibility branches and
typing
imports where no longer needed. - Simplified prefix/suffix slicing using
str.removeprefix
andstr.removesuffix
.
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
python/paddle/jit/sot/utils/envs.py | Swapped Dict[str, List[str]] → dict[str, list[str]] |
python/paddle/jit/sot/opcode_translator/executor/*.py | Updated Tuple /List → tuple /list generics |
python/paddle/io/dataloader/*.py | Replaced Tuple[T, ...] → tuple[T, ...] |
python/paddle/_typing/shape.py | Replaced List[int] → list[int] for size aliases |
python/paddle/_typing/dtype_like.py | Attempted to replace Type[...] → type[...] |
python/paddle/init.py | Removed pkg_resources fallback for <3.9 |
pyproject.toml | Bumped target-version = "py38" → "py39" |
paddle/fluid/eager/auto_code_generator/generator/*.py | Used removesuffix for namespace and parentheses |
python/paddle/amp/auto_cast.py | Swapped ContextManager → AbstractContextManager |
… and several other modules similarly updated |
Comments suppressed due to low confidence (2)
python/paddle/_typing/dtype_like.py:40
- Using 'type[...]' for generics is not supported at runtime or by type checkers; revert to using 'Type[...]' from the typing module for generic class types.
type[
python/paddle/distributed/communication/batch_isend_irecv.py:27
- Import 'Generator' from the typing module when using it with type parameters, since collections.abc.Generator does not support subscripting for generics.
from collections.abc import Generator, Sequence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skip-reason: codestyle only |
PR Category
User Experience
PR Types
Deprecations
Description