Skip to content

Commit

Permalink
Apply black
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Oct 12, 2023
1 parent 2b6e111 commit 63aba93
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions pyomo/common/numeric_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def RegisterBooleanType(new_type: type):
native_types.add(new_type)
nonpyomo_leaf_types.add(new_type)


def RegisterComplexType(new_type: type):
"""Register the specified type as an "complex type".
Expand Down Expand Up @@ -243,25 +244,25 @@ def check_if_numeric_type(obj):

def value(obj, exception=True):
"""
A utility function that returns the value of a Pyomo object or
expression.
Args:
obj: The argument to evaluate. If it is None, a
string, or any other primitive numeric type,
then this function simply returns the argument.
Otherwise, if the argument is a NumericValue
then the __call__ method is executed.
exception (bool): If :const:`True`, then an exception should
be raised when instances of NumericValue fail to
evaluate due to one or more objects not being
initialized to a numeric value (e.g, one or more
variables in an algebraic expression having the
value None). If :const:`False`, then the function
returns :const:`None` when an exception occurs.
Default is True.
Returns: A numeric value or None.
A utility function that returns the value of a Pyomo object or
expression.
Args:
obj: The argument to evaluate. If it is None, a
string, or any other primitive numeric type,
then this function simply returns the argument.
Otherwise, if the argument is a NumericValue
then the __call__ method is executed.
exception (bool): If :const:`True`, then an exception should
be raised when instances of NumericValue fail to
evaluate due to one or more objects not being
initialized to a numeric value (e.g, one or more
variables in an algebraic expression having the
value None). If :const:`False`, then the function
returns :const:`None` when an exception occurs.
Default is True.
Returns: A numeric value or None.
"""
if obj.__class__ in native_types:
return obj
Expand Down

0 comments on commit 63aba93

Please sign in to comment.