Skip to content

Commit

Permalink
--bool-param
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgsavage committed Jan 18, 2025
1 parent 10df377 commit e5c3973
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pint/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class BehaviorChangeWarning(UserWarning):
else:
NUMERIC_TYPES = (Number, Decimal, ndarray, np.number)

def _to_magnitude(value, force_ndarray=False, force_ndarray_like=False):
def _to_magnitude(value, force_ndarray: bool=False, force_ndarray_like: bool=False):
if isinstance(value, (dict, bool)) or value is None:
raise TypeError(f"Invalid magnitude for Quantity: {value!r}")
elif isinstance(value, str) and value == "":
Expand Down Expand Up @@ -149,7 +149,7 @@ class np_datetime64:
HAS_NUMPY_ARRAY_FUNCTION = False
NP_NO_VALUE = None

def _to_magnitude(value, force_ndarray=False, force_ndarray_like=False):
def _to_magnitude(value, force_ndarray: bool=False, force_ndarray_like: bool=False):
if force_ndarray or force_ndarray_like:
raise ValueError(
"Cannot force to ndarray or ndarray-like when NumPy is not present."
Expand Down
2 changes: 1 addition & 1 deletion pint/facets/measurement/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class MeasurementQuantity(Generic[MagnitudeT], PlainQuantity[MagnitudeT]):
# Measurement support
def plus_minus(self, error, relative=False):
def plus_minus(self, error, relative: bool=False):
if isinstance(error, self.__class__):
if relative:
raise ValueError(f"{error} is not a valid relative error.")
Expand Down
6 changes: 3 additions & 3 deletions pint/facets/numpy/numpy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def _unwrap(p, discont=None, axis=-1):


@implements("copyto", "function")
def _copyto(dst, src, casting="same_kind", where=True) -> None:
def _copyto(dst, src, casting="same_kind", where: bool=True) -> None:
if _is_quantity(dst):
if _is_quantity(src):
src = src.m_as(dst.units)
Expand All @@ -619,7 +619,7 @@ def _einsum(subscripts, *operands, **kwargs):


@implements("isin", "function")
def _isin(element, test_elements, assume_unique=False, invert=False):
def _isin(element, test_elements, assume_unique: bool=False, invert: bool=False):
if not _is_quantity(element):
raise ValueError(
"Cannot test if unit-aware elements are in not-unit-aware array"
Expand Down Expand Up @@ -815,7 +815,7 @@ def implementation(a, b, **kwargs):
# Implement simple matching-unit or stripped-unit functions based on signature


def implement_consistent_units_by_argument(func_str, unit_arguments, wrap_output=True) -> None:
def implement_consistent_units_by_argument(func_str, unit_arguments, wrap_output: bool=True) -> None:
# If NumPy is not available, do not attempt implement that which does not exist
if np is None:
return
Expand Down
4 changes: 2 additions & 2 deletions pint/facets/plain/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def systems(self):
out.add(sname)
return frozenset(out)

def from_(self, value, strict=True, name="value"):
def from_(self, value, strict: bool=True, name="value"):
"""Converts a numerical value or quantity to this unit
Parameters
Expand All @@ -268,7 +268,7 @@ def from_(self, value, strict=True, name="value"):
else:
return value * self

def m_from(self, value, strict=True, name="value"):
def m_from(self, value, strict: bool=True, name="value"):
"""Converts a numerical value or quantity to this unit, then returns
the magnitude of the converted value
Expand Down
4 changes: 2 additions & 2 deletions pint/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def __init__(
autoconvert_offset_to_baseunit: bool = False,
on_redefinition: str = "warn",
system=None,
auto_reduce_dimensions=False,
autoconvert_to_preferred=False,
auto_reduce_dimensions: bool=False,
autoconvert_to_preferred: bool=False,
preprocessors=None,
fmt_locale=None,
non_int_type=float,
Expand Down

0 comments on commit e5c3973

Please sign in to comment.