mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
build: replace black and isort with ruff
ruff format keeps black's style at the same line length, and ruff check covers import sorting plus pycodestyle and pyflakes. Three comments and a test regex are wrapped to fit 79 columns.
This commit is contained in:
8 files changed
+21
-24
No files matched your search
@@ -1,11 +1,8 @@
|
|||||||
repos:
|
repos:
|
||||||
|
|
||||||
- repo: https://github.com/pycqa/isort
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: 5.13.2
|
rev: v0.17.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: ruff-check
|
||||||
additional_dependencies: [toml]
|
args: [--fix]
|
||||||
- repo: https://github.com/psf/black
|
- id: ruff-format
|
||||||
rev: 24.4.2
|
|
||||||
hooks:
|
|
||||||
- id: black
|
|
||||||
+2
-1
@@ -923,7 +923,8 @@ def monster_task(
|
|||||||
result = monster.name
|
result = monster.name
|
||||||
lev = monster.level
|
lev = monster.level
|
||||||
else:
|
else:
|
||||||
# pick the monster out of so many random ones closest to the level we want
|
# pick the monster out of so many random ones closest to the level
|
||||||
|
# we want
|
||||||
monster = unnamed_monster(data, level, iterations=5)
|
monster = unnamed_monster(data, level, iterations=5)
|
||||||
result = monster.name
|
result = monster.name
|
||||||
lev = monster.level
|
lev = monster.level
|
||||||
|
|||||||
@@ -143,10 +143,8 @@ class CursesUserInterface(BaseUserInterface):
|
|||||||
view.on_cancel += lambda: self._switch_to_create_char_race_view(
|
view.on_cancel += lambda: self._switch_to_create_char_race_view(
|
||||||
player_name, race
|
player_name, race
|
||||||
)
|
)
|
||||||
view.on_confirm += (
|
view.on_confirm += lambda class_: (
|
||||||
lambda class_: self._switch_to_create_char_stats_view(
|
self._switch_to_create_char_stats_view(player_name, race, class_)
|
||||||
player_name, race, class_
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
self._switch_view(view)
|
self._switch_view(view)
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,6 @@ class CharacterSheetWindow(Focusable, DataTableProgressBarWindow):
|
|||||||
self._cur_pos = self._player.exp_bar.position
|
self._cur_pos = self._player.exp_bar.position
|
||||||
self._max_pos = self._player.exp_bar.max_
|
self._max_pos = self._player.exp_bar.max_
|
||||||
self._progress_title = (
|
self._progress_title = (
|
||||||
f"Experience ({self._max_pos-self._cur_pos:.0f} XP to go)"
|
f"Experience ({self._max_pos - self._cur_pos:.0f} XP to go)"
|
||||||
)
|
)
|
||||||
self._render_progress_bar()
|
self._render_progress_bar()
|
||||||
@@ -24,9 +24,7 @@ LOGO = """
|
|||||||
█▄▄▀ █▀▀ ▄▀▀▄ ▄▀▀▄ █▀▀ ▄▀▀▄ ▄▀▀▀ ▄▀▀▀ █ █ █ █ ▄▀▀▄ ▄▀▀▀ ▀█▀
|
█▄▄▀ █▀▀ ▄▀▀▄ ▄▀▀▄ █▀▀ ▄▀▀▄ ▄▀▀▀ ▄▀▀▀ █ █ █ █ ▄▀▀▄ ▄▀▀▀ ▀█▀
|
||||||
█ █ █ █ ▀▄▄█ █ █▀▀ ▀▀▄ ▀▀▄ █ ▌█ █ █ █▀▀ ▀▀▄ █
|
█ █ █ █ ▀▄▄█ █ █▀▀ ▀▀▄ ▀▀▄ █ ▌█ █ █ █▀▀ ▀▀▄ █
|
||||||
▀ ▀ ▀▀ ▄▄▀ ▀ ▀▀ ▀▀▀ ▀▀▀ ▀▀▌ ▀▀ ▀▀ ▀▀▀ ▀
|
▀ ▀ ▀▀ ▄▄▀ ▀ ▀▀ ▀▀▀ ▀▀▀ ▀▀▌ ▀▀ ▀▀ ▀▀▀ ▀
|
||||||
""".strip(
|
""".strip("\n")
|
||||||
"\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MainMenu(Menu):
|
class MainMenu(Menu):
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ class DataTable(Scrollable):
|
|||||||
self._pad.addnstr(y, 0, row[0], min(len(row[0]), w))
|
self._pad.addnstr(y, 0, row[0], min(len(row[0]), w))
|
||||||
# Determine the number of characters to write
|
# Determine the number of characters to write
|
||||||
nwrite = min(len(row[1]), w - col2_x)
|
nwrite = min(len(row[1]), w - col2_x)
|
||||||
# Ensure we have enough columns, and we are writing more than zero
|
# Ensure we have enough columns, and we are writing more
|
||||||
|
# than zero
|
||||||
if col2_x < w and nwrite > 0:
|
if col2_x < w and nwrite > 0:
|
||||||
self._pad.addnstr(y, col2_x, row[1], nwrite)
|
self._pad.addnstr(y, col2_x, row[1], nwrite)
|
||||||
if y == self._selected and has_colors():
|
if y == self._selected and has_colors():
|
||||||
|
|||||||
+6
-5
@@ -42,10 +42,11 @@ build-backend = "hatchling.build"
|
|||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = ["pre-commit>=2.16.0", "pytest>=8.0"]
|
dev = ["pre-commit>=2.16.0", "pytest>=8.0"]
|
||||||
|
|
||||||
[tool.black]
|
[tool.ruff]
|
||||||
line-length = 79
|
line-length = 79
|
||||||
|
|
||||||
[tool.isort]
|
[tool.ruff.lint]
|
||||||
known_first_party = "pqcli"
|
select = ["E", "F", "W", "I"]
|
||||||
multi_line_output = 3
|
|
||||||
include_trailing_comma = true
|
[tool.ruff.lint.isort]
|
||||||
|
known-first-party = ["pqcli"]
|
||||||
@@ -129,7 +129,8 @@ def test_impressive_guy_formats() -> None:
|
|||||||
titles = "|".join(re.escape(title) for title in data.impressive_titles)
|
titles = "|".join(re.escape(title) for title in data.impressive_titles)
|
||||||
races = "|".join(re.escape(plural(race.name)) for race in data.races)
|
races = "|".join(re.escape(plural(race.name)) for race in data.races)
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
rf"the ({titles}) of the ({races})|({titles}) [A-Z][a-z]+ of [A-Z][a-z]+"
|
rf"the ({titles}) of the ({races})"
|
||||||
|
rf"|({titles}) [A-Z][a-z]+ of [A-Z][a-z]+"
|
||||||
)
|
)
|
||||||
random.seed("guys")
|
random.seed("guys")
|
||||||
guys = [impressive_guy(data) for _ in range(200)]
|
guys = [impressive_guy(data) for _ in range(200)]
|
||||||
|
|||||||
Reference in new issue
Block a user