Skip to content

Commit

Permalink
Fix integers not working in amend sections, bump packages (#184):
Browse files Browse the repository at this point in the history
Bump version for next release.
  • Loading branch information
dosisod authored Jan 11, 2023
1 parent b39a33f commit 8d3e76a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ attrs==22.2.0
black==22.12.0
click==8.1.3
colorama==0.4.6
coverage==7.0.1
coverage==7.0.5
exceptiongroup==1.1.0
flake8==6.0.0
iniconfig==1.1.1
iniconfig==2.0.0
isort==5.11.4
mccabe==0.7.0
mypy==0.991
packaging==22.0
packaging==23.0
pathspec==0.10.3
platformdirs==2.6.0
platformdirs==2.6.2
pluggy==1.0.0
py==1.11.0
pycodestyle==2.10.0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "refurb"
version = "1.9.1"
version = "1.10.0"
description = "A tool for refurbish and modernize Python codebases"
authors = ["dosisod"]
license = "GPL-3.0-only"
Expand Down
15 changes: 9 additions & 6 deletions refurb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,25 @@ def parse_python_version(version: str) -> tuple[int, int]:
raise ValueError("refurb: version must be in form `x.y`")


def parse_amend_error(err: str, path: Path) -> ErrorClassifier:
classifier = parse_error_classifier(err)

return replace(classifier, path=path)


def parse_amendment( # type: ignore
amendment: dict[str, Any]
) -> set[ErrorClassifier]:
def parse_amend_error(err: str, path: Path) -> ErrorClassifier:
classifier = parse_error_classifier(err)

return replace(classifier, path=path)

match amendment:
case {"path": str(path), "ignore": list(ignored), **extra}:
if extra:
raise ValueError(
'refurb: only "path" and "ignore" fields are supported'
)

return {parse_amend_error(error, Path(path)) for error in ignored}
return {
parse_amend_error(str(error), Path(path)) for error in ignored
}

raise ValueError(
'refurb: "path" or "ignore" fields are missing or malformed'
Expand Down
2 changes: 1 addition & 1 deletion test/test_arg_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def test_parse_amend_file_paths() -> None:
[[tool.refurb.amend]]
path = "some/other/path"
ignore = ["FURB102", "FURB103"]
ignore = [102, 103]
"""

config_file = parse_config_file(config)
Expand Down

0 comments on commit 8d3e76a

Please sign in to comment.