mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
use tomllib from standard library on Python3.11+
This commit is contained in:
@@ -24,13 +24,18 @@ import dataclasses
|
|||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
import secrets
|
import secrets
|
||||||
|
import sys
|
||||||
from collections.abc import AsyncGenerator, Awaitable, Callable, Iterable, Sequence
|
from collections.abc import AsyncGenerator, Awaitable, Callable, Iterable, Sequence
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
)
|
)
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import tomli
|
|
||||||
|
if sys.version_info >= (3, 11):
|
||||||
|
import tomllib
|
||||||
|
else:
|
||||||
|
import tomli as tomllib
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import lc3 # type: ignore # pylint: disable=E0401
|
import lc3 # type: ignore # pylint: disable=E0401
|
||||||
@@ -114,7 +119,7 @@ def parse_broadcast_list(filename: str) -> Sequence[Broadcast]:
|
|||||||
broadcasts: list[Broadcast] = []
|
broadcasts: list[Broadcast] = []
|
||||||
|
|
||||||
with open(filename, "rb") as config_file:
|
with open(filename, "rb") as config_file:
|
||||||
config = tomli.load(config_file)
|
config = tomllib.load(config_file)
|
||||||
for broadcast in config.get("broadcasts", []):
|
for broadcast in config.get("broadcasts", []):
|
||||||
sources = []
|
sources = []
|
||||||
for source in broadcast.get("sources", []):
|
for source in broadcast.get("sources", []):
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ dependencies = [
|
|||||||
"pyserial-asyncio >= 0.5; platform_system!='Emscripten'",
|
"pyserial-asyncio >= 0.5; platform_system!='Emscripten'",
|
||||||
"pyserial >= 3.5; platform_system!='Emscripten'",
|
"pyserial >= 3.5; platform_system!='Emscripten'",
|
||||||
"pyusb >= 1.2; platform_system!='Emscripten'",
|
"pyusb >= 1.2; platform_system!='Emscripten'",
|
||||||
"tomli ~= 2.2.1; platform_system!='Emscripten'",
|
"tomli ~= 2.2.1; platform_system!='Emscripten'; python_version<'3.11'",
|
||||||
"websockets >= 15.0.1; platform_system!='Emscripten'",
|
"websockets >= 15.0.1; platform_system!='Emscripten'",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user