Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Drop python3.8 support #992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,14 @@ jobs:

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9", "pypy-3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12", "pypy-3.9", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
extras: [false, true]
exclude:
- os: macos-latest
extras: true
# setup-python not currently working with macos-latest
# https://github.com/actions/setup-python/issues/808
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.9"
- os: windows-latest
Expand All @@ -82,9 +80,6 @@ jobs:
- os: ubuntu-latest
python-version: "pypy-3.10"
extras: true
- os: ubuntu-latest
python-version: "3.8"
extras: true
- os: ubuntu-latest
python-version: "3.9"
extras: true
Expand Down
3 changes: 2 additions & 1 deletion kasa/aestransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
import hashlib
import logging
import time
from collections.abc import AsyncGenerator
from enum import Enum, auto
from typing import TYPE_CHECKING, Any, AsyncGenerator, Dict, cast
from typing import TYPE_CHECKING, Any, Dict, cast

from cryptography.hazmat.primitives import padding, serialization
from cryptography.hazmat.primitives.asymmetric import padding as asymmetric_padding
Expand Down
3 changes: 2 additions & 1 deletion kasa/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@

import logging
from abc import ABC, abstractmethod
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from datetime import datetime
from typing import TYPE_CHECKING, Any, Mapping, Sequence
from typing import TYPE_CHECKING, Any
from warnings import warn

from typing_extensions import TypeAlias
Expand Down
3 changes: 2 additions & 1 deletion kasa/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
import ipaddress
import logging
import socket
from typing import Awaitable, Callable, Dict, Optional, Type, cast
from collections.abc import Awaitable
from typing import Callable, Dict, Optional, Type, cast

# When support for cpython older than 3.11 is dropped
# async_timeout can be replaced with asyncio.timeout
Expand Down
2 changes: 1 addition & 1 deletion kasa/interfaces/lightpreset.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
from __future__ import annotations

from abc import abstractmethod
from typing import Sequence
from collections.abc import Sequence

from ..feature import Feature
from ..module import Module
Expand Down
3 changes: 2 additions & 1 deletion kasa/iot/iotdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
import functools
import inspect
import logging
from collections.abc import Mapping, Sequence
from datetime import datetime, timedelta, timezone
from typing import TYPE_CHECKING, Any, Mapping, Sequence, cast
from typing import TYPE_CHECKING, Any, cast

from ..device import Device, WifiNetwork
from ..deviceconfig import DeviceConfig
Expand Down
3 changes: 2 additions & 1 deletion kasa/iot/modules/lightpreset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from __future__ import annotations

from collections.abc import Sequence
from dataclasses import asdict
from typing import TYPE_CHECKING, Optional, Sequence
from typing import TYPE_CHECKING, Optional

from pydantic.v1 import BaseModel, Field

Expand Down
3 changes: 2 additions & 1 deletion kasa/smart/modules/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

import asyncio
import logging
from collections.abc import Coroutine
from datetime import date
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Optional
from typing import TYPE_CHECKING, Any, Callable, Optional

# When support for cpython older than 3.11 is dropped
# async_timeout can be replaced with asyncio.timeout
Expand Down
3 changes: 2 additions & 1 deletion kasa/smart/modules/lightpreset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from __future__ import annotations

from collections.abc import Sequence
from dataclasses import asdict
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING

from ...interfaces import LightPreset as LightPresetInterface
from ...interfaces import LightState
Expand Down
7 changes: 3 additions & 4 deletions kasa/smart/smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

import base64
import logging
from collections.abc import Mapping, Sequence
from datetime import datetime, timedelta, timezone
from typing import TYPE_CHECKING, Any, Mapping, Sequence, cast
from typing import Any, cast

from ..aestransport import AesTransport
from ..device import Device, WifiNetwork
Expand Down Expand Up @@ -97,9 +98,7 @@ def children(self) -> Sequence[SmartDevice]:
@property
def modules(self) -> ModuleMapping[SmartModule]:
"""Return the device modules."""
if TYPE_CHECKING: # Needed for python 3.8
return cast(ModuleMapping[SmartModule], self._modules)
return self._modules
return cast(ModuleMapping[SmartModule], self._modules)

def _try_get_response(self, responses: dict, request: str, default=None) -> dict:
response = responses.get(request)
Expand Down
2 changes: 1 addition & 1 deletion kasa/tests/device_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import AsyncGenerator
from collections.abc import AsyncGenerator

import pytest

Expand Down
7 changes: 4 additions & 3 deletions kasa/tests/test_iotdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ async def test_state_info(dev):
@pytest.mark.requires_dummy
@device_iot
async def test_invalid_connection(mocker, dev):
with mocker.patch.object(
FakeIotProtocol, "query", side_effect=KasaException
), pytest.raises(KasaException):
with (
mocker.patch.object(FakeIotProtocol, "query", side_effect=KasaException),
pytest.raises(KasaException),
):
await dev.update()


Expand Down
7 changes: 4 additions & 3 deletions kasa/tests/test_smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ async def test_update_no_device_info(dev: SmartDevice, mocker: MockerFixture):
"get_device_time": {},
}
msg = f"get_device_info not found in {mock_response} for device 127.0.0.123"
with mocker.patch.object(
dev.protocol, "query", return_value=mock_response
), pytest.raises(KasaException, match=msg):
with (
mocker.patch.object(dev.protocol, "query", return_value=mock_response),
pytest.raises(KasaException, match=msg),
):
await dev.update()


Expand Down
2 changes: 1 addition & 1 deletion kasa/xortransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import logging
import socket
import struct
from collections.abc import Generator
from pprint import pformat as pf
from typing import Generator

# When support for cpython older than 3.11 is dropped
# async_timeout can be replaced with asyncio.timeout
Expand Down
Loading
Loading