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 ruff with new rules #74

Merged
merged 1 commit into from
Nov 23, 2023
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
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ repos:
types: [python]
require_serial: true
args: ["--fix"]
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
entry: pyupgrade
language: system
types: [python]
args: [--py37-plus]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Sphinx configuration."""
project = "ArrayTeX"
author = "Dom Batten"
copyright = "2023, Dom Batten"
copyright = "2023, Dom Batten" # noqa: A001
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
Expand Down
1,317 changes: 568 additions & 749 deletions poetry.lock

Large diffs are not rendered by default.

39 changes: 21 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "arraytex"
version = "0.0.9"
description = "ArrayTeX"
description = "Convert Python data structures to LaTeX"
authors = ["Dom Batten <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand Down Expand Up @@ -33,13 +33,10 @@ safety = "^2.2.0"
mypy = "*"
black = "*"
pre-commit = "^2.16.0"
pep8-naming = "*"
darglint = "*"
reorder-python-imports = "*"
pre-commit-hooks = "^4.0.1"
Pygments = "^2.9.0"
ruff = "*"
pyupgrade = ">=2.29.1"

[tool.poetry.group.docs.dependencies]
furo = ">=2021.11.12"
Expand Down Expand Up @@ -81,30 +78,36 @@ ignore_missing_imports = true
src = ["src", "tests"]
ignore = [
'B019',
'D203',
'D204',
'D213',
'D215',
'D400',
'D404',
'D406',
'D407',
'D408',
'D409',
'D413',
'E501'
'C901'
]
line-length = 80
line-length = 88
select = [
'A',
'ARG',
'B',
'B9',
'BLE',
'C',
'C4',
'D',
'DTZ',
'E',
'F',
'I',
'N',
'PIE',
'PT',
'PTH',
'Q',
'RET',
'RUF',
'S',
'SIM',
'SLF',
'T10',
'TCH',
'UP',
'W',
'I001'
]

[tool.ruff.mccabe]
Expand Down
13 changes: 7 additions & 6 deletions src/arraytex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def to_matrix(
style: str = "b",
num_format: Optional[str] = None,
scientific_notation: bool = False,
to_clp: bool = False,
to_clp: bool = False, # noqa: ARG001
) -> str:
"""Convert a numpy.NDArray to LaTeX matrix.

Expand Down Expand Up @@ -60,7 +60,7 @@ def to_tabular(
col_align: Union[List[str], str] = "c",
col_names: Optional[List[str]] = None,
index: Optional[List[str]] = None,
to_clp: bool = False,
to_clp: bool = False, # noqa: ARG001
) -> str:
"""Convert a numpy.NDArray to LaTeX tabular environment.

Expand All @@ -70,10 +70,11 @@ def to_tabular(
scientific_notation: a flag to determine whether 1 x 10^3 should be used,
otherwise e-notation is used (1e3)
col_align: set the alignment of the columns, usually "c", "r" or "l". If a
single character is provided then it will be broadcast to all columns. If a list
is provided then each item will be assigned to each column, list size and
number of columns must match
col_names: an optional list of column names, otherwise generic names will be assigned
single character is provided then it will be broadcast to all columns. If a
list is provided then each item will be assigned to each column, list size
and number of columns must match
col_names: an optional list of column names, otherwise generic names will be
assigned
index: an optional table index, i.e. row identifiers
to_clp: copy the output to the system clipboard

Expand Down
4 changes: 2 additions & 2 deletions src/arraytex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def num_formatter(x: Union[np.int64, np.float64, np.float32]) -> str:
lines = (
np.array2string(
arr,
max_line_width=np.inf, # type: ignore # noqa
formatter=formatter, # type: ignore # noqa
max_line_width=np.inf, # type: ignore
formatter=formatter, # type: ignore
separator=" & ",
)
.replace("[", "")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from arraytex import __main__


@pytest.fixture
@pytest.fixture()
def runner() -> CliRunner:
"""Fixture for invoking command-line interfaces."""
return CliRunner()
Expand Down
Loading