You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The literal block rule misses flush-left Python with no indent and no prompt #50
is_literal_block needs a prompt, an indented line, or every line matching one of the code shapes. A block of Python that is flush left, one or two lines long, and made of call syntax rather than assignment or import matches none of the three, so it comes out as prose.
Found by L01 and L02, which flag these as untranslated English when they are code that was correctly copied:
File
msgid
tutorial/controlflow.po:873
case (Point(x1, y1), Point(x2, y2) as p2): ...
tutorial/controlflow.po:1812
def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):
tutorial/controlflow.po:1349
parrot(1000) and five more calls, each with a trailing comment
tutorial/controlflow.po:1373
parrot() and three more, each with a trailing comment
whatsnew/3.10.po:1084
case (Point(x1, y1), Point(x2, y2) as p2): ...
_TIGHT rejects parrot(1000) # 1 positional argument because the trailing comment puts spaces outside a comma, which is the rule that separates sorted(d.keys()) from (Contributed by Eddie Elizondo in :issue:35810.) and is worth keeping. def f(...) and case (...) are not calls at all, so nothing looks at them.
Two shapes would cover every one of these:
A line that opens a block: def, class, case, match, if, for, while, with, try followed by a space and ending in a colon or a colon and an ellipsis.
A trailing # comment on a line that is otherwise code, by testing the part before the # against the existing rules rather than the whole line.
Both are whole-line anchors and both have to be measured against the corpus before landing, the same way the rules already there were. The risk is the one the module docstring names: a paragraph mistaken for code is an English sentence left in a Vietnamese page, and if and for are also English words.
Seven of the nine L01 findings and six of the 144 L02 findings go away when this lands. The remaining L01 entries are the three copyright lines, which are a policy question rather than a classifier one.
Measured against the issue body: the block rule cleared 5 of the 9 L01 findings, not the 7 the body estimated. The other 4 are 3 copyright notices and a Monty Python sketch transcript, which are policy questions rather than classifier bugs.
Three shapes rather than the one the title names. A signature quoted without its body was the shape this was filed about. Reading the corpus for it turned up a line with a comment on the end, where the English hid the code, and a call whose arguments are quoted strings, where the spacing rule was counting the spaces inside the quotes as prose. Fixing only the first left the parrot(...) entries failing, which is how the other two were found.
67 entries move out of prose. All 67 were read one at a time and there is no prose among them.
The keyword list stops short of if, for, while, with and else. The wide list was measured before it was dropped: 4 more entries and 2 sentences, while a positional argument could be created like:: and if it is 3, implements::. Both are now tests.
The follow-on is #56. 4 segments left the memory, 5 corpus entries were left unaccounted for, S04 reported them, and apply now copies a code entry before asking whether a person signed it.
Activity
tamnd commentedon Aug 18, 2026
Measured against the issue body: the block rule cleared 5 of the 9
L01findings, not the 7 the body estimated. The other 4 are 3 copyright notices and a Monty Python sketch transcript, which are policy questions rather than classifier bugs.Three shapes rather than the one the title names. A signature quoted without its body was the shape this was filed about. Reading the corpus for it turned up a line with a comment on the end, where the English hid the code, and a call whose arguments are quoted strings, where the spacing rule was counting the spaces inside the quotes as prose. Fixing only the first left the
parrot(...)entries failing, which is how the other two were found.67 entries move out of prose. All 67 were read one at a time and there is no prose among them.
The keyword list stops short of
if,for,while,withandelse. The wide list was measured before it was dropped: 4 more entries and 2 sentences,while a positional argument could be created like::andif it is 3, implements::. Both are now tests.The follow-on is #56. 4 segments left the memory, 5 corpus entries were left unaccounted for,
S04reported them, andapplynow copies a code entry before asking whether a person signed it.