Skip to content
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

Ruff: enable all pyflakes and perf rules #4556

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ exclude = [
[lint]
extend-select = [
"C901",
"PERF401",
"W",

# local
"ANN2", # missing-return-type-*
"F", # Pyflakes
"F404", # late-future-import
"FA", # flake8-future-annotations
"I", # isort
"PERF", # Perflint
"PYI", # flake8-pyi
"TRY", # tryceratops
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = [
"PERF203", # try-except-in-loop, micro-optimisation with many false-positive. Worth checking but don't block CI
"TRY003", # raise-vanilla-args, avoid multitude of exception classes
"TRY301", # raise-within-try, it's handy
"UP015", # redundant-open-modes, explicit is preferred
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ def get_args(cls, dist, header=None):
spec = str(dist.as_requirement())
for type_ in 'console', 'gui':
group = type_ + '_scripts'
for name, ep in dist.get_entry_map(group).items():
for name in dist.get_entry_map(group).keys():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are not using the values, then we can just iterate over the original object no? There would be no reason to call .keys(), right?

Copy link
Contributor Author

@Avasam Avasam Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah iterating over a dict should be the same as iterating over its keys since we don't do anything special with the view-object. I kept it consistent with other places in code. (this might be an opiniated preference)

cls._ensure_safe_name(name)
script_text = cls.template % locals()
args = cls._get_script_args(type_, name, header, script_text)
Expand Down
8 changes: 1 addition & 7 deletions setuptools/tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,8 @@ def test_process_template_line_invalid(self):
'prune',
'blarg',
):
try:
with pytest.raises(DistutilsTemplateError):
file_list.process_template_line(action)
except DistutilsTemplateError:
pass
except Exception:
assert False, "Incorrect error thrown"
else:
assert False, "Should have thrown an error"

def test_include(self, caplog):
caplog.set_level(logging.DEBUG)
Expand Down
Loading