mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 17:38:51 -06:00
Use np.ndarray in Variables
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from typing import Any, List, TextIO, cast
|
||||
from typing import Any, List, TextIO, cast, TypeVar, Optional, Sized
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -38,7 +38,10 @@ class _RedirectOutput:
|
||||
sys.stderr = self._original_stderr
|
||||
|
||||
|
||||
def _none_if_empty(obj: Any) -> Any:
|
||||
T = TypeVar("T", bound=Sized)
|
||||
|
||||
|
||||
def _none_if_empty(obj: T) -> Optional[T]:
|
||||
if len(obj) == 0:
|
||||
return None
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user