Skip to content

Use raw string literals - #105

Merged
benjaminp merged 1 commit into
benjaminp:masterfrom
alex:patch-1
Mar 5, 2019
Merged

Use raw string literals#105
benjaminp merged 1 commit into
benjaminp:masterfrom
alex:patch-1

Conversation

@alex

@alex alex commented Mar 5, 2019

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread check_https.py
# Check for sneaky <meta> redirects.
for meta in META_XPATH(tree):
m = re.match("0;\s*url=['\"](.+?)['\"]", meta.get("content"))
m = re.match(r"0;\s*url=['\"](.+?)['\"]", meta.get("content"))

@benjaminp benjaminp Mar 5, 2019

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually equivalent right? len(r"\"") == 2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it still does the right thing?

alexgaynor@penguin ~> python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.search(r"['\"]", "abc\"")
<_sre.SRE_Match object at 0x7afe8f12e510>
>>> re.search(r"['\"]", "abc\"").group()
'"'
>>> 

@benjaminp
benjaminp merged commit 4797970 into benjaminp:master Mar 5, 2019
@alex
alex deleted the patch-1 branch March 5, 2019 03:56
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

Successfully merging this pull request may close these issues.

2 participants