Skip to content

Commit

Permalink
pyproject: configure ruff to the same line length that hatch uses
Browse files Browse the repository at this point in the history
This way ruff format (in pre-commit) gives us the same result as hatch
fmt.
  • Loading branch information
whot committed Jun 5, 2024
1 parent 74e5c03 commit 5a5c202
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Documentation = "https://github.com/unknown/gsetwacom#readme"
Issues = "https://github.com/unknown/gsetwacom/issues"
Source = "https://github.com/unknown/gsetwacom"

[tool.ruff]
# Match the hatch default so we can run ruff *or* hatch fmt
# and get the same result
line-length = 120

[tool.ruff.lint]
ignore = [
"FBT001", # FBT001 Boolean-typed positional argument in function definition
Expand Down
28 changes: 7 additions & 21 deletions src/gsetwacom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ def tablet_map_to_monitor(


def change_action(path: str, action: str, keybinding: str | None):
settings = Gio.Settings.new_with_path(
"org.gnome.desktop.peripherals.tablet.pad-button", path
)
settings = Gio.Settings.new_with_path("org.gnome.desktop.peripherals.tablet.pad-button", path)

if action == "keybinding":
if keybinding is None:
Expand Down Expand Up @@ -217,18 +215,14 @@ def change_action(path: str, action: str, keybinding: str | None):
default="cw",
help="The ring movement direction",
)
@click.argument(
"action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"])
)
@click.argument("action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"]))
@click.argument(
"keybinding",
type=str,
required=False,
)
@click.pass_context
def tablet_set_ring_action(
ctx, ring: int, mode: int, direction: str, action: str, keybinding: str | None
):
def tablet_set_ring_action(ctx, ring: int, mode: int, direction: str, action: str, keybinding: str | None):
"""
Change the action the tablet ring is mapped to for a movement direction and in a given mode.
"""
Expand All @@ -247,18 +241,14 @@ def tablet_set_ring_action(
default="cw",
help="The strip movement direction",
)
@click.argument(
"action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"])
)
@click.argument("action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"]))
@click.argument(
"keybinding",
type=str,
required=False,
)
@click.pass_context
def tablet_set_strip_action(
ctx, strip: int, mode: int, direction: str, action: str, keybinding: str | None
):
def tablet_set_strip_action(ctx, strip: int, mode: int, direction: str, action: str, keybinding: str | None):
"""
Change the action the tablet strip is mapped to for a movement direction and in a given mode.
"""
Expand All @@ -270,9 +260,7 @@ def tablet_set_strip_action(

@tablet.command(name="set-button-action")
@click.argument("button", type=click.Choice(string.ascii_uppercase))
@click.argument(
"action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"])
)
@click.argument("action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"]))
@click.argument(
"keybinding",
type=str,
Expand Down Expand Up @@ -349,9 +337,7 @@ def stylus_set_left_handed(ctx, eraser: bool, x1: int, y1: int, x2: int, y2: int

@stylus.command(name="set-button-action")
@click.argument("button", type=click.Choice(["primary", "secondary", "tertiary"]))
@click.argument(
"action", type=click.Choice(["left", "middle", "right", "back", "forward"])
)
@click.argument("action", type=click.Choice(["left", "middle", "right", "back", "forward"]))
@click.pass_context
def stylus_set_button_action(ctx, button: str, action: str):
"""
Expand Down

0 comments on commit 5a5c202

Please sign in to comment.