Skip to content

Commit 185559a

Browse files
committed
chore(python_sdk): Fix linting issues after bumping PyLint
1 parent 3d84a90 commit 185559a

File tree

10 files changed

+1115
-1025
lines changed

10 files changed

+1115
-1025
lines changed

demos/python/sdk_wireless_camera_control/open_gopro/features/streaming/stream_feature.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ async def start_stream(
113113

114114
self._current = controller
115115
logger.info(f"Starting {stream_type.name.title()} stream")
116-
match (result := await self._current.start(options)):
116+
# Type checker can't narrow the union type based on runtime isinstance checks
117+
match (result := await self._current.start(options)): # type: ignore[arg-type]
117118
case Success():
118119
logger.info("Stream started successfully.")
119120
case Failure():

demos/python/sdk_wireless_camera_control/open_gopro/gopro_base.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,6 @@ class _InternalState(enum.IntFlag):
301301
def ip_address(self) -> str:
302302
"""The IP address of the GoPro device
303303
304-
Raises:
305-
GoProNotOpened: The GoPro IP address is not yet available
306-
307304
Returns:
308305
str: IP address
309306
"""
@@ -369,7 +366,7 @@ def _build_http_request_args(self, message: HttpMessage) -> dict[str, Any]:
369366
return request_args
370367

371368
@enforce_message_rules
372-
async def _get_json(
369+
async def _get_json( # type: ignore[override]
373370
self,
374371
message: HttpMessage,
375372
*,
@@ -407,7 +404,7 @@ async def _get_json(
407404
return response
408405

409406
@enforce_message_rules
410-
async def _get_stream(
407+
async def _get_stream( # type: ignore[override]
411408
self,
412409
message: HttpMessage,
413410
*,
@@ -433,7 +430,7 @@ async def _get_stream(
433430
return GoProResp(protocol=GoProResp.Protocol.HTTP, status=ErrorCode.SUCCESS, data=file, identifier=url)
434431

435432
@enforce_message_rules
436-
async def _put_json(
433+
async def _put_json( # type: ignore[override]
437434
self,
438435
message: HttpMessage,
439436
*,

demos/python/sdk_wireless_camera_control/open_gopro/gopro_wireless.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -848,17 +848,17 @@ def _handle_cohn(self, message: HttpMessage) -> HttpMessage:
848848
except GoProNotOpened:
849849
return message
850850

851-
async def _get_json(self, message: HttpMessage, *args: Any, **kwargs: Any) -> GoProResp:
851+
async def _get_json(self, message: HttpMessage, *args: Any, **kwargs: Any) -> GoProResp: # type: ignore[override]
852852
message = self._handle_cohn(message)
853-
return await super()._get_json(*args, message=message, **kwargs)
853+
return await super()._get_json(*args, message=message, **kwargs) # type: ignore[call-arg]
854854

855-
async def _get_stream(self, message: HttpMessage, *args: Any, **kwargs: Any) -> GoProResp:
855+
async def _get_stream(self, message: HttpMessage, *args: Any, **kwargs: Any) -> GoProResp: # type: ignore[override]
856856
message = self._handle_cohn(message)
857-
return await super()._get_stream(*args, message=message, **kwargs)
857+
return await super()._get_stream(*args, message=message, **kwargs) # type: ignore[call-arg]
858858

859-
async def _put_json(self, message: HttpMessage, *args: Any, **kwargs: Any) -> GoProResp:
859+
async def _put_json(self, message: HttpMessage, *args: Any, **kwargs: Any) -> GoProResp: # type: ignore[override]
860860
message = self._handle_cohn(message)
861-
return await super()._put_json(*args, message=message, **kwargs)
861+
return await super()._put_json(*args, message=message, **kwargs) # type: ignore[call-arg]
862862

863863
@GoProBase._ensure_opened((GoProMessageInterface.BLE,))
864864
async def _open_wifi(self, timeout: int = 30, retries: int = 5) -> None:

demos/python/sdk_wireless_camera_control/open_gopro/models/network_scan_responses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
class Hexlify(Adapter):
3636
"""Construct adapter for pretty hex representation"""
3737

38-
def _decode(self, obj: bytes, context: Any, path: Any) -> str:
38+
def _decode(self, obj: bytes, context: Any, path: Any) -> str: # pylint: disable=unused-argument
3939
return obj.hex(":")
4040

41-
def _encode(self, obj: str, context: Any, path: Any) -> list[int]:
41+
def _encode(self, obj: str, context: Any, path: Any) -> list[int]: # pylint: disable=unused-argument
4242
return list(map(int, obj.split(":")))
4343

4444

demos/python/sdk_wireless_camera_control/open_gopro/network/ble/adapters/bleak_wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import bleak
1616
import pexpect
17+
from bleak.assigned_numbers import CharacteristicPropertyName
1718
from bleak.backends.characteristic import BleakGATTCharacteristic
1819
from bleak.backends.device import BLEDevice as BleakDevice
1920
from bleak.backends.scanner import AdvertisementData
@@ -344,11 +345,11 @@ async def discover_chars(self, handle: bleak.BleakClient, uuids: type[UUIDs] | N
344345
GattDB: Gatt Database
345346
"""
346347

347-
def bleak_props_adapter(bleak_props: list[str]) -> CharProps:
348+
def bleak_props_adapter(bleak_props: list[CharacteristicPropertyName]) -> CharProps:
348349
"""Convert a list of bleak string properties into a CharProps
349350
350351
Args:
351-
bleak_props (list[str]): bleak strings to convert
352+
bleak_props (list[CharacteristicPropertyName]): bleak strings to convert
352353
353354
Returns:
354355
CharProps: converted Enum

demos/python/sdk_wireless_camera_control/open_gopro/network/ble/services.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class Characteristic:
180180
def __post_init__(self, init_descriptors: Optional[list[Descriptor]]) -> None:
181181
self._descriptors: dict[BleUUID, Descriptor] = {}
182182
# Mypy should eventually support this: see https://github.com/python/mypy/issues/3004
183-
self.descriptors = init_descriptors or [] # type: ignore
183+
self.descriptors = init_descriptors or []
184184
if self.descriptor_handle is None:
185185
self.descriptor_handle = self.handle + 1
186186

@@ -296,7 +296,7 @@ class Service:
296296
def __post_init__(self, init_characteristics: Optional[list[Characteristic]]) -> None:
297297
self._characteristics: dict[BleUUID, Characteristic] = {}
298298
# Mypy should eventually support this: see https://github.com/python/mypy/issues/3004
299-
self.characteristics = init_characteristics or [] # type: ignore
299+
self.characteristics = init_characteristics or []
300300

301301
def __str__(self) -> str:
302302
return self.name
@@ -408,7 +408,7 @@ def iter_items():
408408
def __init__(self, init_services: list[Service]) -> None:
409409
self._services: dict[BleUUID, Service] = {}
410410
# Mypy should eventually support this: see https://github.com/python/mypy/issues/3004
411-
self.services = init_services # type: ignore
411+
self.services = init_services
412412
self.characteristics = self.CharacteristicView(self)
413413

414414
@property

demos/python/sdk_wireless_camera_control/open_gopro/network/wifi/adapters/wireless.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, interface: str | None = None, password: str | None = None) ->
8989
self._driver = self._detect_driver()
9090

9191
# Attempt to set interface (will raise an exception if not able to auto-detect)
92-
self.interface = interface # type: ignore
92+
self.interface = interface
9393

9494
logger.debug(f"Wifi setup. Using {self}")
9595

@@ -230,7 +230,7 @@ def interface(self, interface: str | None) -> None:
230230
Args:
231231
interface (str | None): interface (or None)
232232
"""
233-
self._driver.interface = interface # type: ignore
233+
self._driver.interface = interface
234234

235235
@property
236236
def is_on(self) -> bool:

0 commit comments

Comments
 (0)