Skip to content

Commit 9f30c74

Browse files
authored
Merge pull request #189 from fltodd/bug/OscBundleType
OscBundleBuilder's contents and add_content function now have correct typing
2 parents 551d5ed + a17159c commit 9f30c74

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

pythonosc/dispatcher.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Maps OSC addresses to handler functions
2-
"""
1+
"""Maps OSC addresses to handler functions"""
32

43
import collections
54
import inspect

pythonosc/osc_bundle_builder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ def __init__(self, timestamp: int) -> None:
2525
seconds since the epoch in UTC or IMMEDIATELY.
2626
"""
2727
self._timestamp = timestamp
28-
self._contents: List[osc_bundle.OscBundle] = []
28+
self._contents: List[osc_bundle.OscBundle | osc_message.OscMessage] = []
2929

30-
def add_content(self, content: osc_bundle.OscBundle) -> None:
30+
def add_content(
31+
self, content: osc_bundle.OscBundle | osc_message.OscMessage
32+
) -> None:
3133
"""Add a new content to this bundle.
3234
3335
Args:

pythonosc/osc_message_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def add_arg(self, arg_value: ArgValue, arg_type: Optional[str] = None) -> None:
9696
arg_type = self._get_arg_type(arg_value)
9797
if isinstance(arg_type, list):
9898
self._args.append((self.ARG_TYPE_ARRAY_START, None))
99-
for v, t in zip(arg_value, arg_type): # type: ignore[var-annotated, arg-type]
99+
for v, t in zip(arg_value, arg_type): # type: ignore[arg-type]
100100
self.add_arg(v, t)
101101
self._args.append((self.ARG_TYPE_ARRAY_STOP, None))
102102
else:

pythonosc/osc_server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""OSC Servers that receive UDP packets and invoke handlers accordingly.
2-
"""
1+
"""OSC Servers that receive UDP packets and invoke handlers accordingly."""
32

43
import asyncio
54
import os

pythonosc/test/parsing/test_osc_types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def test_get_rgba(self):
8585
b"\x00\x00\x00\x01": (1, 4),
8686
b"\x00\x00\x00\x02": (2, 4),
8787
b"\x00\x00\x00\x03": (3, 4),
88-
b"\xFF\x00\x00\x00": (4278190080, 4),
89-
b"\x00\xFF\x00\x00": (16711680, 4),
90-
b"\x00\x00\xFF\x00": (65280, 4),
91-
b"\x00\x00\x00\xFF": (255, 4),
88+
b"\xff\x00\x00\x00": (4278190080, 4),
89+
b"\x00\xff\x00\x00": (16711680, 4),
90+
b"\x00\x00\xff\x00": (65280, 4),
91+
b"\x00\x00\x00\xff": (255, 4),
9292
b"\x00\x00\x00\x01GARBAGE": (1, 4),
9393
}
9494

@@ -164,7 +164,7 @@ def test_get_timetag(self):
164164
(datetime(1900, 1, 1, 0, 0, 0), 0),
165165
8,
166166
),
167-
b"\x83\xaa\x7E\x80\x0A\x00\xB0\x0C": (
167+
b"\x83\xaa\x7e\x80\x0a\x00\xb0\x0c": (
168168
(datetime(1970, 1, 1, 0, 0, 0), 167817228),
169169
8,
170170
),

0 commit comments

Comments
 (0)