diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd84fec3..1c361d73 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: diff --git a/m3u8/model.py b/m3u8/model.py index 9bc16071..1dc7a5e4 100644 --- a/m3u8/model.py +++ b/m3u8/model.py @@ -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) diff --git a/m3u8/version_matching.py b/m3u8/version_matching.py index 3d0a712f..b9e653e9 100644 --- a/m3u8/version_matching.py +++ b/m3u8/version_matching.py @@ -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] @@ -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) @@ -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 [] diff --git a/m3u8/version_matching_rules.py b/m3u8/version_matching_rules.py index 55be5db2..fae77dd0 100644 --- a/m3u8/version_matching_rules.py +++ b/m3u8/version_matching_rules.py @@ -1,5 +1,4 @@ from dataclasses import dataclass -from typing import List, Type from m3u8 import protocol @@ -102,7 +101,7 @@ def validate(self): return self.version >= 4 -available_rules: List[Type[VersionMatchRuleBase]] = [ +available_rules: list[type[VersionMatchRuleBase]] = [ ValidIVInEXTXKEY, ValidFloatingPointEXTINF, ValidEXTXBYTERANGEOrEXTXIFRAMESONLY, diff --git a/setup.py b/setup.py index 237d7aeb..8ec1ff96 100644 --- a/setup.py +++ b/setup.py @@ -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", ) diff --git a/tests/test_model.py b/tests/test_model.py index 8185fe38..da47a483 100755 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -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()