Skip to content

Commit

Permalink
Merge pull request #75 from vlaci/black-to-ruff
Browse files Browse the repository at this point in the history
Black to ruff
  • Loading branch information
vlaci authored Nov 17, 2024
2 parents 4e1a726 + a8b2fe2 commit eb74db7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 61 deletions.
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@
maturin
pdm
cargo-msrv
cargo
rustc
];

shellHook = ''
${pkgs.lib.getExe pkgs.patchelf} --set-interpreter ${pkgs.stdenv.cc.bintools.dynamicLinker} $(git rev-parse --show-toplevel)/.venv/bin/ruff
'';
};
}
);
Expand Down
53 changes: 2 additions & 51 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ venv = "pdm sync -d"
mypy = "mypy ."
pytest = "python -m pytest tests"
clippy = "cargo clippy --all-targets -- --deny warnings"
cargofmt = "cargo fmt"
ruff-format = "ruff format"
ruff-check = "ruff check"
test = "cargo test"
all = { composite = ["clippy", "test", "venv", "mypy", "pytest"] }
all = { composite = ["clippy", "cargofmt", "test", "venv", "ruff-check", "ruff-format", "mypy", "pytest"] }

[tool.pdm.dev-dependencies]
dev = [
"black ~= 23.3.0",
"ruff ~=0.7.4",
"mypy ~= 1.2",
"towncrier ~=24.8.0",
Expand All @@ -83,7 +85,7 @@ docs = [
"mkdocs-material>=9.1.14",
]

[tool.ruff]
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
Expand All @@ -97,7 +99,6 @@ select = [
"FBT", # flake8-boolean-trap
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concats
"N", # pep8-naming
"PIE", # flake8-pie
"PYI", # flake8-pyi
Expand Down Expand Up @@ -127,19 +128,19 @@ ignore = [
"UP007", # non-pep604-annotation: For Python 3.8 compatibility
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # assert: Enable usage of asserts
"D1", # undocumented-*
]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["lzallright"]

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
parametrize-names-type = "csv"
8 changes: 6 additions & 2 deletions python/lzallright/_lzallright.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ from array import array
from mmap import mmap
from typing import Optional, Tuple, Union

_BufferType = Union[array[int], bytes, bytearray, memoryview, mmap]
import typing_extensions

_BufferType: typing_extensions.TypeAlias = Union[
array[int], bytes, bytearray, memoryview, mmap
]

class LZOCompressor:
"""Object containing the compressor state.
Expand Down Expand Up @@ -69,7 +73,7 @@ class LZOError(Exception):
class InputNotConsumed(LZOError): # noqa: N818
"""Decompression finished with leftover data."""

args: Tuple[EResult, bytes]
args: Tuple[EResult, bytes] # type: ignore[assignment]
"""Error reason, with decompressed data
``(EResult.InputNotConsumed, decompressed: bytes)``
Expand Down

0 comments on commit eb74db7

Please sign in to comment.