Skip to content

Commit cf4620c

Browse files
committed
Make py2rst a tiny bit smarter
1 parent 794a4ec commit cf4620c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

scripts/py2rst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def main():
163163
break
164164

165165
if args.end:
166-
for idx, line in enumerate(lines):
166+
for idx, line in list(enumerate(lines))[start_idx:]:
167167
if args.end in line:
168168
end_idx = idx
169169
break

scripts/update-examples.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ scripts/py2rst.py tests/test_qblike_2.py --start "Begin PEP section" --end "End
44
| scripts/rst_replace_section.py pep.rst qb-impl -i
55

66

7-
scripts/py2rst.py tests/test_fastapilike_2.py --start "Begin PEP section: dataclass like" --end "End PEP section: __init__" \
7+
scripts/py2rst.py tests/test_fastapilike_2.py --start "Begin PEP section: dataclass like" --end "End PEP section" \
88
| scripts/rst_replace_section.py pep.rst init-impl -i
99

10-
scripts/py2rst.py tests/test_fastapilike_2.py --start "Begin PEP section: Automatically deriving FastAPI CRUD models" --end "End PEP section: CRUD" \
10+
scripts/py2rst.py tests/test_fastapilike_2.py --start "Begin PEP section: Automatically deriving FastAPI CRUD models" --end "End PEP section" \
1111
| scripts/rst_replace_section.py pep.rst fastapi-impl -i

tests/test_fastapilike_2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Field[T: FieldArgs](typing.InitField[T]):
113113
initializer).
114114
"""
115115

116-
# End PEP section: CRUD
116+
# End PEP section
117117

118118

119119
# Update takes everything but the primary key, but makes them all have
@@ -170,7 +170,7 @@ class Field[T: FieldArgs](typing.InitField[T]):
170170
]
171171

172172

173-
# End PEP section: __init__
173+
# End PEP section
174174

175175

176176
####

0 commit comments

Comments
 (0)