django / django-localflavor

Country-specific Django helpers, formerly of contrib fame
https://django-localflavor.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
813 stars 289 forks source link

Add r to regexes to remove deprecation warnings #420

Closed benkonrath closed 3 years ago

benkonrath commented 3 years ago

This PR removes these deprecation warnings when running the tests with python -Wd:

django-localflavor/localflavor/au/validators.py:16: DeprecationWarning: invalid escape sequence \d
  eleven_digits = '^\d{11}$'
django-localflavor/localflavor/au/validators.py:60: DeprecationWarning: invalid escape sequence \d
  nine_digits = '^\d{9}$'
django-localflavor/localflavor/au/validators.py:104: DeprecationWarning: invalid escape sequence \d
  super().__init__(regex='^\d{8,9}$', message=self.error_message)
django-localflavor/localflavor/md/validators.py:19: DeprecationWarning: invalid escape sequence \d
  regex = '^\d{13}$'
django-localflavor/localflavor/md/validators.py:32: DeprecationWarning: invalid escape sequence \d
  regex = '^\d{13}$'
django-localflavor/localflavor/md/validators.py:55: DeprecationWarning: invalid escape sequence \d
  pattern = '({regions}) [A-Z]{{2}} \d{{1,3}}'.format(regions=regions)
django-localflavor/localflavor/md/validators.py:61: DeprecationWarning: invalid escape sequence \d
  pattern = '^[A-Z]{3} \d{1,3}$'
django-localflavor/localflavor/md/validators.py:67: DeprecationWarning: invalid escape sequence \d
  pattern = '^RM ({types}) \d{{3}}$'.format(types=types)
django-localflavor/localflavor/md/validators.py:73: DeprecationWarning: invalid escape sequence \d
  pattern = '^({types}) \d{{3}} A{{1,2}}$'.format(types=types)
django-localflavor/localflavor/md/validators.py:79: DeprecationWarning: invalid escape sequence \d
  gov_format = '^({types}) \d{{4}}$'.format(types=types)
django-localflavor/localflavor/md/validators.py:84: DeprecationWarning: invalid escape sequence \d
  pattern = '^RM \d{4}$'
django-localflavor/localflavor/md/validators.py:89: DeprecationWarning: invalid escape sequence \d
  pattern = '^SP \d{3}$'
django-localflavor/localflavor/md/validators.py:94: DeprecationWarning: invalid escape sequence \d
  pattern = '^H \d{4}$'
django-localflavor/localflavor/nl/validators.py:16: DeprecationWarning: invalid escape sequence \d
  super().__init__(regex='^\d{4} ?[A-Z]{2}$', message=self.error_message)
django-localflavor/localflavor/nl/validators.py:35: DeprecationWarning: invalid escape sequence \d
  super().__init__(regex='^\d{9}$', message=self.error_message)
django-localflavor/localflavor/si/forms.py:25: DeprecationWarning: invalid escape sequence \d
  emso_regex = re.compile('^(\d{2})(\d{2})(\d{3})(\d{2})(\d{3})(\d)$')
django-localflavor/localflavor/si/forms.py:90: DeprecationWarning: invalid escape sequence \d
  sitax_regex = re.compile('^(?:SI)?([1-9]\d{7})$')