Skip to content

Commit a283f12

Browse files
Add space after ClassDoc (#317)
Add an extra line after the ClassDoc, as described by [PEP 257](https://peps.python.org/pep-0257/#multi-line-docstrings): > Insert a blank line after all docstrings (one-line or multi-line) that document a class – generally speaking, the class’s methods are separated from each other by a single blank line, and the docstring needs to be offset from the first method by a blank line.
1 parent 04d5d16 commit a283f12

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@alloy-js/python"
5+
---
6+
7+
Add an extra line after the ClassDoc

packages/python/src/components/ClassDeclaration.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ export function ClassDeclaration(props: ClassDeclarationProps) {
6262
<MemberScope ownerSymbol={sym}>
6363
{basesPart}
6464
<PythonBlock opener=":">
65-
<Show when={Boolean(props.doc)}>{props.doc}</Show>
65+
<Show when={Boolean(props.doc)}>
66+
{props.doc}
67+
<line />
68+
</Show>
6669
{hasChildren ? props.children : "pass"}
6770
</PythonBlock>
6871
</MemberScope>

packages/python/test/pydocs.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ describe("Full example", () => {
10311031
Note:
10321032
Do not include the 'self' parameter in the Args section.
10331033
"""
1034+
10341035
just_name = None
10351036
name_and_type: int = None
10361037
name_type_and_value: int = 12
@@ -1366,6 +1367,7 @@ describe("Full example", () => {
13661367
13671368
error_code (int): Numeric error code for the validation failure.
13681369
"""
1370+
13691371
field_name: str = None
13701372
error_code: int = None
13711373

0 commit comments

Comments
 (0)