-
Notifications
You must be signed in to change notification settings - Fork 16
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
Use loguru and appdirs to replace logging and hard coded path #82
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
25bdfb7
add ruff.isort
zrr1999 0bf6dc1
rm isort
zrr1999 6e68e36
use loguru
zrr1999 280a369
fix path bug
zrr1999 038c951
add appdirs
zrr1999 1470a7f
bump ruff
zrr1999 02c8b55
fix
zrr1999 236255e
rm autoflake
zrr1999 5c767f4
format
zrr1999 091c53b
fix bug
zrr1999 0bc64cc
update
zrr1999 f5959e1
fix bug
zrr1999 8fc4aed
add autoflake
zrr1999 93f4172
add black
zrr1999 b82d0e7
add black to pre-commit config back
SigureMo e4c8d72
reformat with latest black
SigureMo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# ------------------------------------------------ | ||
# Options affecting comment reflow and formatting. | ||
# ------------------------------------------------ | ||
from __future__ import annotations | ||
|
||
with section("markup"): | ||
# enable comment markup parsing and reflow | ||
enable_markup = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,8 @@ repos: | |
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
- repo: https://github.com/psf/black-pre-commit-mirror | ||
rev: 23.9.1 | ||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 将 black 加回来并更新为最新版本和使用 mirror 版本(就相当于从 PyPI 下载而不是 clone 源码构建),因为 mirror 版本比 source 版本的优势是通过 mypyc 编译,有更快的速度,也是现在推荐的方式,相关讨论见 psf/black#3405 ,文档见 https://black.readthedocs.io/en/stable/integrations/source_version_control.html |
||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/autoflake | ||
|
@@ -31,10 +27,10 @@ repos: | |
# - "--remove-unused-variables" | ||
- "--remove-all-unused-imports" | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.254 | ||
rev: v0.0.292 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix, --no-cache] | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix, --no-cache] | ||
- repo: https://github.com/asottile/yesqa | ||
rev: v1.4.0 | ||
hooks: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[tool.ruff.isort] | ||
lines-between-types = 1 | ||
known-first-party = ["build"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
paddle.seed(1234) | ||
|
||
# logging.getLogger().setLevel(logging.DEBUG) | ||
|
||
|
||
|
||
def inner_func(x, y): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
paddlepaddle>=2.4.0 | ||
pydot | ||
loguru | ||
appdirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ruff-format 目前可以替代 black 吗?
这里是 "unstable" 的状态, 另外这里需要加上
吗?
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.
这块我也不太确定,我把autoflake的配置给恢复回去了
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.
建议 暂时保留 black 的配置, 可以在后面替换(如果有必要)
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.
需要的,ruff 和 ruff-format 是两个不同的 hook,ruff 仅仅包含 lint 而不包含 format(https://github.com/astral-sh/ruff-pre-commit/blob/42f98979dbdfcd148dff424477552b8816a7cf01/.pre-commit-hooks.yaml#L4 )
format 还用 black 吧,ruff 还太早期了 0.0.291 还只是第一个用户可见的版本,距离可用还需要很久的打磨
不过我相信 isort 已经可以替换了,已经打算 ruff 过两天发布 0.1.0 (astral-sh/ruff#7931)就在 Paddle 那边将 isort 替换为 ruff 的 isort 实现