Skip to content

Commit

Permalink
Fix Python 3.8/3.9 compatibility.
Browse files Browse the repository at this point in the history
Using `datetime.UTC` inhibits running on the a.m. Python versions. Using now `datetime.timezone.utc` instead.

Signed-off-by: Philipp Kessling <[email protected]>
  • Loading branch information
pekasen committed Nov 8, 2024
1 parent 5112c83 commit ef1125e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spiderexpress/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class RawDataStore(Base):
connector_id: orm.Mapped[str] = orm.mapped_column(index=True)
output_type: orm.Mapped[str] = orm.mapped_column(index=True)
created_at: orm.Mapped[datetime.datetime] = orm.mapped_column(
index=True, insert_default=lambda: datetime.datetime.now(datetime.UTC)
index=True, insert_default=lambda: datetime.datetime.now(datetime.timezone.utc)
)
data: orm.Mapped[Dict] = orm.mapped_column(insert_default={})

Expand All @@ -103,7 +103,7 @@ class LayerDenseEdges(Base):
edge_type: orm.Mapped[str] = orm.mapped_column(index=True)
layer_id: orm.Mapped[str] = orm.mapped_column(index=True)
created_at: orm.Mapped[datetime.datetime] = orm.mapped_column(
index=True, insert_default=lambda: datetime.datetime.now(datetime.UTC)
index=True, insert_default=lambda: datetime.datetime.now(datetime.timezone.utc)
)
data: orm.Mapped[Dict] = orm.mapped_column(insert_default={})

Expand Down Expand Up @@ -137,7 +137,7 @@ class LayerDenseNodes(Base):
layer_id: orm.Mapped[str] = orm.mapped_column(index=True)
node_type: orm.Mapped[str] = orm.mapped_column(index=True)
created_at: orm.Mapped[datetime.datetime] = orm.mapped_column(
index=True, insert_default=lambda: datetime.datetime.now(datetime.UTC)
index=True, insert_default=lambda: datetime.datetime.now(datetime.timezone.utc)
)
data: orm.Mapped[Dict] = orm.mapped_column()

Expand Down Expand Up @@ -167,7 +167,7 @@ class LayerSparseEdges(Base):
edge_type: orm.Mapped[str] = orm.mapped_column(index=True)
weight: orm.Mapped[float] = orm.mapped_column()
created_at: orm.Mapped[datetime.datetime] = orm.mapped_column(
index=True, insert_default=lambda: datetime.datetime.now(datetime.UTC)
index=True, insert_default=lambda: datetime.datetime.now(datetime.timezone.utc)
)
data: orm.Mapped[Dict] = orm.mapped_column()

Expand Down Expand Up @@ -203,7 +203,7 @@ class LayerSparseNodes(Base):
name: orm.Mapped[str] = orm.mapped_column()
node_type: orm.Mapped[str] = orm.mapped_column(index=True)
created_at: orm.Mapped[datetime.datetime] = orm.mapped_column(
index=True, insert_default=lambda: datetime.datetime.now(datetime.UTC)
index=True, insert_default=lambda: datetime.datetime.now(datetime.timezone.utc)
)
data: orm.Mapped[Dict] = orm.mapped_column()

Expand Down Expand Up @@ -231,7 +231,7 @@ class SamplerStateStore(Base):
layer_id: orm.Mapped[str] = orm.mapped_column(index=True)
data: orm.Mapped[Dict] = orm.mapped_column()
created_at: orm.Mapped[datetime.datetime] = orm.mapped_column(
insert_default=lambda: datetime.datetime.now(datetime.UTC)
insert_default=lambda: datetime.datetime.now(datetime.timezone.utc)
)


Expand Down

0 comments on commit ef1125e

Please sign in to comment.