Skip to content

Commit 811c5ed

Browse files
authored
Merge pull request #1997 from andrewgsavage/getitem
depreciate ureg.__getitem__
2 parents c350f02 + 09acae1 commit 811c5ed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pint/facets/plain/registry.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ def __getattr__(self, item: str) -> UnitT:
373373
# self.Unit will call parse_units
374374
return self.Unit(item)
375375

376+
@deprecated(
377+
"Calling the getitem method from a UnitRegistry will be removed in future versions of pint.\n"
378+
"use `parse_expression` method or use the registry as a callable."
379+
)
376380
def __getitem__(self, item: str) -> UnitT:
377-
logger.warning(
378-
"Calling the getitem method from a UnitRegistry is deprecated. "
379-
"use `parse_expression` method or use the registry as a callable."
380-
)
381381
return self.parse_expression(item)
382382

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

0 commit comments

Comments
 (0)