nilp0inter / cpe

CPE: Common Platform Enumeration for Python
GNU Lesser General Public License v3.0
92 stars 30 forks source link

Fix invalid/deprecated escape sequences #62

Closed agners closed 3 months ago

agners commented 3 months ago

There are a couple more invalid escape sequences. These are not meant to be Python string escape sequences, but literal backspace used for those regular expressions. Use the raw string prefix r"" for these strings.

These addresses warnings seen with Python 3.12:

/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_wfn.py:49: SyntaxWarning: invalid escape sequence '\!'
  _PUNC_NO_DASH = "\!|\"|\;|\#|\$|\%|\&|\'|\(|\)|\+|\,|\.|\/|\:|\<|\=|\>|\@|\[|\]|\^|\`|\{|\||\}|\~"
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_wfn.py:77: SyntaxWarning: invalid escape sequence '\{'
  _spec1 = "\{0}".format(WILDCARD_ONE)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_wfn.py:78: SyntaxWarning: invalid escape sequence '\{'
  _spec2 = "\{0}".format(WILDCARD_MULTI)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_wfn.py:86: SyntaxWarning: invalid escape sequence '\w'
  _body1 = "\w|{0}".format(_quoted1)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_wfn.py:87: SyntaxWarning: invalid escape sequence '\w'
  _body2 = "\w|{0}".format(_quoted2)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_fs.py:50: SyntaxWarning: invalid escape sequence '\w'
  _UNRESERVED = "\w|\.|\-"
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_fs.py:51: SyntaxWarning: invalid escape sequence '\!'
  _PUNC = "\!|\"|\;|\#|\$|\%|\&|\'|\(|\)|\+|\,|\/|\:|\<|\=|\>|\@|\[|\]|\^|\`|\{|\||\}|\~|\-"
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_fs.py:77: SyntaxWarning: invalid escape sequence '\{'
  _logical = "(\{0}|{1})".format(VALUE_ANY, VALUE_NA)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_fs.py:78: SyntaxWarning: invalid escape sequence '\{'
  _quest = "\{0}".format(WILDCARD_ONE)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp2_3_fs.py:79: SyntaxWarning: invalid escape sequence '\{'
  _asterisk = "\{0}".format(WILDCARD_MULTI)
/usr/local/lib/python3.12/site-packages/cpe/comp/cpecomp_anyvalue.py:35: SyntaxWarning: invalid escape sequence '\*'
  """
creekorful commented 3 months ago

Hello @agners would you mind re-opening the PR against the 'main' branch? We did some cleanup with @nilp0inter and it closed some PRs.

Cheers

agners commented 3 months ago

Hello @agners would you mind re-opening the PR against the 'main' branch? We did some cleanup with @nilp0inter and it closed some PRs.

Sure, done with #63.