Skip to content

Commit

Permalink
Changed regexes to raw strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalan committed Nov 19, 2023
1 parent 14d1c0d commit df74d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions render50
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ def main():
inputs = []
for line in sys.stdin.readlines():
elements = re.split(r"(?:^|[^\\])#", line.strip())
if element := elements[0].rstrip().replace("\#", "#"):
if element := elements[0].rstrip().replace(r"\#", "#"):
inputs += [element]

# Check for includes
includes = []
if args.include:
for i in args.include:
includes.append(re.escape(i).replace("\*", ".*"))
includes.append(re.escape(i).replace(r"\*", ".*"))

# Check for excludes
excludes = []
if args.exclude:
for x in args.exclude:
excludes.append(re.escape(x).replace("\*", ".*"))
excludes.append(re.escape(x).replace(r"\*", ".*"))

# Check stdin for inputs else command line
patterns = []
Expand Down Expand Up @@ -238,7 +238,7 @@ def main():
page = get(queue[0])
soup = BeautifulSoup(page, "html.parser")
framesets = soup.find_all(
"frameset", {"cols": re.compile("(50%,\s*50%|33%,\s*33%,\s*33%)")})
"frameset", {"cols": re.compile(r"(50%,\s*50%|33%,\s*33%,\s*33%)")})
assert len(framesets) == 1
frames = framesets[0].find_all("frame")
assert 2 <= len(frames) <= 3
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
python_requires=">=3.9",
scripts=["render50"],
url="https://github.com/cs50/render50",
version="9.2.4"
version="9.2.5"
)

0 comments on commit df74d44

Please sign in to comment.