Skip to content

Commit edbbf4d

Browse files
committed
fix remaining type issues
1 parent e406cd8 commit edbbf4d

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

livekit-rtc/livekit/rtc/_ffi_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
atexit.register(_resource_files.close)
3535

3636

37-
def _lib_name() -> str | None:
37+
def _lib_name() -> Optional[str]:
3838
if platform.system() == "Linux":
3939
return "liblivekit_ffi.so"
4040
elif platform.system() == "Darwin":

livekit-rtc/livekit/rtc/data_track.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def is_published(self) -> bool:
117117
req.local_data_track_is_published.track_handle = self._ffi_handle.handle
118118

119119
resp = FfiClient.instance.request(req)
120-
return resp.local_data_track_is_published.is_published
120+
return bool(resp.local_data_track_is_published.is_published)
121121

122122
async def unpublish(self) -> None:
123123
"""Unpublishes the track."""
@@ -181,7 +181,7 @@ def is_published(self) -> bool:
181181
req.remote_data_track_is_published.track_handle = self._ffi_handle.handle
182182

183183
resp = FfiClient.instance.request(req)
184-
return resp.remote_data_track_is_published.is_published
184+
return bool(resp.remote_data_track_is_published.is_published)
185185

186186
def __repr__(self) -> str:
187187
return (

livekit-rtc/livekit/rtc/room.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ async def disconnect(
648648

649649
req = proto_ffi.FfiRequest()
650650
req.disconnect.room_handle = self._ffi_handle.handle # type: ignore
651-
req.disconnect.reason = reason # type: ignore
651+
req.disconnect.reason = reason
652652
queue = FfiClient.instance.queue.subscribe()
653653
try:
654654
resp = FfiClient.instance.request(req)
@@ -884,7 +884,7 @@ def _on_room_event(self, event: proto_room.RoomEvent) -> None:
884884
participant,
885885
event.participant_encryption_status_changed.is_encrypted,
886886
)
887-
elif which == "participant_permissions_changed":
887+
elif which == "participant_permission_changed":
888888
identity = event.participant_permission_changed.participant_identity
889889
participant = self._retrieve_participant(identity)
890890
assert isinstance(participant, Participant)

livekit-rtc/tests/test_e2ee.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class TestKeyProviderOptions:
1919
"""Tests for KeyProviderOptions dataclass."""
2020

21-
def test_default_values(self):
21+
def test_default_values(self) -> None:
2222
"""Test that KeyProviderOptions has correct default values."""
2323
from livekit.rtc.e2ee import (
2424
KeyProviderOptions,
@@ -38,7 +38,7 @@ def test_default_values(self):
3838
assert options.key_ring_size == DEFAULT_KEY_RING_SIZE
3939
assert options.key_derivation_function == proto_e2ee.KeyDerivationFunction.PBKDF2
4040

41-
def test_custom_values(self):
41+
def test_custom_values(self) -> None:
4242
"""Test KeyProviderOptions with custom values."""
4343
from livekit.rtc.e2ee import KeyProviderOptions
4444
from livekit.rtc._proto import e2ee_pb2 as proto_e2ee
@@ -59,7 +59,7 @@ def test_custom_values(self):
5959
assert options.key_ring_size == 8
6060
assert options.key_derivation_function == proto_e2ee.KeyDerivationFunction.HKDF
6161

62-
def test_various_key_lengths(self):
62+
def test_various_key_lengths(self) -> None:
6363
"""Test that shared_key accepts various lengths."""
6464
from livekit.rtc.e2ee import KeyProviderOptions
6565

@@ -85,7 +85,7 @@ def test_various_key_lengths(self):
8585
class TestE2EEOptions:
8686
"""Tests for E2EEOptions dataclass."""
8787

88-
def test_default_values(self):
88+
def test_default_values(self) -> None:
8989
"""Test E2EEOptions default values."""
9090
from livekit.rtc.e2ee import E2EEOptions, KeyProviderOptions
9191
from livekit.rtc._proto import e2ee_pb2 as proto_e2ee
@@ -95,7 +95,7 @@ def test_default_values(self):
9595
assert isinstance(options.key_provider_options, KeyProviderOptions)
9696
assert options.encryption_type == proto_e2ee.EncryptionType.GCM
9797

98-
def test_with_shared_key(self):
98+
def test_with_shared_key(self) -> None:
9999
"""Test E2EEOptions with a shared key."""
100100
from livekit.rtc.e2ee import E2EEOptions, KeyProviderOptions
101101

@@ -108,7 +108,7 @@ def test_with_shared_key(self):
108108
class TestProtoMessageBuilding:
109109
"""Tests for proto message building with E2EE options."""
110110

111-
def test_proto_key_provider_options_fields(self):
111+
def test_proto_key_provider_options_fields(self) -> None:
112112
"""Test that proto KeyProviderOptions has all required fields."""
113113
from livekit.rtc._proto import e2ee_pb2 as proto_e2ee
114114

@@ -130,7 +130,7 @@ def test_proto_key_provider_options_fields(self):
130130
assert proto_options.key_ring_size == 16
131131
assert proto_options.key_derivation_function == proto_e2ee.KeyDerivationFunction.PBKDF2
132132

133-
def test_proto_serialization(self):
133+
def test_proto_serialization(self) -> None:
134134
"""Test that proto message can be serialized without errors."""
135135
from livekit.rtc._proto import e2ee_pb2 as proto_e2ee
136136

@@ -151,7 +151,7 @@ def test_proto_serialization(self):
151151
assert parsed.key_ring_size == 16
152152
assert parsed.key_derivation_function == proto_e2ee.KeyDerivationFunction.PBKDF2
153153

154-
def test_e2ee_options_proto_serialization(self):
154+
def test_e2ee_options_proto_serialization(self) -> None:
155155
"""Test full E2eeOptions proto serialization."""
156156
from livekit.rtc._proto import e2ee_pb2 as proto_e2ee
157157

@@ -174,23 +174,23 @@ def test_e2ee_options_proto_serialization(self):
174174
class TestPublicExports:
175175
"""Tests for public API exports."""
176176

177-
def test_key_derivation_function_exported(self):
177+
def test_key_derivation_function_exported(self) -> None:
178178
"""Test that KeyDerivationFunction is exported from the package."""
179179
from livekit.rtc import KeyDerivationFunction
180180

181181
# Verify enum values are accessible
182182
assert KeyDerivationFunction.PBKDF2 == 0
183183
assert KeyDerivationFunction.HKDF == 1
184184

185-
def test_encryption_type_exported(self):
185+
def test_encryption_type_exported(self) -> None:
186186
"""Test that EncryptionType is exported from the package."""
187187
from livekit.rtc import EncryptionType
188188

189189
assert EncryptionType.NONE == 0
190190
assert EncryptionType.GCM == 1
191191
assert EncryptionType.CUSTOM == 2
192192

193-
def test_e2ee_classes_exported(self):
193+
def test_e2ee_classes_exported(self) -> None:
194194
"""Test that E2EE classes are exported from the package."""
195195
from livekit.rtc import E2EEOptions, KeyProviderOptions
196196

0 commit comments

Comments
 (0)