Skip to content

Commit 09acae1

Browse files
committed
depreciate ureg.__getitem__
1 parent f2e4081 commit 09acae1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pint/facets/plain/registry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ def __getattr__(self, item: str) -> QuantityT:
366366
# self.Unit will call parse_units
367367
return self.Unit(item)
368368

369+
@deprecated(
370+
"Calling the getitem method from a UnitRegistry will be removed in future versions of pint.\n"
371+
"use `parse_expression` method or use the registry as a callable."
372+
)
369373
def __getitem__(self, item: str) -> UnitT:
370-
logger.warning(
371-
"Calling the getitem method from a UnitRegistry is deprecated. "
372-
"use `parse_expression` method or use the registry as a callable."
373-
)
374374
return self.parse_expression(item)
375375

376376
def __contains__(self, item: str) -> bool:

0 commit comments

Comments
 (0)