Skip to content

Commit 80c9fb5

Browse files
removed double quotes
1 parent ae402e2 commit 80c9fb5

File tree

9 files changed

+31
-79
lines changed

9 files changed

+31
-79
lines changed

.ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
indent-width = 4
22
line-length = 120
33

4-
target-version = "py310"
4+
target-version = "py38"
55

66
src = [
77
"src",

setup.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/pyartnet/base/channel.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import logging
22
import warnings
33
from array import array
4+
from collections.abc import Callable, Collection
45
from logging import DEBUG as LVL_DEBUG
56
from math import ceil
6-
from typing import Any, Callable, Collection, Final, List, Literal, Optional, Type, Union
7-
8-
from pyartnet.errors import ChannelOutOfUniverseError, ChannelValueOutOfBoundsError, \
9-
ChannelWidthError, ValueCountDoesNotMatchChannelWidthError
7+
from typing import Any, Final, List, Literal, Optional, Type, Union
8+
9+
from pyartnet.errors import (
10+
ChannelOutOfUniverseError,
11+
ChannelValueOutOfBoundsError,
12+
ChannelWidthError,
13+
ValueCountDoesNotMatchChannelWidthError,
14+
)
1015
from pyartnet.output_correction import linear
1116

1217
from ..fades import FadeBase, LinearFade
1318
from .channel_fade import ChannelBoundFade
1419
from .output_correction import OutputCorrection
1520
from .universe import BaseUniverse
1621

22+
1723
log = logging.getLogger('pyartnet.Channel')
1824

1925

@@ -28,7 +34,7 @@
2834
class Channel(OutputCorrection):
2935
def __init__(self, universe: BaseUniverse,
3036
start: int, width: int,
31-
byte_size: int = 1, byte_order: Literal['big', 'little'] = 'little'):
37+
byte_size: int = 1, byte_order: Literal['big', 'little'] = 'little') -> None:
3238
super().__init__()
3339

3440
# Validate Boundaries
@@ -139,7 +145,7 @@ def to_buffer(self, buf: bytearray):
139145
def add_fade(self, values: Collection[Union[int, FadeBase]], duration_ms: int,
140146
fade_class: Type[FadeBase] = LinearFade):
141147
warnings.warn(
142-
f"{self.set_fade.__name__:s} is deprecated, use {self.set_fade.__name__:s} instead", DeprecationWarning)
148+
f'{self.set_fade.__name__:s} is deprecated, use {self.set_fade.__name__:s} instead', DeprecationWarning)
143149
return self.set_fade(values, duration_ms, fade_class)
144150

145151
# noinspection PyProtectedMember
@@ -198,5 +204,5 @@ def __await__(self):
198204
yield from self._current_fade.event.wait().__await__()
199205
return True
200206

201-
def __repr__(self):
207+
def __repr__(self) -> str:
202208
return f'<{self.__class__.__name__:s} {self._start:d}/{self._width:d} {self._byte_size * 8:d}bit>'

src/pyartnet/fades/fade_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
class FadeBase:
33

4-
def __init__(self):
4+
def __init__(self) -> None:
55
self.is_done = False
66

77
def initialize(self, current: int, target: int, steps: int):
88
raise NotImplementedError()
99

1010
def debug_initialize(self) -> str:
1111
"""return debug string of the calculated values in initialize fade"""
12-
return ""
12+
return ''
1313

1414
def calc_next_value(self) -> float:
1515
raise NotImplementedError()

src/pyartnet/fades/fade_linear.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
class LinearFade(FadeBase):
55

6-
def __init__(self):
6+
def __init__(self) -> None:
77
super().__init__()
88
self.target: int = 0 # Target Value
99
self.current: float = 0.0 # Current Value
1010
self.factor: float = 1.0
1111

1212
def debug_initialize(self) -> str:
13-
return f"{self.current:03.0f} -> {self.target:03d} | step: {self.factor:+5.1f}"
13+
return f'{self.current:03.0f} -> {self.target:03d} | step: {self.factor:+5.1f}'
1414

15-
def initialize(self, start: int, target: int, steps: int):
15+
def initialize(self, start: int, target: int, steps: int) -> None:
1616
self.current = start
1717
self.target = target
1818
self.factor = (self.target - start) / steps

src/pyartnet/impl_artnet/node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pyartnet.base.seq_counter import SequenceCounter
77
from pyartnet.errors import InvalidUniverseAddressError
88

