Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use raw strings for all regex in PdbxReader #4

Open
joemin opened this issue Jun 10, 2024 · 0 comments
Open

use raw strings for all regex in PdbxReader #4

joemin opened this issue Jun 10, 2024 · 0 comments

Comments

@joemin
Copy link

joemin commented Jun 10, 2024

thanks for writing all this!

I think we can avoid some SyntaxWarnings from python (examples below) if we just make all the regex strings in PdbxReader raw strings (add a leading r, like on line 340). Otherwise we end up with noisy output:

  "(?:_(.+?)[.](\S+))"               "|"  # _category.attribute
/pdbx/pdbx/reader/PdbxReader.py:345: SyntaxWarning: invalid escape sequence '\s'
  "(?:['](.*?)(?:[']\s|[']$))"       "|"  # single quoted strings
/pdbx/pdbx/reader/PdbxReader.py:346: SyntaxWarning: invalid escape sequence '\s'
  "(?:[\"](.*?)(?:[\"]\s|[\"]$))"    "|"  # double quoted strings
/pdbx/pdbx/reader/PdbxReader.py:348: SyntaxWarning: invalid escape sequence '\s'
  "(?:\s*#.*$)"                      "|"  # comments (dumped)
/pdbx/pdbx/reader/PdbxReader.py:350: SyntaxWarning: invalid escape sequence '\S'
  "(\S+)"                                 # unquoted words
/pdbx/pdbx/reader/PdbxReader.py:418: SyntaxWarning: invalid escape sequence '\S'
  "(?:_(.+?)[.](\S+))"               "|"  # _category.attribute
/pdbx/pdbx/reader/PdbxReader.py:420: SyntaxWarning: invalid escape sequence '\s'
  "(?:['\"](.*?)(?:['\"]\s|['\"]$))" "|"  # quoted strings
/pdbx/pdbx/reader/PdbxReader.py:422: SyntaxWarning: invalid escape sequence '\s'
  "(?:\s*#.*$)"                      "|"  # comments (dumped)
/pdbx/pdbx/reader/PdbxReader.py:424: SyntaxWarning: invalid escape sequence '\S'
  "(\S+)"                                 # unquoted words```
  
  thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant