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

Update project for newer versions of black and ruff #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions dwasfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Contains the dwas configuration for this project.
"""

from pathlib import Path

import dwas
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ disable = [
# Ruff
[tool.ruff]
target-version = "py38"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
##
Expand Down Expand Up @@ -183,7 +185,7 @@ ignore = [
flake8-pytest-style.parametrize-values-type = "tuple"
flake8-pytest-style.parametrize-values-row-type = "tuple"
flake8-pytest-style.fixture-parentheses = false
lint.isort.known-first-party = ["dwas"]
isort.known-first-party = ["dwas"]

[tool.ruff.lint.per-file-ignores]
"docs/*" = ["D"]
Expand Down
1 change: 1 addition & 0 deletions src/dwas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

While ``dwas`` is not at version 1.0.0, it does not guarantee API stability.
"""

from ._config import Config
from ._exceptions import BaseDwasException
from ._steps import (
Expand Down
8 changes: 5 additions & 3 deletions src/dwas/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ColorFormatter(logging.Formatter):
{
logging.DEBUG: Fore.CYAN,
logging.INFO: "",
logging.WARN: Fore.YELLOW,
logging.WARNING: Fore.YELLOW,
logging.ERROR: Fore.RED + Style.BRIGHT,
logging.FATAL: Back.RED + Fore.WHITE + Style.BRIGHT,
}
Expand All @@ -32,8 +32,10 @@ def formatMessage(self, record: logging.LogRecord) -> str:

def formatException(
self,
ei: tuple[type[BaseException], BaseException, TracebackType | None]
| tuple[None, None, None],
ei: (
tuple[type[BaseException], BaseException, TracebackType | None]
| tuple[None, None, None]
),
) -> str:
output = super().formatException(ei)
return f"{Fore.CYAN}\ndwas > " + "\ndwas > ".join(output.splitlines())
Expand Down
16 changes: 8 additions & 8 deletions src/dwas/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def compute_replacement(requirements: list[str]) -> list[str]:
replacements.append(requirement)
else:
if requirement not in except_replacements:
except_replacements[
requirement
] = compute_replacement(graph[requirement])
except_replacements[requirement] = (
compute_replacement(graph[requirement])
)
replacements.extend(except_replacements[requirement])

return replacements
Expand Down Expand Up @@ -264,10 +264,10 @@ def compute_only_replacement(
replacements = []
for requirement in requirements:
if requirement not in only_replacements:
only_replacements[
requirement
] = compute_only_replacement(
requirement, graph[requirement]
only_replacements[requirement] = (
compute_only_replacement(
requirement, graph[requirement]
)
)
replacements.extend(only_replacements[requirement])

Expand Down Expand Up @@ -665,7 +665,7 @@ def _compute_slowest_chains(
total_time_per_step: dict[str, tuple[list[str], timedelta]] = {}

def compute_chain(step: str) -> tuple[list[str], timedelta]:
precomputed_result = total_time_per_step.get(step, None)
precomputed_result = total_time_per_step.get(step)
if precomputed_result is not None:
return precomputed_result

Expand Down
6 changes: 2 additions & 4 deletions src/dwas/_steps/parametrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,15 @@ def parametrize(
arg_names: str,
args_values: Sequence[Any],
ids: Sequence[str | None] | None = None,
) -> Callable[[T], T]:
...
) -> Callable[[T], T]: ...


@overload
def parametrize(
arg_names: Sequence[str],
args_values: Sequence[Sequence[Any]],
ids: Sequence[str | None] | None = None,
) -> Callable[[T], T]:
...
) -> Callable[[T], T]: ...


def parametrize(
Expand Down
6 changes: 3 additions & 3 deletions src/dwas/_subproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def _run() -> subprocess.CompletedProcess[None]:
stdout_reader.join()
stderr_reader.join()

ret: subprocess.CompletedProcess[
None
] = subprocess.CompletedProcess(command, proc.returncode)
ret: subprocess.CompletedProcess[None] = (
subprocess.CompletedProcess(command, proc.returncode)
)
self._remove(proc)
ret.check_returncode()
return ret
Expand Down
2 changes: 1 addition & 1 deletion tests/predefined/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_exposes_sdists_and_wheels(self, cache_path):
cli(cache_path=cache_path, steps=["output_artifacts"])
artifacts = json.loads(Path("artifacts.json").read_text("utf-8"))
assert list(artifacts.keys()) == ["sdists", "wheels"]
assert Path(artifacts["sdists"][0]).name == "test-package-0.0.0.tar.gz"
assert Path(artifacts["sdists"][0]).name == "test_package-0.0.0.tar.gz"
assert (
Path(artifacts["wheels"][0]).name
== "test_package-0.0.0-py3-none-any.whl"
Expand Down
Loading