Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Fix __getitem__ signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbowly authored and rluce committed Nov 10, 2022
1 parent 352bf05 commit 9e6eb48
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions gurobipy-stubs/gurobipy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ _LinearComponent = Union[Var, LinExpr, MVar, MLinExpr]
_QuadComponent = Union[QuadExpr, MQuadExpr]
_ModelComponent = Union[Var, MVar, Constr, MConstr, QConstr, SOS, GenConstr]
_ShapeLike = Union[int, Tuple[int, ...]]
_IndexLike = Union[int, slice, Tuple[int, ...], Sequence[int], Tuple[Union[Sequence[int], int, slice], ...]]

def abs_(__var: Var) -> GenExprAbs: ...
@overload
Expand Down Expand Up @@ -865,6 +866,7 @@ class MLinExpr:
self,
other: np.ndarray
) -> TempMConstr: ...
def __getitem__(self, obj: _IndexLike) -> MLinExpr: ...
@overload
def __iadd__(self, other: _ConstComponent) -> MLinExpr: ...
@overload
Expand Down Expand Up @@ -965,6 +967,7 @@ class MQuadExpr:
def __ge__(self, other: _LinearComponent) -> TempMQConstr: ...
@overload
def __ge__(self, other: _QuadComponent) -> TempMQConstr: ...
def __getitem__(self, obj: _IndexLike) -> MQuadExpr: ...
@overload
def __iadd__(self, other: _ConstComponent) -> MQuadExpr: ...
@overload
Expand Down Expand Up @@ -1096,22 +1099,7 @@ class MVar:
self,
other: np.ndarray
) -> TempMConstr: ...
@overload
def __getitem__(self, obj: int) -> Var: ...
# Cannot write concisely without overlapping signature 5
@overload
def __getitem__( # type: ignore[misc]
self, obj: Tuple[int, ...]
) -> Var: ...
@overload
def __getitem__(self, obj: slice) -> MVar: ...
@overload
def __getitem__(self, obj: Sequence[int]) -> MVar: ...
@overload
def __getitem__(
self,
obj: Tuple[Union[Sequence[int], int, slice], ...]
) -> MVar: ...
def __getitem__(self, obj: _IndexLike) -> MVar: ...
def __itruediv__(self, other: _ConstComponent) -> MLinExpr: ...
@overload
def __le__(self, other: Union[float, int]) -> TempMConstr: ...
Expand Down

0 comments on commit 9e6eb48

Please sign in to comment.