From 09acae13bea02a0f08dc728257c744934979859c Mon Sep 17 00:00:00 2001 From: andrewgsavage Date: Sun, 26 May 2024 20:00:58 +0200 Subject: [PATCH] depreciate ureg.__getitem__ --- pint/facets/plain/registry.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pint/facets/plain/registry.py b/pint/facets/plain/registry.py index 277a6f7a2..9cd8bae01 100644 --- a/pint/facets/plain/registry.py +++ b/pint/facets/plain/registry.py @@ -366,11 +366,11 @@ def __getattr__(self, item: str) -> QuantityT: # self.Unit will call parse_units return self.Unit(item) + @deprecated( + "Calling the getitem method from a UnitRegistry will be removed in future versions of pint.\n" + "use `parse_expression` method or use the registry as a callable." + ) def __getitem__(self, item: str) -> UnitT: - logger.warning( - "Calling the getitem method from a UnitRegistry is deprecated. " - "use `parse_expression` method or use the registry as a callable." - ) return self.parse_expression(item) def __contains__(self, item: str) -> bool: