money-parser icon indicating copy to clipboard operation
money-parser copied to clipboard

Deprecation warnings

Open steve-mavens opened this issue 7 months ago • 0 comments

Hi, thanks for the tool.

For some time now the code has produced DeprecationWarnings, including but not necessarily limited to:

lib\site-packages\money_parser\__init__.py:9
  lib\site-packages\money_parser\__init__.py:9: DeprecationWarning: invalid escape sequence '\d'
    _CLEANED_PRICE_RE = re.compile('[+-]?(?:\d{1,3}[.,]?)+')

lib\site-packages\money_parser\__init__.py:10
  lib\site-packages\money_parser\__init__.py:10: DeprecationWarning: invalid escape sequence '\d'
    _FRACTIONAL_PRICE_RE = re.compile('^([\d.,]+)[.,](\d{1,2})$')

lib\site-packages\money_parser\__init__.py:57
  lib\site-packages\money_parser\__init__.py:57: DeprecationWarning: invalid escape sequence '\s'
    price = re.sub('\s', '', raw_price)

lib\site-packages\money_parser\__init__.py:89
  lib\site-packages\money_parser\__init__.py:89: DeprecationWarning: invalid escape sequence '\D'
    integer = re.sub('\D', '', integer)

The fix in each case is either to escape the backslash '\D' -> '\\D' or to use a raw string '\D' -> r'\D'.

I'm not aware of any particular urgency. The deprecation was introduced in Python 3.6, and is still just a deprecation in Python 3.12. But you never know.

steve-mavens avatar Jul 16 '24 14:07 steve-mavens