Skip to content

Commit

Permalink
fix: dataclass backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Feb 7, 2025
1 parent be4f388 commit df9be7e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lstm/model_state.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from __future__ import annotations

import sys
import typing
from dataclasses import dataclass

import numpy.typing as npt

# `slots` feature added to of `dataclass` in 3.10
# see: https://docs.python.org/3.12/library/dataclasses.html#dataclasses.dataclass
if sys.version_info < (3, 10):
dataclass_kwargs = {}
else:
dataclass_kwargs = {"slots": True}

@dataclass(slots=True)

@dataclass(**dataclass_kwargs)
class Var:
"""
State variable representation.
Expand Down

0 comments on commit df9be7e

Please sign in to comment.