From cee5ba74a9744ed9fc96d43cd793aded583978e3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Jul 2026 19:11:54 +0000 Subject: [PATCH 1/2] Fix CodeQL/AI code-quality findings: cls naming, unused vars --- motioneye_client/client.py | 6 +++--- tests/test_client.py | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/motioneye_client/client.py b/motioneye_client/client.py index 4cadc41..af97967 100755 --- a/motioneye_client/client.py +++ b/motioneye_client/client.py @@ -301,16 +301,16 @@ def get_image_url(self, camera_id: int, path: str, preview: bool = False) -> str ) @classmethod - def is_file_type_image(self, file_type: int) -> bool: + def is_file_type_image(cls, file_type: int) -> bool: """Determine if a file_type represents an image.""" # It's an image if the event file_type is <8. # See: https://github.com/Motion-Project/motion/blob/master/src/motion.h#L177 return file_type < 8 @classmethod - def is_file_type_movie(self, file_type: int) -> bool: + def is_file_type_movie(cls, file_type: int) -> bool: """Determine if a file_type represents an image.""" - return not self.is_file_type_image(file_type) + return not cls.is_file_type_image(file_type) async def async_get_movies( self, camera_id: int, prefix: str | None = None diff --git a/tests/test_client.py b/tests/test_client.py index a300217..fba96b3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -4,7 +4,6 @@ import asyncio from contextlib import closing -import logging import socket from typing import Any from unittest.mock import AsyncMock @@ -25,8 +24,6 @@ KEY_VIDEO_STREAMING, ) -_LOGGER = logging.getLogger(__name__) - async def _create_motioneye_server(aiohttp_server: Any, handlers: list[Any]) -> Any: app = web.Application() @@ -99,9 +96,6 @@ async def login_handler(request: web.Request) -> web.Response: async def test_cannot_connect(caplog: Any, aiohttp_server: Any) -> None: """Test a failed connection.""" - async def login_handler(request: web.Request) -> web.Response: - return web.Response(body="this is not json") - with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: s.bind(("localhost", 0)) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) From a4d218c6df2b3b43cb1a60cb38838192ef682333 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 20 Jul 2026 16:00:25 +0200 Subject: [PATCH 2/2] Apply suggestion from @MichaIng --- tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index fba96b3..2029c20 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -468,7 +468,7 @@ async def test_is_file_type_image() -> None: @pytest.mark.asyncio async def test_is_file_type_movie() -> None: - """Test is_file_type_image.""" + """Test is_file_type_movie.""" client = MotionEyeClient("http://localhost") assert not client.is_file_type_movie(0)