diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a564d3f..b72c258 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -3,11 +3,7 @@ name: Python package -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -16,12 +12,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/aranet4/client.py b/aranet4/client.py index 155aa38..380f2e2 100644 --- a/aranet4/client.py +++ b/aranet4/client.py @@ -5,7 +5,7 @@ import re import struct import math -from typing import List, NamedTuple +from typing import NamedTuple from bleak import BleakClient from bleak import BleakScanner @@ -534,7 +534,7 @@ class Record: version: str records_on_device: int filter: Filter - value: List[RecordItem] = field(default_factory=list) + value: list[RecordItem] = field(default_factory=list) @dataclass @@ -1085,7 +1085,7 @@ async def stop(self): await self.scanner.stop() -async def _find_nearby(detect_callback: callable, duration: int) -> List[BLEDevice]: +async def _find_nearby(detect_callback: callable, duration: int) -> list[BLEDevice]: scanner = Aranet4Scanner(detect_callback) await scanner.start() await asyncio.sleep(duration) @@ -1095,7 +1095,7 @@ async def _find_nearby(detect_callback: callable, duration: int) -> List[BLEDevi if "Aranet" in device.name] -def find_nearby(detect_callback: callable, duration: int = 5) -> List[BLEDevice]: +def find_nearby(detect_callback: callable, duration: int = 5) -> list[BLEDevice]: """ Scans for nearby Aranet4 devices. Will call callback on every valid Aranet4 advertisement, including duplicates diff --git a/examples/influx/import.py b/examples/influx/import.py index d62ab2a..11cd780 100644 --- a/examples/influx/import.py +++ b/examples/influx/import.py @@ -28,7 +28,7 @@ def main(argv): results = [] device_name = argv[1] - with open(file=argv[0], mode="r", encoding="utf-8") as file: + with open(file=argv[0], encoding="utf-8") as file: lines = file.readlines() for ln in lines: diff --git a/setup.py b/setup.py index 83d8668..f07418b 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import setuptools -with open(file="README.md", mode="r", encoding="utf-8") as file: +with open(file="README.md", encoding="utf-8") as file: long_description = file.read() setuptools.setup( @@ -11,6 +11,7 @@ long_description_content_type="text/markdown", url="https://github.com/Anrijs/Aranet4-Python", packages=setuptools.find_packages(), + python_requires=">=3.10", classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", diff --git a/tests/test_csv.py b/tests/test_csv.py index ed15e4f..35f481f 100644 --- a/tests/test_csv.py +++ b/tests/test_csv.py @@ -14,7 +14,7 @@ def build_data(): log_filter = client.Filter(1, 14, True, True, True, True, True, True, True, True) records = client.Record("mock_device", "v1234", 14, log_filter) - with open(file=data_file, mode="r", encoding="utf-8") as csv_file: + with open(file=data_file, encoding="utf-8") as csv_file: reader = csv.DictReader(csv_file) for row in reader: records.value.append(client.RecordItem(**row))