Skip to content

Commit b02382e

Browse files
committed
Update .pre-commit-config.yaml
Update .pre-commit-config.yaml
1 parent b0ba2a9 commit b02382e

File tree

2 files changed

+69
-68
lines changed

2 files changed

+69
-68
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
repos:
1616
# Standard hooks
17+
1718
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v5.0.0
19+
rev: v6.0.0
1920
hooks:
2021
- id: check-added-large-files
2122
- id: check-case-conflict
@@ -28,7 +29,7 @@ repos:
2829
- id: trailing-whitespace
2930

3031
- repo: https://github.com/psf/black
31-
rev: 24.10.0
32+
rev: 25.12.0
3233
hooks:
3334
- id: black
3435

@@ -49,7 +50,7 @@ repos:
4950
args: ['-fallback-style=none', '-i']
5051

5152
- repo: https://github.com/codespell-project/codespell
52-
rev: v2.4.0
53+
rev: v2.4.1
5354
hooks:
5455
- id: codespell
5556
args: ['--write-changes', '--ignore-words=.codespell_words']

_scripts/tutorialformatter.py

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
"""
2-
tutorialformatter
3-
===========================
4-
5-
This extension provides a directive to include a source code file
6-
in a document, but with certain comments from the file formatted
7-
as regular document text. This allows code for a tutorial to look like:
8-
9-
/// BEGIN_TUTORIAL
10-
/// This next line adds one.
11-
i = i + 1;
12-
/// Then we need to double it.
13-
i = i * 2;
14-
/// END_TUTORIAL
15-
16-
And have it formatted as
17-
18-
This next line adds one.::
19-
i = i + 1;
20-
21-
Then we need to double it.::
22-
i = i * 2;
23-
24-
The special-looking comment character sequence at the start of
25-
each text line can be anything not starting or ending with
26-
whitespace. tutorialformatter starts by scanning the file for the
27-
string BEGIN_TUTORIAL. When it finds it, it takes all the
28-
characters before BEGIN_TUTORIAL on that line, strips whitespace
29-
from the left, and uses that as the text marker. So this would
30-
also be fine:
31-
32-
#My Tutorial# BEGIN_TUTORIAL
33-
#My Tutorial# This next line adds one.
34-
i = i + 1
35-
#My Tutorial# Then we need to double it.
36-
i = i * 2
37-
#My Tutorial# END_TUTORIAL
38-
39-
Sometimes the order that makes sense in the tutorial is not
40-
compatible with the computer language of the code, like when a
41-
callback function in C++ is defined outside of the main tutorial
42-
code. To support this, you can use the tags BEGIN_SUB_TUTORIAL,
43-
END_SUB_TUTORIAL, and CALL_SUB_TUTORIAL. They look like this:
44-
45-
# BEGIN_SUB_TUTORIAL callbackFunction
46-
def callback():
47-
print("in callback")
48-
# END_SUB_TUTORIAL
49-
50-
# BEGIN_TUTORIAL
51-
# Here we call a special callback:
52-
callback()
53-
# which is defined as:
54-
# CALL_SUB_TUTORIAL callbackFunction
55-
# and then we move on to the next topic.
56-
57-
Both the BEGIN_SUB_TUTORIAL and CALL_SUB_TUTORIAL tags take an
58-
argument, which is the name of the "sub-tutorial". That name does
59-
not need to correspond to anything in the code. Sub-tutorials
60-
cannot be nested, and they only work within a single source file
61-
processed by tutorialformatter. They have no outside meaning.
62-
The implementation simply slices out sub-tutorials from the input
63-
lines and copies them into the output lines where-ever the
64-
corresponding "call" tags are found.
65-
66-
.. moduleauthor:: Dave Hershberger <[email protected]>
2+
tutorialformatter
3+
===========================
4+
5+
This extension provides a directive to include a source code file
6+
in a document, but with certain comments from the file formatted
7+
as regular document text. This allows code for a tutorial to look like:
8+
9+
/// BEGIN_TUTORIAL
10+
/// This next line adds one.
11+
i = i + 1;
12+
/// Then we need to double it.
13+
i = i * 2;
14+
/// END_TUTORIAL
15+
16+
And have it formatted as
17+
18+
This next line adds one.::
19+
i = i + 1;
20+
21+
Then we need to double it.::
22+
i = i * 2;
23+
24+
The special-looking comment character sequence at the start of
25+
each text line can be anything not starting or ending with
26+
whitespace. tutorialformatter starts by scanning the file for the
27+
string BEGIN_TUTORIAL. When it finds it, it takes all the
28+
characters before BEGIN_TUTORIAL on that line, strips whitespace
29+
from the left, and uses that as the text marker. So this would
30+
also be fine:
31+
32+
#My Tutorial# BEGIN_TUTORIAL
33+
#My Tutorial# This next line adds one.
34+
i = i + 1
35+
#My Tutorial# Then we need to double it.
36+
i = i * 2
37+
#My Tutorial# END_TUTORIAL
38+
39+
Sometimes the order that makes sense in the tutorial is not
40+
compatible with the computer language of the code, like when a
41+
callback function in C++ is defined outside of the main tutorial
42+
code. To support this, you can use the tags BEGIN_SUB_TUTORIAL,
43+
END_SUB_TUTORIAL, and CALL_SUB_TUTORIAL. They look like this:
44+
45+
# BEGIN_SUB_TUTORIAL callbackFunction
46+
def callback():
47+
print("in callback")
48+
# END_SUB_TUTORIAL
49+
50+
# BEGIN_TUTORIAL
51+
# Here we call a special callback:
52+
callback()
53+
# which is defined as:
54+
# CALL_SUB_TUTORIAL callbackFunction
55+
# and then we move on to the next topic.
56+
57+
Both the BEGIN_SUB_TUTORIAL and CALL_SUB_TUTORIAL tags take an
58+
argument, which is the name of the "sub-tutorial". That name does
59+
not need to correspond to anything in the code. Sub-tutorials
60+
cannot be nested, and they only work within a single source file
61+
processed by tutorialformatter. They have no outside meaning.
62+
The implementation simply slices out sub-tutorials from the input
63+
lines and copies them into the output lines where-ever the
64+
corresponding "call" tags are found.
65+
66+
.. moduleauthor:: Dave Hershberger <[email protected]>
6767
"""
6868

6969
# 0.1.0: First version.

0 commit comments

Comments
 (0)