9+
910
# -----------------------------------------------------------------------------
1011
# Documentation for ArtNet Protocol:
1112
# https://artisticlicence.com/support-and-resources/art-net-4/
@@ -33,7 +34,7 @@ def __init__(self, ip: str, port: int, *,
3334

3435
# build base packet
3536
packet = bytearray()
36-
packet.extend(map(ord, "Art-Net"))
37+
packet.extend(map(ord, 'Art-Net'))
3738
packet.append(0x00) # Null terminate Art-Net
3839
self._packet_base = bytes(packet)
3940

src/pyartnet/impl_kinet/node.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pyartnet.base import BaseNode
88
from pyartnet.errors import InvalidUniverseAddressError
99

10+
1011
# -----------------------------------------------------------------------------
1112
# Documentation for KiNet Protocol:
1213
# todo: find links
@@ -27,8 +28,8 @@ def __init__(self, ip: str, port: int, *,
2728

2829
# build base packet
2930
packet = bytearray()
30-
packet.extend(s_pack(">IHH", 0x0401DC4A, 0x0100, 0x0101)) # Magic, version, type
31-
packet.extend(s_pack(">IBBHI", 0, 0, 0, 0, 0xFFFFFFFF)) # sequence, port, padding, flags, timer
31+
packet.extend(s_pack('>IHH', 0x0401DC4A, 0x0100, 0x0101)) # Magic, version, type
32+
packet.extend(s_pack('>IBBHI', 0, 0, 0, 0, 0xFFFFFFFF)) # sequence, port, padding, flags, timer
3233
self._packet_base = bytes(packet)
3334

3435
def _send_universe(self, id: int, byte_size: int,
@@ -41,7 +42,7 @@ def _send_universe(self, id: int, byte_size: int,
4142

4243
if log.isEnabledFor(LVL_DEBUG):
4344
# log complete packet
44-
log.debug(f"Sending KiNet frame to {self._ip}:{self._port}: {(self._packet_base + packet).hex()}")
45+
log.debug(f'Sending KiNet frame to {self._ip}:{self._port}: {(self._packet_base + packet).hex()}')
4546

4647
def _create_universe(self, nr: int) -> 'pyartnet.impl_kinet.KiNetUniverse':
4748
return pyartnet.impl_kinet.KiNetUniverse(self, self._validate_universe_nr(nr))

src/pyartnet/impl_sacn/node.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pyartnet.base import BaseNode, SequenceCounter
1010
from pyartnet.errors import InvalidCidError, InvalidUniverseAddressError
1111

12+
1213
# -----------------------------------------------------------------------------
1314
# Documentation for E1.31 Protocol:
1415
# https://tsp.esta.org/tsp/documents/published_docs.php
@@ -122,7 +123,7 @@ def _send_universe(self, id: int, byte_size: int, values: bytearray,
122123

123124
if log.isEnabledFor(LVL_DEBUG):
124125
# log complete packet
125-
log.debug(f"Sending sACN frame to {_dst_str(universe._dst)}: {(base_packet + packet).hex()}")
126+
log.debug(f'Sending sACN frame to {_dst_str(universe._dst)}: {(base_packet + packet).hex()}')
126127

127128
def _create_universe(self, nr: int) -> 'pyartnet.impl_sacn.SacnUniverse':
128129
return pyartnet.impl_sacn.SacnUniverse(self, self._validate_universe_nr(nr))
@@ -212,8 +213,8 @@ def _send_synchronization(self) -> None:
212213
if log.isEnabledFor(LVL_DEBUG):
213214
# log complete packet
214215
log.debug(
215-
f"Sending sACN Synchronization Packet to {_dst_str(self._sync_dst):s}: "
216-
f"{(base_packet + packet).hex()}"
216+
f'Sending sACN Synchronization Packet to {_dst_str(self._sync_dst):s}: '
217+
f'{(base_packet + packet).hex()}'
217218
)
218219

219220

tests/test_impl/test_sacn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async def test_sacn() -> None:
1111
sacn = SacnNode(
1212
'ip', 9999999,
1313
cid=b'\x41\x68\xf5\x2b\x1a\x7b\x2d\xe1\x17\x12\xe9\xee\x38\x3d\x22\x58',
14-
source_name="default source name",
14+
source_name='default source name',
1515
start_refresh_task=True
1616
)
1717

@@ -38,7 +38,7 @@ async def test_sacn_with_sync(caplog, multicast) -> None:
3838
sacn = SacnNode(
3939
'ip', 9999999,
4040
cid=b'\x41\x68\xf5\x2b\x1a\x7b\x2d\xe1\x17\x12\xe9\xee\x38\x3d\x22\x58',
41-
source_name="default source name",
41+
source_name='default source name',
4242
start_refresh_task=False
4343
)
4444
sacn.set_synchronous_mode(True, 2)

0 commit comments

Comments
 (0)