Skip to content

Commit

Permalink
refactor: resolve timezone-related python 3.12 deprecations (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson authored Aug 26, 2024
1 parent b6a3fab commit 84a5408
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/biocommons/seqrepo/fastadir/fastadir.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def store(self, seq_id: str, seq: str) -> str:
# <------ dir_ ----->
# <----------- path ----------->
if self._writing is None:
reldir = datetime.datetime.utcnow().strftime("%Y/%m%d/%H%M")
reldir = datetime.datetime.now(datetime.timezone.utc).strftime("%Y/%m%d/%H%M")
basename = str(time.time()) + ".fa.bgz"
relpath = os.path.join(reldir, basename)

Expand Down
4 changes: 4 additions & 0 deletions src/biocommons/seqrepo/seqaliasdb/seqaliasdb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime
import logging
import sqlite3
from importlib import resources
Expand All @@ -22,6 +23,9 @@
raise ImportError(msg)


sqlite3.register_converter("timestamp", lambda val: datetime.datetime.fromisoformat(val.decode()))


class SeqAliasDB(object):
"""Implements a sqlite database of sequence aliases"""

Expand Down

0 comments on commit 84a5408

Please sign in to comment.