Skip to content

Commit

Permalink
Merge pull request #5298 from hypothesis/fix-invalid-string-escapes
Browse files Browse the repository at this point in the history
Fix invalid string escapes
  • Loading branch information
seanh committed Sep 15, 2018
2 parents 6ef27f4 + 9fbfde5 commit 682764d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion h/accounts/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def validate_orcid(orcid):
Returns the normalized ORCID if successfully parsed or raises a ValueError
otherwise.
"""
orcid_regex = '\A[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]\Z'
orcid_regex = r'\A[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]\Z'

if not re.match(orcid_regex, orcid):
raise ValueError('The format of this ORCID is incorrect'.format(orcid))
Expand Down
2 changes: 1 addition & 1 deletion h/auth/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# As we roll out the new API Auth Policy with Auth Token Policy, we
# want to keep it restricted to certain endpoints
# Currently restricted to `POST /api/groups*` only
AUTH_TOKEN_PATH_PATTERN = '^\/api\/groups'
AUTH_TOKEN_PATH_PATTERN = r"^/api/groups"


@interface.implementer(interfaces.IAuthenticationPolicy)
Expand Down
2 changes: 1 addition & 1 deletion h/auth/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@implementer(IAuthenticationToken)
class Token(object):
"""
r"""
A long-lived API token for a user.
This is a wrapper class that wraps an ``h.models.Token`` and provides an
Expand Down
2 changes: 1 addition & 1 deletion h/util/document_claims.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#
# This also accepts DOIs represented as URLs (eg.
# "https://doi.org/10.1000/123456").
DOI_PATTERN = re.compile('(https?://(dx\.)?doi\.org/)?10\.[0-9]{4,}[.0-9]*/.*')
DOI_PATTERN = re.compile(r'(https?://(dx\.)?doi\.org/)?10\.[0-9]{4,}[.0-9]*/.*')


def document_uris_from_data(document_data, claimant):
Expand Down
4 changes: 2 additions & 2 deletions tests/h/util/markdown_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def test_it_ignores_math_block(self):
assert '<p>$$1 + 1 = 2$$</p>\n' == actual

def test_it_ignores_inline_match(self):
actual = markdown.render('Foobar \(1 + 1 = 2\)')
assert '<p>Foobar \(1 + 1 = 2\)</p>\n' == actual
actual = markdown.render(r'Foobar \(1 + 1 = 2\)')
assert '<p>Foobar \\(1 + 1 = 2\\)</p>\n' == actual

def test_it_sanitizes_the_output(self, markdown_render, sanitize):
markdown.render('foobar')
Expand Down

0 comments on commit 682764d

Please sign in to comment.