-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These commands make use of pzp - an alternative to fzf written in Python, for making it easy to search through and pick a channel or input, instead of having to first `list` the channels/inputs and then `set` the desired one.
- Loading branch information
Showing
11 changed files
with
203 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.7.3 | ||
rev: v0.8.2 | ||
hooks: | ||
- id: ruff | ||
args: | ||
- --fix | ||
- id: ruff-format |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from dataclasses import dataclass | ||
from typing import Any | ||
|
||
|
||
@dataclass | ||
class Channel: | ||
id_: str | ||
number: str | ||
name: str | ||
|
||
def __init__(self, channel: dict[str, Any]) -> None: | ||
self.id_ = channel["channelId"] | ||
self.number = channel["channelNumber"] | ||
self.name = channel["channelName"] | ||
|
||
def __str__(self) -> str: | ||
return f"{self.number}: {self.name}" | ||
|
||
|
||
@dataclass | ||
class InputDevice: | ||
id_: str | ||
name: str | ||
|
||
def __init__(self, input_device: dict[str, Any]) -> None: | ||
self.id_ = input_device["id"] | ||
self.name = input_device["label"] | ||
|
||
def __str__(self) -> str: | ||
return f"{self.name} ({self.id_})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from faker import Faker | ||
|
||
from alga.types import Channel, InputDevice | ||
|
||
|
||
def test_channel(faker: Faker) -> None: | ||
channel = Channel( | ||
{ | ||
"channelId": faker.pystr(), | ||
"channelNumber": faker.pystr(), | ||
"channelName": faker.pystr(), | ||
} | ||
) | ||
|
||
assert str(channel) == f"{channel.number}: {channel.name}" | ||
|
||
|
||
def test_input_device(faker: Faker) -> None: | ||
input_device = InputDevice({"id": faker.pystr(), "label": faker.pystr()}) | ||
|
||
assert str(input_device) == f"{input_device.name} ({input_device.id_})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters