Skip to content

Commit

Permalink
Fix Transformation type protocol
Browse files Browse the repository at this point in the history
Adding ureg to the argument list for Transformation Protocol

Closes #1801
  • Loading branch information
mikeoconnor0308 committed Jun 26, 2023
1 parent e60fe39 commit d61f7fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Pint Changelog
0.23 (unreleased)
-----------------

- Fixed Transformation type protocol.
(PR #1805)
- Documented to_preferred and created added an autoautoconvert_to_preferred registry option.
(PR #1803)

Expand Down
9 changes: 7 additions & 2 deletions pint/facets/context/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@

import weakref
from collections import ChainMap, defaultdict
from typing import Any, Callable, Protocol, Generic, Optional
from typing import Any, Callable, Protocol, Generic, Optional, TYPE_CHECKING
from collections.abc import Iterable

from ...facets.plain import UnitDefinition, PlainQuantity, PlainUnit, MagnitudeT
from ...util import UnitsContainer, to_units_container
from .definitions import ContextDefinition
from ..._typing import Magnitude

if TYPE_CHECKING:
from ...registry import UnitRegistry


class Transformation(Protocol):
def __call__(self, value: Magnitude, **kwargs: Any) -> Magnitude:
def __call__(
self, ureg: UnitRegistry, value: Magnitude, **kwargs: Any
) -> Magnitude:
...


Expand Down

0 comments on commit d61f7fc

Please sign in to comment.