From df2db4a7e18259cda26c6c1d3916b151d7b4e5e2 Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Thu, 28 Nov 2024 14:14:55 +0000 Subject: [PATCH] test: fix mypy errors --- pysr/expression_specs.py | 5 +++-- pysr/sr.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pysr/expression_specs.py b/pysr/expression_specs.py index 858bcf73..473cdad8 100644 --- a/pysr/expression_specs.py +++ b/pysr/expression_specs.py @@ -1,10 +1,11 @@ import copy +import sys from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any, Dict, List, NewType, Optional -try: +if sys.version_info >= (3, 10): from typing import TypeAlias -except ImportError: +else: from typing_extensions import TypeAlias import numpy as np diff --git a/pysr/sr.py b/pysr/sr.py index e644d8f5..df11cca5 100644 --- a/pysr/sr.py +++ b/pysr/sr.py @@ -1071,7 +1071,7 @@ def from_file( assert unary_operators is None assert n_features_in is None with open(pkl_filename, "rb") as f: - model: "pysr.sr.PySRRegressor" = pkl.load(f) + model: "PySRRegressor" = pkl.load(f) # Update any parameters if necessary, such as # extra_sympy_mappings: