Skip to content

Commit

Permalink
Chore: Format code using most recent ruff and mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Apr 16, 2024
1 parent c18f17d commit f3db9b3
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions cratedb_toolkit/retention/strategy/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
In CrateDB, tables for storing retention policies need to be created once manually.
See the file setup/schema.sql in this repository.
"""

import dataclasses
import logging

Expand Down
1 change: 1 addition & 0 deletions cratedb_toolkit/retention/strategy/reallocate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Tables for storing retention policies need to be created once manually in
CrateDB. See the file setup/schema.sql in this repository.
"""

import dataclasses
import logging

Expand Down
1 change: 1 addition & 0 deletions cratedb_toolkit/retention/strategy/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
In CrateDB, tables for storing retention policies need to be created once manually.
See the file setup/schema.sql in this repository.
"""

import dataclasses
import logging

Expand Down
3 changes: 2 additions & 1 deletion cratedb_toolkit/wtf/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def record_once(self):
)
)
self.adapter.connection.execute(
sa.text(f"INSERT INTO {table} (info) VALUES (:info)"), {"info": sample.to_dict()["data"]} # noqa: S608
sa.text(f"INSERT INTO {table} (info) VALUES (:info)"), # noqa: S608
{"info": sample.to_dict()["data"]},
)

def record_forever(self):
Expand Down
1 change: 1 addition & 0 deletions examples/cloud_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
python examples/cloud_import.py e1e38d92-a650-48f1-8a70-8133f2d5c400
"""

import logging
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions examples/retention_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
python examples/retention_edit.py crate://localhost:4200
"""

import logging
import os

Expand Down
1 change: 1 addition & 0 deletions examples/retention_retire_cutoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
python examples/retention_retire_cutoff.py crate://localhost:4200
"""

import logging
import os

Expand Down
15 changes: 8 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ datasets = [
]
develop = [
"black[jupyter]<25",
"mypy==1.8.0",
"mypy<1.10",
"poethepoet<0.26",
"pyproject-fmt<1.8",
"ruff==0.3.4",
"ruff<0.4",
"validate-pyproject<0.17",
]
influxdb = [
Expand Down Expand Up @@ -215,7 +215,7 @@ markers = [
[tool.ruff]
line-length = 120

select = [
lint.select = [
# Bandit
"S",
# Bugbear
Expand Down Expand Up @@ -243,7 +243,7 @@ select = [
"RET",
]

extend-ignore = [
lint.extend-ignore = [
# zip() without an explicit strict= parameter
"B905",
# df is a bad variable name. Be kinder to your future self.
Expand All @@ -261,7 +261,7 @@ extend-exclude = [
"workbench.py",
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"] # Allow use of `assert`, and `print`.
"examples/*" = ["T201"] # Allow `print`
"cratedb_toolkit/retention/cli.py" = ["T201"] # Allow `print`
Expand All @@ -286,12 +286,13 @@ format = [
{ cmd = "black ." },
# Configure Ruff not to auto-fix (remove!):
# unused imports (F401), unused variables (F841), `print` statements (T201), and commented-out code (ERA001).
{ cmd = "ruff --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." },
{ cmd = "ruff format" },
{ cmd = "ruff check --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." },
{ cmd = "pyproject-fmt --keep-full-version pyproject.toml" },
]

lint = [
{ cmd = "ruff ." },
{ cmd = "ruff check ." },
{ cmd = "black --check ." },
{ cmd = "validate-pyproject pyproject.toml" },
{ cmd = "mypy" },
Expand Down

0 comments on commit f3db9b3

Please sign in to comment.