Skip to content

Commit

Permalink
maint: run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Mar 5, 2024
1 parent 3e983af commit e3ae942
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 20 deletions.
13 changes: 5 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: flake8

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
1 change: 0 additions & 1 deletion sphinx_exercise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def doctree_read(app: Sphinx, document: Node) -> None:


def setup(app: Sphinx) -> Dict[str, Any]:

app.add_config_value("hide_solutions", False, "env")

app.connect("config-inited", init_numfig) # event order - 1
Expand Down
4 changes: 1 addition & 3 deletions sphinx_exercise/directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class : str,
}

def run(self) -> List[Node]:

self.defaults = {"title_text": "Exercise"}
self.serial_number = self.env.new_serialno()

Expand Down Expand Up @@ -163,7 +162,7 @@ def run(self) -> List[Node]:
# Copy the node so that the post transforms do not modify this original state
# Prior to Sphinx 6.1.0, the doctree was not cached, and Sphinx loaded a new copy
# c.f. https://github.com/sphinx-doc/sphinx/commit/463a69664c2b7f51562eb9d15597987e6e6784cd
"node": node.deepcopy(),
"node": node.deepcopy(),
}

# TODO: Could tag this as Hidden to prevent the cell showing
Expand Down Expand Up @@ -217,7 +216,6 @@ class : str,
solution_node = solution_node

def run(self) -> List[Node]:

self.defaults = {"title_text": "Solution to"}
target_label = self.arguments[0]
self.serial_number = self.env.new_serialno()
Expand Down
1 change: 0 additions & 1 deletion sphinx_exercise/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class LaTeXMarkup(object):

CR = "\n"

def visit_admonition(self):
Expand Down
5 changes: 0 additions & 5 deletions sphinx_exercise/post_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class UpdateReferencesToEnumerated(SphinxPostTransform):
default_priority = 5

def run(self):

if not hasattr(self.env, "sphinx_exercise_registry"):
return

Expand Down Expand Up @@ -113,7 +112,6 @@ def resolve_title(self, node):
return node

def run(self):

if not hasattr(self.env, "sphinx_exercise_registry"):
return

Expand Down Expand Up @@ -172,11 +170,9 @@ def resolve_solution_title(app, node, exercise_node):


class ResolveTitlesInSolutions(SphinxPostTransform):

default_priority = 21

def run(self):

if not hasattr(self.env, "sphinx_exercise_registry"):
return

Expand Down Expand Up @@ -211,7 +207,6 @@ class ResolveLinkTextToSolutions(SphinxPostTransform):
default_priority = 22

def run(self):

if not hasattr(self.env, "sphinx_exercise_registry"):
return

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ def file_regression(file_regression):


class FileRegression:
ignores = ( )
ignores = ()
changes = (
# TODO: Remove when support for Sphinx<=6 is dropped,
(re.escape(" translation_progress=\"{'total': 0, 'translated': 0}\""), ""),
# TODO: Remove when support for Sphinx<7.2 is dropped,
(r"original_uri=\"[^\"]*\"\s", ""),
# TODO: Remove when support for Sphinx<7.2 is dropped
("Link to", "Permalink to")
("Link to", "Permalink to"),
)

def __init__(self, file_regression):
Expand Down

0 comments on commit e3ae942

Please sign in to comment.