-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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][task 15] enable Ruff PLW3301 rule #57400
Merged
Merged
Conversation
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
你的PR提交成功,感谢你对开源项目的贡献! |
这里需要讨论一下是否需要引入, 我觉得是可以引入的 @SigureMo 测试代码 import pytest, pytest_benchmark
op_idxs = [76,23,67,34,435,5,675,6435]
gpups_min_distributed_idx = 12
expected_result = 5
def test_1(benchmark):
@benchmark
def test_min():
return min(*op_idxs, gpups_min_distributed_idx)
res1 = test_min
assert res1 == expected_result
def test_2(benchmark):
@benchmark
def test_min():
return min(min(op_idxs),gpups_min_distributed_idx)
res2 = test_min
assert res2 == expected_result
==================================================================================================== test session starts =====================================================================================================
platform darwin -- Python 3.11.4, pytest-7.4.2, pluggy-1.3.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/gouzi/Downloads/paddle-test
plugins: anyio-3.7.1, benchmark-4.0.0
collected 2 items
demo.py .. [100%]
--------------------------------------------------------------------------------------------- benchmark: 2 tests --------------------------------------------------------------------------------------------
Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_1 373.7496 (1.0) 7,099,138.2499 (1.94) 1,024.1969 (1.0) 25,638.2390 (1.17) 645.5002 (1.0) 273.0003 (1.0) 264;3195 976.3748 (1.0) 188787 4
test_2 382.2856 (1.02) 3,656,401.2859 (1.0) 1,152.3761 (1.13) 21,821.5498 (1.0) 683.2857 (1.06) 314.5708 (1.15) 343;3133 867.7723 (0.89) 156789 7
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Legend:
Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
OPS: Operations Per Second, computed as 1 / Mean
===================================================================================================== 2 passed in 5.32s ====================================================================================================== ==================================================================================================== test session starts =====================================================================================================
platform darwin -- Python 3.8.16, pytest-7.4.0, pluggy-1.2.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/gouzi/Downloads/paddle-test
plugins: xdoctest-1.1.1, xdist-3.3.1, benchmark-4.0.0, anyio-3.7.0
collected 2 items
demo.py .. [100%]
--------------------------------------------------------------------------------------------- benchmark: 2 tests ---------------------------------------------------------------------------------------------
Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_2 385.0000 (1.0) 9,192,435.8571 (1.0) 1,281.2945 (1.0) 36,979.7994 (1.0) 704.7143 (1.0) 322.7143 (1.0) 258;3661 780.4607 (1.0) 164366 7
test_1 444.0000 (1.15) 23,047,156.0000 (2.51) 1,690.1064 (1.32) 88,433.3687 (2.39) 891.0000 (1.26) 451.0000 (1.40) 67;2402 591.6787 (0.76) 160617 1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Legend:
Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
OPS: Operations Per Second, computed as 1 / Mean
===================================================================================================== 2 passed in 6.85s ====================================================================================================== 在新版本中应该是有对 |
SigureMo
changed the title
[CodeStyle][task 15] enable Ruff PLW3301 rule in python/paddle/base
[CodeStyle][task 15] enable Ruff PLW3301 rule
Sep 16, 2023
SigureMo
approved these changes
Sep 16, 2023
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.
LGTMeow 🐾
Frida-a
pushed a commit
to Frida-a/Paddle
that referenced
this pull request
Oct 14, 2023
danleifeng
pushed a commit
to danleifeng/Paddle
that referenced
this pull request
Nov 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR types
Others
PR changes
Others
Description
auto fix
@gouzil
paddle.base
check #57367