Remove support for python <3.11 (#1273)

Python 3.11 ships with latest Debian Bookworm. 
pypy is not that widely used with this library based on statistics. It could be added back when pypy supports python 3.11.
This commit is contained in:
Steven B.
2024-11-18 18:46:36 +00:00
committed by GitHub
parent 0c40939624
commit a01247d48f
55 changed files with 176 additions and 620 deletions

View File

@@ -1,7 +1,7 @@
"""Original implementation of the TP-Link Smart Home protocol."""
import struct
from typing import Generator
from collections.abc import Generator
class OriginalTPLinkSmartHomeProtocol:

View File

@@ -315,7 +315,7 @@ async def cli(
credentials = Credentials(username=username, password=password)
if host is not None:
if discovery_info:
click.echo("Host and discovery info given, trying connect on %s." % host)
click.echo(f"Host and discovery info given, trying connect on {host}.")
di = json.loads(discovery_info)
dr = DiscoveryResult.from_dict(di)
@@ -358,7 +358,7 @@ async def cli(
"Could not find a protocol for the given parameters."
)
else:
click.echo("Host given, performing discovery on %s." % host)
click.echo(f"Host given, performing discovery on {host}.")
device = await Discover.discover_single(
host,
credentials=credentials,
@@ -374,13 +374,13 @@ async def cli(
)
else:
click.echo(
"No --host given, performing discovery on %s. Use --target to override."
% target
"No --host given, performing discovery on"
f" {target}. Use --target to override."
)
devices = await Discover.discover(
target=target, credentials=credentials, discovery_timeout=discovery_timeout
)
click.echo("Detected %s devices" % len(devices))
click.echo(f"Detected {len(devices)} devices")
for dev in devices.values():
await handle_device(
basedir,
@@ -446,7 +446,7 @@ async def get_legacy_fixture(
dr = DiscoveryResult.from_dict(discovery_info)
final["discovery_result"] = dr.to_dict()
click.echo("Got %s successes" % len(successes))
click.echo(f"Got {len(successes)} successes")
click.echo(click.style("## device info file ##", bold=True))
sysinfo = final["system"]["get_sysinfo"]
@@ -959,7 +959,7 @@ async def get_smart_fixtures(
dr = DiscoveryResult.from_dict(discovery_info) # type: ignore
final["discovery_result"] = dr.to_dict()
click.echo("Got %s successes" % len(successes))
click.echo(f"Got {len(successes)} successes")
click.echo(click.style("## device info file ##", bold=True))
if "get_device_info" in final:

View File

@@ -67,7 +67,7 @@ def parse_pcap(file):
for module, cmds in json_payload.items():
seen_items["modules"][module] += 1
if "err_code" in cmds:
echo("[red]Got error for module: %s[/red]" % cmds)
echo(f"[red]Got error for module: {cmds}[/red]")
continue
for cmd, response in cmds.items():