feat: drop Python 3.6 support
This commit is contained in:
parent
448cff7600
commit
d29d837d01
|
@ -18,7 +18,7 @@ setup(
|
|||
"libretime-analyzer=libretime_analyzer.main:cli",
|
||||
]
|
||||
},
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7",
|
||||
install_requires=[
|
||||
"mutagen>=1.45.1,<1.47",
|
||||
"pika>=1.0.0,<1.4",
|
||||
|
|
|
@ -14,7 +14,7 @@ setup(
|
|||
license="AGPLv3",
|
||||
packages=find_packages(exclude=["*tests*", "*fixtures*"]),
|
||||
package_data={"": ["py.typed"]},
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7",
|
||||
install_requires=[
|
||||
"python-dateutil>=2.8.1,<2.9",
|
||||
"requests>=2.25.1,<2.29",
|
||||
|
|
|
@ -17,7 +17,7 @@ setup(
|
|||
"libretime_api": ["legacy/migrations/sql/*.sql"],
|
||||
},
|
||||
include_package_data=True,
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7",
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"libretime-api=libretime_api.manage:main",
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, time, timedelta
|
||||
from operator import itemgetter
|
||||
from typing import Dict
|
||||
|
||||
from dateutil.parser import isoparse
|
||||
from libretime_api_client.v2 import ApiClient
|
||||
from libretime_shared.datetime import (
|
||||
time_fromisoformat,
|
||||
time_in_milliseconds,
|
||||
time_in_seconds,
|
||||
)
|
||||
from libretime_shared.datetime import time_in_milliseconds, time_in_seconds
|
||||
|
||||
from ..liquidsoap.models import StreamPreferences
|
||||
from .events import EventKind
|
||||
|
@ -134,10 +130,10 @@ def generate_file_events(
|
|||
# Show data
|
||||
"show_name": show["name"],
|
||||
# Extra data
|
||||
"fade_in": time_in_milliseconds(time_fromisoformat(schedule["fade_in"])),
|
||||
"fade_out": time_in_milliseconds(time_fromisoformat(schedule["fade_out"])),
|
||||
"cue_in": time_in_seconds(time_fromisoformat(schedule["cue_in"])),
|
||||
"cue_out": time_in_seconds(time_fromisoformat(schedule["cue_out"])),
|
||||
"fade_in": time_in_milliseconds(time.fromisoformat(schedule["fade_in"])),
|
||||
"fade_out": time_in_milliseconds(time.fromisoformat(schedule["fade_out"])),
|
||||
"cue_in": time_in_seconds(time.fromisoformat(schedule["cue_in"])),
|
||||
"cue_out": time_in_seconds(time.fromisoformat(schedule["cue_out"])),
|
||||
"metadata": {
|
||||
"track_title": file["track_title"],
|
||||
"artist_name": file["artist_name"],
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Please do not edit this file, edit the setup.py file!
|
||||
# This file is auto-generated by tools/extract_requirements.py.
|
||||
backports.zoneinfo>=0.2.1,<0.3;python_version<'3.9'
|
||||
dataclasses>=0.8,<0.9;python_version<'3.7'
|
||||
jinja2>=3.0.3,<3.2
|
||||
kombu==4.6.11
|
||||
lxml>=4.5.0,<4.10.0
|
||||
|
|
|
@ -21,10 +21,9 @@ setup(
|
|||
"libretime-playout-notify=libretime_playout.notify.main:cli",
|
||||
]
|
||||
},
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7",
|
||||
install_requires=[
|
||||
"backports.zoneinfo>=0.2.1,<0.3;python_version<'3.9'",
|
||||
"dataclasses>=0.8,<0.9;python_version<'3.7'",
|
||||
"jinja2>=3.0.3,<3.2",
|
||||
"kombu==4.6.11",
|
||||
"lxml>=4.5.0,<4.10.0",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from datetime import datetime, time
|
||||
from datetime import time
|
||||
|
||||
|
||||
def time_in_seconds(value: time) -> float:
|
||||
|
@ -12,16 +12,3 @@ def time_in_seconds(value: time) -> float:
|
|||
|
||||
def time_in_milliseconds(value: time) -> float:
|
||||
return time_in_seconds(value) * 1000
|
||||
|
||||
|
||||
def time_fromisoformat(value: str) -> time:
|
||||
"""
|
||||
This is required for Python 3.6 support. datetime.time.fromisoformat was
|
||||
only added in Python 3.7. Until LibreTime drops Python 3.6 support, this
|
||||
wrapper uses the old way of doing it.
|
||||
"""
|
||||
try:
|
||||
obj = datetime.strptime(value, "%H:%M:%S.%f")
|
||||
except ValueError:
|
||||
obj = datetime.strptime(value, "%H:%M:%S")
|
||||
return obj.time()
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
from datetime import time
|
||||
|
||||
from pytest import approx, mark
|
||||
from pytest import approx
|
||||
|
||||
from libretime_shared.datetime import (
|
||||
time_fromisoformat,
|
||||
time_in_milliseconds,
|
||||
time_in_seconds,
|
||||
)
|
||||
from libretime_shared.datetime import time_in_milliseconds, time_in_seconds
|
||||
|
||||
|
||||
def test_time_in_seconds():
|
||||
|
@ -17,15 +13,3 @@ def test_time_in_seconds():
|
|||
def test_time_in_milliseconds():
|
||||
value = time(hour=0, minute=0, second=0, microsecond=500000)
|
||||
assert time_in_milliseconds(value) == 500
|
||||
|
||||
|
||||
@mark.parametrize(
|
||||
"payload, expected",
|
||||
[
|
||||
("00:00:00.500000", time(microsecond=500000)),
|
||||
("00:04:30.092540", time(minute=4, second=30, microsecond=92540)),
|
||||
("00:04:30", time(minute=4, second=30)),
|
||||
],
|
||||
)
|
||||
def test_time_fromisoformat(payload, expected):
|
||||
assert time_fromisoformat(payload) == expected
|
||||
|
|
|
@ -13,7 +13,7 @@ setup(
|
|||
},
|
||||
license="MIT",
|
||||
packages=find_packages(exclude=["*tests*", "*fixtures*"]),
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7",
|
||||
install_requires=[
|
||||
"celery==4.4.7",
|
||||
"kombu==4.6.11",
|
||||
|
|
Loading…
Reference in New Issue