refactor: upgrade code to Python 3.8
This commit is contained in:
parent
92ac838383
commit
0e1dfaa9ff
|
@ -39,7 +39,7 @@ repos:
|
|||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py36-plus]
|
||||
args: [--py38-plus]
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.10.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from subprocess import PIPE, CalledProcessError, CompletedProcess, run
|
||||
from subprocess import CalledProcessError, CompletedProcess, run
|
||||
|
||||
from loguru import logger
|
||||
|
||||
|
@ -8,9 +8,8 @@ def run_(*args, **kwargs) -> CompletedProcess:
|
|||
return run(
|
||||
args,
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
universal_newlines=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
from enum import Enum
|
||||
from queue import Queue
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, Protocol
|
||||
|
||||
from loguru import logger
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from .analyze_cuepoint import analyze_cuepoint
|
||||
from .analyze_metadata import analyze_metadata
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from pathlib import Path
|
||||
from typing import List
|
||||
from typing import List, Literal
|
||||
|
||||
from libretime_shared.config import (
|
||||
BaseConfig,
|
||||
|
@ -8,7 +8,6 @@ from libretime_shared.config import (
|
|||
StreamConfig,
|
||||
)
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Literal
|
||||
|
||||
CACHE_DIR = Path.cwd() / "scheduler"
|
||||
RECORD_DIR = Path.cwd() / "recorder"
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from pathlib import Path
|
||||
from subprocess import CalledProcessError, check_output, run
|
||||
from time import sleep
|
||||
from typing import Any, Optional, Tuple
|
||||
from typing import Any, Literal, Optional, Tuple
|
||||
|
||||
from loguru import logger
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ..version import parse_liquidsoap_version
|
||||
from ._connection import LiquidsoapConnection
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import re
|
||||
from subprocess import PIPE, run
|
||||
from subprocess import run
|
||||
from typing import Tuple
|
||||
|
||||
LIQUIDSOAP_VERSION_RE = re.compile(r"(?:Liquidsoap )?(\d+).(\d+).(\d+)")
|
||||
|
@ -18,9 +18,8 @@ def get_liquidsoap_version() -> Tuple[int, int, int]:
|
|||
cmd = run(
|
||||
("liquidsoap", "--check", "print(liquidsoap.version) shutdown()"),
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
universal_newlines=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
|
||||
return parse_liquidsoap_version(cmd.stdout)
|
||||
|
|
|
@ -67,7 +67,7 @@ def liq_conn_fixture(request, tmp_path_factory):
|
|||
("liquidsoap", "--debug", str(entrypoint)),
|
||||
stdout=PIPE,
|
||||
stderr=STDOUT,
|
||||
universal_newlines=True,
|
||||
text=True,
|
||||
) as process:
|
||||
if request.param == "telnet":
|
||||
sleep(2)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, Any, List, Optional, Sequence, Union
|
||||
from typing import TYPE_CHECKING, Any, List, Literal, Optional, Sequence, Union
|
||||
|
||||
# pylint: disable=no-name-in-module
|
||||
from pydantic import AnyHttpUrl, AnyUrl, BaseModel, Field, validator
|
||||
from typing_extensions import Annotated, Literal
|
||||
from typing_extensions import Annotated
|
||||
|
||||
try:
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
|
Loading…
Reference in New Issue