Skip to content

Commit 7d53b29

Browse files
committed
Apply pre-commit formatting fixes
- Fix E402: Move sphinx.locale import to top of file in nodes.py - Add newline at end of MANIFEST.in - Apply ruff-format line wrapping for long lines
1 parent 64fe3eb commit 7d53b29

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ recursive-include sphinx_exercise *.css
88
recursive-include sphinx_exercise *.json
99
recursive-include sphinx_exercise *.mo
1010
recursive-include sphinx_exercise *.po
11-
recursive-include sphinx_exercise *.py
11+
recursive-include sphinx_exercise *.py

sphinx_exercise/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171

7272
# Callback Functions
7373

74+
7475
def purge_exercises(app: Sphinx, env: BuildEnvironment, docname: str) -> None:
7576
"""Purge sphinx_exercise registry"""
7677

sphinx_exercise/nodes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
from docutils import nodes as docutil_nodes
1414
from sphinx import addnodes as sphinx_nodes
1515
from sphinx.writers.latex import LaTeXTranslator
16+
from sphinx.locale import get_translation
1617
from .latex import LaTeXMarkup
1718

1819
logger = logging.getLogger(__name__)
1920
LaTeX = LaTeXMarkup()
2021

21-
22-
from sphinx.locale import get_translation
2322
MESSAGE_CATALOG_NAME = "exercise"
2423
translate = get_translation(MESSAGE_CATALOG_NAME)
2524

@@ -54,7 +53,10 @@ class solution_end_node(docutil_nodes.Admonition, docutil_nodes.Element):
5453
class exercise_title(docutil_nodes.title):
5554
def default_title(self):
5655
title_text = self.children[0].astext()
57-
if title_text == f"{translate('Exercise')}" or title_text == f"{translate('Exercise')} %s":
56+
if (
57+
title_text == f"{translate('Exercise')}"
58+
or title_text == f"{translate('Exercise')} %s"
59+
):
5860
return True
5961
else:
6062
return False

sphinx_exercise/translations/_convert.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
MESSAGE_CATALOG_NAME = "exercise"
77

8+
89
def convert_json(folder=None):
910
folder = folder or Path(__file__).parent
1011

@@ -19,7 +20,13 @@ def convert_json(folder=None):
1920
english = data[0]["text"]
2021
for item in data[1:]:
2122
language = item["symbol"]
22-
out_path = folder / "locales" / language / "LC_MESSAGES" / f"{MESSAGE_CATALOG_NAME}.po"
23+
out_path = (
24+
folder
25+
/ "locales"
26+
/ language
27+
/ "LC_MESSAGES"
28+
/ f"{MESSAGE_CATALOG_NAME}.po"
29+
)
2330
if not out_path.parent.exists():
2431
out_path.parent.mkdir(parents=True)
2532
if not out_path.exists():

0 commit comments

Comments
 (0)