run example snippets through ruff formatter

This commit is contained in:
Onyx and Iris 2025-01-17 02:54:23 +00:00
parent 16df0d559e
commit af68c423a6

View File

@ -63,27 +63,27 @@ class ManyThings:
self.vban = vban self.vban = vban
def things(self): def things(self):
self.vban.strip[0].label = "podmic" self.vban.strip[0].label = 'podmic'
self.vban.strip[0].mute = True self.vban.strip[0].mute = True
print( print(
f"strip 0 ({self.vban.strip[0].label}) mute has been set to {self.vban.strip[0].mute}" f'strip 0 ({self.vban.strip[0].label}) mute has been set to {self.vban.strip[0].mute}'
) )
def other_things(self): def other_things(self):
self.vban.bus[3].gain = -6.3 self.vban.bus[3].gain = -6.3
self.vban.bus[4].eq.on = True self.vban.bus[4].eq = True
info = ( info = (
f"bus 3 gain has been set to {self.vban.bus[3].gain}", f'bus 3 gain has been set to {self.vban.bus[3].gain}',
f"bus 4 eq has been set to {self.vban.bus[4].eq.on}", f'bus 4 eq has been set to {self.vban.bus[4].eq}',
) )
print("\n".join(info)) print('\n'.join(info))
def main(): def main():
KIND_ID = "banana" kind_id = 'banana'
with vban_cmd.api( with vban_cmd.api(
KIND_ID, ip="gamepc.local", port=6980, streamname="Command1" kind_id, ip='gamepc.local', port=6980, streamname='Command1'
) as vban: ) as vban:
do = ManyThings(vban) do = ManyThings(vban)
do.things() do.things()
@ -92,14 +92,14 @@ def main():
# set many parameters at once # set many parameters at once
vban.apply( vban.apply(
{ {
"strip-2": {"A1": True, "B1": True, "gain": -6.0}, 'strip-2': {'A1': True, 'B1': True, 'gain': -6.0},
"bus-2": {"mute": True, "eq": {"on": True}}, 'bus-2': {'mute': True},
"vban-in-0": {"on": True}, 'vban-in-0': {'on': True},
} }
) )
if __name__ == "__main__": if __name__ == '__main__':
main() main()
``` ```
@ -147,8 +147,8 @@ Set mute state as value for the app matching name.
example: example:
```python ```python
vban.strip[5].appmute("Spotify", True) vban.strip[5].appmute('Spotify', True)
vban.strip[5].appgain("Spotify", 0.5) vban.strip[5].appgain('Spotify', 0.5)
``` ```
##### Strip.Comp ##### Strip.Comp
@ -353,10 +353,10 @@ vban.command.showvbanchat = true
```python ```python
vban.apply( vban.apply(
{ {
"strip-0": {"A1": True, "B1": True, "gain": -6.0}, 'strip-0': {'A1': True, 'B1': True, 'gain': -6.0},
"bus-1": {"mute": True, "mode": "composite"}, 'bus-1': {'mute': True, 'mode': 'composite'},
"bus-2": {"eq": {"on": True}}, 'bus-2': {'eq': {'on': True}},
"vban-in-0": {"on": True}, 'vban-in-0': {'on': True},
} }
) )
``` ```
@ -364,8 +364,8 @@ vban.apply(
Or for each class you may do: Or for each class you may do:
```python ```python
vban.strip[0].apply({"mute": True, "gain": 3.2, "A1": True}) vban.strip[0].apply({'mute': True, 'gain': 3.2, 'A1': True})
vban.vban.outstream[0].apply({"on": True, "name": "streamname", "bit": 24}) vban.vban.outstream[0].apply({'on': True, 'name': 'streamname', 'bit': 24})
``` ```
## Config Files ## Config Files
@ -413,10 +413,11 @@ example:
```python ```python
import vban_cmd import vban_cmd
opts = { opts = {
"ip": "<ip address>", 'ip': '<ip address>',
"streamname": "Command1", 'streamname': 'Command1',
"port": 6980, 'port': 6980,
} }
with vban_cmd.api('banana', ldirty=True, **opts) as vban: with vban_cmd.api('banana', ldirty=True, **opts) as vban:
... ...
@ -469,7 +470,7 @@ The following methods are available:
example: example:
```python ```python
vban.event.remove(["pdirty", "ldirty"]) vban.event.remove(['pdirty', 'ldirty'])
# get a list of currently subscribed # get a list of currently subscribed
print(vban.event.get()) print(vban.event.get())
@ -502,7 +503,7 @@ True iff a level value has been changed.
Sends a script block as a string request, for example: Sends a script block as a string request, for example:
```python ```python
vban.sendtext("Strip[0].Mute=1;Bus[0].Mono=1") vban.sendtext('Strip[0].Mute=1;Bus[0].Mono=1')
``` ```
## Errors ## Errors
@ -520,9 +521,9 @@ import vban_cmd
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
opts = {"ip": "ip.local", "port": 6980, "streamname": "Command1"} opts = {'ip': 'ip.local', 'port': 6980, 'streamname': 'Command1'}
with vban_cmd.api('banana', **opts) as vban: with vban_cmd.api('banana', **opts) as vban:
... ...
``` ```
## Tests ## Tests