Skip to content

Commit

Permalink
Use backport of built-in function for performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
daveisfera committed Oct 16, 2023
1 parent 024e9bf commit bb558f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions m3u8/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from urllib.parse import urljoin as _urljoin

try:
from iso8601 import parse_date
from backports.datetime_fromisoformat import MonkeyPatch
MonkeyPatch.patch_fromisoformat()
except ImportError:
parse_date = datetime.datetime.fromisoformat
pass


from m3u8 import protocol
Expand All @@ -24,7 +25,7 @@


def cast_date_time(value):
return parse_date(value)
return datetime.datetime.fromisoformat(value)


def format_date_time(value, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
iso8601; python_version < '3.11'
backports-datetime-fromisoformat; python_version < '3.11'

0 comments on commit bb558f5

Please sign in to comment.