matheuscas / pycpfcnpj

Python module for brazilian register numbers for persons (CPF) and companies (CNPJ).
MIT License
143 stars 44 forks source link

Deprecation warning due to invalid escape sequences #26

Closed tirkarthi closed 3 years ago

tirkarthi commented 4 years ago

Deprecation warning due to invalid escape sequences. Using raw strings or escaping them again helps in resolving this.

find . -iname '*py' | grep -Ev 'setup|rdf4|tool' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./pycpfcnpj/compatible.py:6: DeprecationWarning: invalid escape sequence \D
  return re.sub('\D', '', str(document))
jsousaguiar commented 3 years ago

Could the fix be just to insert 'r' to set raw strings in return re.sub(r'\D', '', str(document))?