Skip to content

Commit

Permalink
use raw string for regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jcushman committed Dec 22, 2019
1 parent 60c963f commit 52c27d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pdfquery/pdfquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def obj_to_string(obj, top=True):
# via http://stackoverflow.com/a/25920392/307769
invalid_xml_chars_re = re.compile(u'[^\u0020-\uD7FF\u0009\u000A\u000D\uE000-\uFFFD\u10000-\u10FFFF]+')
def strip_invalid_xml_chars(s):
return invalid_xml_chars_re.sub('', s)
return invalid_xml_chars_re.sub(r'', s)


# custom PDFDocument class
Expand Down Expand Up @@ -476,7 +476,7 @@ def get_tree(self, *page_numbers):
# If that happens we just replace non-word characters
# with '_'.
if "Invalid attribute name" in e.args[0]:
k = re.sub('\W', '_', k)
k = re.sub(r'\W', '_', k)
root.set(k, v)

# Parse pages and append to root.
Expand Down

0 comments on commit 52c27d5

Please sign in to comment.