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

Some minor bug fixes / updates #764

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

marksmayo
Copy link

Replacing strings with f-strings
Fixing bare exceptions
Cleaning whitespace/brackets
conditions on empty lists
reorder exceptions where one is an ancestor exception
remove useless return
update getName() to name ala python 3.11 requirements

Updated where appropriate, changing % and format strings to f-strings
To at least have an Exception declared
Execution/evaluation order is clear
can be simplified to just not list
OSError is a ancestor class of TimeoutError so Timeout error is never hit.
Python implicitly returns None
After lint failure
@cclauss
Copy link
Contributor

cclauss commented Apr 20, 2023

  • Please edit pyproject.toml and add PLC1901 to the ignore list. (It is a stupid rule.)
  • Do the except: changes allow us to add BLE to the select list?
  • Do these changes allow us to remove anything from the ignore list?

webpy/pyproject.toml

Lines 62 to 77 in 0b67153

[tool.ruff]
select = [
"C9",
"E",
"F",
"I",
"PLC",
"PLE",
"UP",
"W",
]
ignore = [
"E722",
"E731",
"F821",
]

E722 was for bare excepts in flake8, can be removed
PLC1901 added
@cclauss
Copy link
Contributor

cclauss commented Apr 20, 2023

% pip3 install pipx
% pipx run ruff --select=UP031 --fix .

@cclauss cclauss closed this Apr 20, 2023
@marksmayo
Copy link
Author

I think there may still be a ruff failiure in the next run, but it's not appearing locally for me, so just working out the difference.

@cclauss
Copy link
Contributor

cclauss commented Apr 20, 2023

You can install pre-commit locally and then do:
pre-commit install
pre-commit autoupdate
pre-commit run --all-files

@cclauss cclauss reopened this Apr 20, 2023
@@ -2,7 +2,7 @@


def test_group():
assert list(utils.group([], 2)) == []
assert not list(utils.group([], 2))
Copy link
Contributor

@cclauss cclauss Sep 30, 2023

Choose a reason for hiding this comment

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

Please revert. ALL falsey values would pass this test including None, False, 0, 0.0, {}, set(), (,).

We are asserting that the result is an empty list, not any of these other values.

Repeat below. https://docs.astral.sh/ruff/rules/compare-to-empty-string/#known-problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants