Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOL 3.8 #391

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
4 changes: 2 additions & 2 deletions m3u8/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,9 @@ def dumps(self, last_segment, timespec="milliseconds", infspec="auto"):
if self.uri:
if self.duration is not None:
if infspec == "milliseconds":
duration = "{:.3f}".format(self.duration)
duration = f"{self.duration:.3f}"
elif infspec == "microseconds":
duration = "{:.6f}".format(self.duration)
duration = f"{self.duration:.6f}"
else:
duration = number_to_string(self.duration)
output.append("#EXTINF:%s," % duration)
Expand Down
8 changes: 3 additions & 5 deletions m3u8/version_matching.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from typing import List

from m3u8 import protocol
from m3u8.version_matching_rules import VersionMatchingError, available_rules


def get_version(file_lines: List[str]):
def get_version(file_lines: list[str]):
for line in file_lines:
if line.startswith(protocol.ext_x_version):
version = line.split(":")[1]
Expand All @@ -15,7 +13,7 @@ def get_version(file_lines: List[str]):

def valid_in_all_rules(
line_number: int, line: str, version: float
) -> List[VersionMatchingError]:
) -> list[VersionMatchingError]:
errors = []
for rule in available_rules:
validator = rule(version, line_number, line)
Expand All @@ -26,7 +24,7 @@ def valid_in_all_rules(
return errors


def validate(file_lines: List[str]) -> List[VersionMatchingError]:
def validate(file_lines: list[str]) -> list[VersionMatchingError]:
found_version = get_version(file_lines)
if found_version is None:
return []
Expand Down
3 changes: 1 addition & 2 deletions m3u8/version_matching_rules.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from dataclasses import dataclass
from typing import List, Type

from m3u8 import protocol

Expand Down Expand Up @@ -102,7 +101,7 @@ def validate(self):
return self.version >= 4


available_rules: List[Type[VersionMatchRuleBase]] = [
available_rules: list[type[VersionMatchRuleBase]] = [
ValidIVInEXTXKEY,
ValidFloatingPointEXTINF,
ValidEXTXBYTERANGEOrEXTXIFRAMESONLY,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
description="Python m3u8 parser",
long_description=long_description,
long_description_content_type="text/markdown",
python_requires=">=3.7",
python_requires=">=3.9",
)
2 changes: 1 addition & 1 deletion tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def test_create_sub_directories_with_relative_path(tmpdir, monkeypatch):
expected_file_path = os.path.join(tmpdir, relative_path)
assert os.path.exists(expected_file_path)

with open(expected_file_path, "r") as file:
with open(expected_file_path) as file:
assert file.read().strip() == playlists.SIMPLE_PLAYLIST.strip()


Expand Down
Loading