Skip to content

Commit

Permalink
Improved pyupgrade script
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zwicker committed Jan 3, 2024
1 parent ba860c8 commit 9c21af6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
"preamble": "\setcounter{tocdepth}{4}"
"preamble": r"\setcounter{tocdepth}{4}"
}

# Grouping the document tree into LaTeX files. List of tuples
Expand Down
2 changes: 1 addition & 1 deletion docs/source/run_autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def replace_in_file(infile, replacements, outfile=None):
if outfile is None:
outfile = infile

with open(infile, "r") as fp:
with open(infile) as fp:
content = fp.read()

for key, value in replacements.items():
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx_ext/simplify_typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
# replacement rules based on regular expressions
REPLACEMENTS_REGEX = {
# remove full package path and only leave the module/class identifier
"pde\.(\w+\.)*": "",
"typing\.": "",
r"pde\.(\w+\.)*": "",
r"typing\.": "",
}


Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx_ext/toctree_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class TocTreeFilter(TocTree):
"""directive to filter table-of-contents entries"""

hasPat = re.compile("^\s*:(.+):(.+)$")
hasPat = re.compile(r"^\s*:(.+):(.+)$")

# Remove any entries in the content that we dont want and strip
# out any filter prefixes that we want but obviously don't want the
Expand Down
2 changes: 1 addition & 1 deletion scripts/format_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

echo "Upgrading python syntax..."
pushd .. > /dev/null
pyupgrade --py38-plus **/*.py
find . -name '*.py' -exec pyupgrade --py38-plus {} +
popd > /dev/null

echo "Formating import statements..."
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_counter():
assert int(c1) is 1

c1 += 2
assert int(c1) is 3
assert int(c1) == 3

c2 = Counter(3)
assert c1 is not c2
Expand Down

0 comments on commit 9c21af6

Please sign in to comment.