Skip to content

Commit

Permalink
--annotate-magics
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgsavage committed Jan 18, 2025
1 parent e5c3973 commit 8119033
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pint/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, name: str, definition_type: type, msg: str) -> None:
self.definition_type = definition_type
self.msg = msg

def __str__(self):
def __str__(self) -> str:
msg = f"Cannot define '{self.name}' ({self.definition_type}): {self.msg}"
return msg

Expand All @@ -112,7 +112,7 @@ class DefinitionSyntaxError(ValueError, PintError):
def __init__(self, msg: str) -> None:
self.msg = msg

def __str__(self):
def __str__(self) -> str:
return self.msg

def __reduce__(self):
Expand All @@ -129,7 +129,7 @@ def __init__(self, name: str, definition_type: type) -> None:
self.name = name
self.definition_type = definition_type

def __str__(self):
def __str__(self) -> str:
msg = f"Cannot redefine '{self.name}' ({self.definition_type})"
return msg

Expand Down Expand Up @@ -222,7 +222,7 @@ def yield_units(self):
if self.units2:
yield self.units2

def __str__(self):
def __str__(self) -> str:
return (
"Ambiguous operation with offset unit (%s)."
% ", ".join(str(u) for u in self.yield_units())
Expand Down Expand Up @@ -250,7 +250,7 @@ def yield_units(self):
if self.units2:
yield self.units2

def __str__(self):
def __str__(self) -> str:
return (
"Ambiguous operation with logarithmic unit (%s)."
% ", ".join(str(u) for u in self.yield_units())
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 @@ -105,7 +105,7 @@ def __repr__(self) -> str:
def __str__(self) -> str:
return f"{self}"

def __format__(self, spec):
def __format__(self, spec) -> str:
spec = spec or self._REGISTRY.default_format
return self._REGISTRY.formatter.format_measurement(self, spec)

Expand Down
2 changes: 1 addition & 1 deletion pint/facets/numpy/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def __getitem__(self, key):
"supports indexing".format(self._magnitude)
)

def __setitem__(self, key, value):
def __setitem__(self, key, value) -> None:
try:
# If we're dealing with a masked single value or a nan, set it
if (
Expand Down
2 changes: 1 addition & 1 deletion pint/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def __getitem__(self, item):
def __call__(self, *args, **kwargs):
return self._registry(*args, **kwargs)

def __contains__(self, item):
def __contains__(self, item) -> bool:
return self._registry.__contains__(item)

def __iter__(self):
Expand Down

0 comments on commit 8119033

Please sign in to comment.