kopia lustrzana https://github.com/Yakifo/amqtt
typer uses a syntax that disagrees with B008, added lint bypass for this case
rodzic
582f8b16c7
commit
bb3ec6e683
|
@ -3,10 +3,8 @@ from collections import deque # pylint: disable=C0412
|
|||
from typing import SupportsIndex, SupportsInt # pylint: disable=C0412
|
||||
|
||||
try:
|
||||
from collections import deque
|
||||
from collections.abc import Buffer
|
||||
except ImportError:
|
||||
from collections import deque
|
||||
from typing import Protocol, runtime_checkable
|
||||
|
||||
@runtime_checkable
|
||||
|
|
|
@ -18,7 +18,6 @@ from pathlib import Path
|
|||
|
||||
import typer
|
||||
|
||||
import amqtt
|
||||
from amqtt import __version__ as amqtt_version
|
||||
from amqtt.broker import Broker
|
||||
from amqtt.utils import read_yaml_config
|
||||
|
@ -64,7 +63,7 @@ def broker_main(
|
|||
help="Show version and exit",
|
||||
),
|
||||
) -> None:
|
||||
|
||||
"""Run the MQTT broker."""
|
||||
formatter = "[%(asctime)s] :: %(levelname)s - %(message)s"
|
||||
|
||||
level = logging.DEBUG if debug else logging.INFO
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import asyncio
|
||||
import contextlib
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
import socket
|
||||
import sys
|
||||
from typing import Any, List
|
||||
from typing import Any
|
||||
|
||||
import typer
|
||||
|
||||
|
@ -43,7 +43,7 @@ class CAInfo:
|
|||
|
||||
async def do_sub(client: MQTTClient,
|
||||
url: str,
|
||||
topics: List[str],
|
||||
topics: list[str],
|
||||
ca_info: CAInfo,
|
||||
max_count: int | None = None,
|
||||
clean_session: bool = False,
|
||||
|
@ -91,6 +91,7 @@ async def do_sub(client: MQTTClient,
|
|||
|
||||
|
||||
def main() -> None:
|
||||
"""Entry point for the amqtt subscriber."""
|
||||
typer.run(subscribe_main)
|
||||
|
||||
|
||||
|
@ -106,7 +107,7 @@ def subscribe_main( # pylint: disable=R0914,R0917 # noqa : PLR0913
|
|||
client_id: str | None = typer.Option(None, "-i", help="Id to use as client ID"),
|
||||
max_count: int | None = typer.Option(None, "-n", help="Number of messages to read before ending"),
|
||||
qos: int = typer.Option(0, "--qos", "-q", help="Quality of service (0, 1, or 2)"),
|
||||
topics: List[str] = typer.Option(..., "-t", help="Topic filter to subscribe"),
|
||||
topics: list[str] = typer.Option(..., "-t", help="Topic filter to subscribe"), # noqa: B008
|
||||
keep_alive: int | None = typer.Option(None, "-k", help="Keep alive timeout in seconds"),
|
||||
clean_session: bool = typer.Option(False, help="Clean session on connect (defaults to False)"),
|
||||
ca_file: str | None = typer.Option(None, "--ca-file", help="CA file"),
|
||||
|
@ -127,7 +128,6 @@ def subscribe_main( # pylint: disable=R0914,R0917 # noqa : PLR0913
|
|||
),
|
||||
) -> None:
|
||||
"""Run the MQTT subscriber."""
|
||||
|
||||
formatter = "[%(asctime)s] :: %(levelname)s - %(message)s"
|
||||
level = logging.DEBUG if debug else logging.INFO
|
||||
logging.basicConfig(level=level, format=formatter)
|
||||
|
|
|
@ -124,7 +124,7 @@ ignore = [
|
|||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests/**" = ["ALL"]
|
||||
"amqtt/scripts/pub_script.py" = ["FBT003"]
|
||||
"amqtt/scripts/*_script.py" = ["FBT003"]
|
||||
|
||||
[tool.ruff.lint.flake8-pytest-style]
|
||||
fixture-parentheses = false
|
||||
|
|
Ładowanie…
Reference in New Issue