From ae5ddeb36428d0a77adeccbd15f9daa6fcce7c4e Mon Sep 17 00:00:00 2001 From: Michael Bynum Date: Sun, 3 Mar 2024 05:13:01 -0700 Subject: [PATCH] run black --- pyomo/core/base/block.py | 11 +++++------ pyomo/core/base/constraint.py | 13 ++++++------- pyomo/core/base/param.py | 11 +++++------ pyomo/core/base/set.py | 6 ++---- pyomo/core/base/var.py | 11 ++++------- 5 files changed, 22 insertions(+), 30 deletions(-) diff --git a/pyomo/core/base/block.py b/pyomo/core/base/block.py index 9ca2112d498..908e0ef1abd 100644 --- a/pyomo/core/base/block.py +++ b/pyomo/core/base/block.py @@ -2011,16 +2011,15 @@ class Block(ActiveIndexedComponent): _private_data_initializers = defaultdict(lambda: dict) @overload - def __new__(cls: Type[Block], *args, **kwds) -> Union[ScalarBlock, IndexedBlock]: - ... + def __new__( + cls: Type[Block], *args, **kwds + ) -> Union[ScalarBlock, IndexedBlock]: ... @overload - def __new__(cls: Type[ScalarBlock], *args, **kwds) -> ScalarBlock: - ... + def __new__(cls: Type[ScalarBlock], *args, **kwds) -> ScalarBlock: ... @overload - def __new__(cls: Type[IndexedBlock], *args, **kwds) -> IndexedBlock: - ... + def __new__(cls: Type[IndexedBlock], *args, **kwds) -> IndexedBlock: ... def __new__(cls, *args, **kwds): if cls != Block: diff --git a/pyomo/core/base/constraint.py b/pyomo/core/base/constraint.py index dcc90fd6280..a36bc679e49 100644 --- a/pyomo/core/base/constraint.py +++ b/pyomo/core/base/constraint.py @@ -731,16 +731,15 @@ class Infeasible(object): Satisfied = Feasible @overload - def __new__(cls: Type[Constraint], *args, **kwds) -> Union[ScalarConstraint, IndexedConstraint]: - ... + def __new__( + cls: Type[Constraint], *args, **kwds + ) -> Union[ScalarConstraint, IndexedConstraint]: ... @overload - def __new__(cls: Type[ScalarConstraint], *args, **kwds) -> ScalarConstraint: - ... + def __new__(cls: Type[ScalarConstraint], *args, **kwds) -> ScalarConstraint: ... @overload - def __new__(cls: Type[IndexedConstraint], *args, **kwds) -> IndexedConstraint: - ... + def __new__(cls: Type[IndexedConstraint], *args, **kwds) -> IndexedConstraint: ... def __new__(cls, *args, **kwds): if cls != Constraint: @@ -1033,7 +1032,7 @@ class IndexedConstraint(Constraint): def add(self, index, expr): """Add a constraint with a given index.""" return self.__setitem__(index, expr) - + def __getitem__(self, index) -> _GeneralConstraintData: return super().__getitem__(index) diff --git a/pyomo/core/base/param.py b/pyomo/core/base/param.py index dde390661ab..5fcaf92b25a 100644 --- a/pyomo/core/base/param.py +++ b/pyomo/core/base/param.py @@ -294,16 +294,15 @@ class NoValue(object): pass @overload - def __new__(cls: Type[Param], *args, **kwds) -> Union[ScalarParam, IndexedParam]: - ... + def __new__( + cls: Type[Param], *args, **kwds + ) -> Union[ScalarParam, IndexedParam]: ... @overload - def __new__(cls: Type[ScalarParam], *args, **kwds) -> ScalarParam: - ... + def __new__(cls: Type[ScalarParam], *args, **kwds) -> ScalarParam: ... @overload - def __new__(cls: Type[IndexedParam], *args, **kwds) -> IndexedParam: - ... + def __new__(cls: Type[IndexedParam], *args, **kwds) -> IndexedParam: ... def __new__(cls, *args, **kwds): if cls != Param: diff --git a/pyomo/core/base/set.py b/pyomo/core/base/set.py index c52945dfd30..6373af97683 100644 --- a/pyomo/core/base/set.py +++ b/pyomo/core/base/set.py @@ -1971,12 +1971,10 @@ class SortedOrder(object): _UnorderedInitializers = {set} @overload - def __new__(cls: Type[Set], *args, **kwds) -> Union[_SetData, IndexedSet]: - ... + def __new__(cls: Type[Set], *args, **kwds) -> Union[_SetData, IndexedSet]: ... @overload - def __new__(cls: Type[OrderedScalarSet], *args, **kwds) -> OrderedScalarSet: - ... + def __new__(cls: Type[OrderedScalarSet], *args, **kwds) -> OrderedScalarSet: ... def __new__(cls, *args, **kwds): if cls is not Set: diff --git a/pyomo/core/base/var.py b/pyomo/core/base/var.py index c92a4056667..856a2dc0237 100644 --- a/pyomo/core/base/var.py +++ b/pyomo/core/base/var.py @@ -671,16 +671,13 @@ class Var(IndexedComponent, IndexedComponent_NDArrayMixin): _ComponentDataClass = _GeneralVarData @overload - def __new__(cls: Type[Var], *args, **kwargs) -> Union[ScalarVar, IndexedVar]: - ... + def __new__(cls: Type[Var], *args, **kwargs) -> Union[ScalarVar, IndexedVar]: ... @overload - def __new__(cls: Type[ScalarVar], *args, **kwargs) -> ScalarVar: - ... + def __new__(cls: Type[ScalarVar], *args, **kwargs) -> ScalarVar: ... @overload - def __new__(cls: Type[IndexedVar], *args, **kwargs) -> IndexedVar: - ... + def __new__(cls: Type[IndexedVar], *args, **kwargs) -> IndexedVar: ... def __new__(cls, *args, **kwargs): if cls is not Var: @@ -702,7 +699,7 @@ def __init__( dense=True, units=None, name=None, - doc=None + doc=None, ): ... def __init__(self, *args, **kwargs):