Skip to content

Commit

Permalink
Fixed python 3.8 typing issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathgeekcoder committed Sep 26, 2024
1 parent b3c61c1 commit 993f562
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/highspy/highs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations
import sys
import numpy as np
from numbers import Integral
from itertools import product
Expand All @@ -15,6 +16,11 @@
kHighsInf,
)

# backwards typing support information for HighspyArray
if sys.version_info >= (3, 9):
ndarray_object_type = np.ndarray[Any, np.dtype[np.object_]]
else:
ndarray_object_type = np.ndarray

class Highs(_Highs):
"""
Expand Down Expand Up @@ -1471,7 +1477,7 @@ def fire(
fn(e)


class HighspyArray(np.ndarray[Any, np.dtype[np.object_]]):
class HighspyArray(ndarray_object_type):
"""
A numpy array wrapper for highs_var/highs_linear_expression objects.
Expand Down

0 comments on commit 993f562

Please sign in to comment.