@alloy-js/python 0.5.0-dev.0 → 0.5.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/src/builtins/python.js +46 -0
- package/dist/dev/src/builtins/python.js.map +1 -1
- package/dist/dev/src/components/ClassDeclaration.js +19 -10
- package/dist/dev/src/components/ClassDeclaration.js.map +1 -1
- package/dist/dev/src/components/ClassMethodDeclaration.js +20 -5
- package/dist/dev/src/components/ClassMethodDeclaration.js.map +1 -1
- package/dist/dev/src/components/DataclassDeclaration.js +14 -12
- package/dist/dev/src/components/DataclassDeclaration.js.map +1 -1
- package/dist/dev/src/components/DecoratorList.js +55 -0
- package/dist/dev/src/components/DecoratorList.js.map +1 -0
- package/dist/dev/src/components/EnumDeclaration.js +21 -12
- package/dist/dev/src/components/EnumDeclaration.js.map +1 -1
- package/dist/dev/src/components/FunctionBase.js +21 -10
- package/dist/dev/src/components/FunctionBase.js.map +1 -1
- package/dist/dev/src/components/FutureStatement.js +1 -1
- package/dist/dev/src/components/MethodBase.js +16 -4
- package/dist/dev/src/components/MethodBase.js.map +1 -1
- package/dist/dev/src/components/PropertyDeclaration.js +68 -17
- package/dist/dev/src/components/PropertyDeclaration.js.map +1 -1
- package/dist/dev/src/components/PydanticClassDeclaration.js +136 -0
- package/dist/dev/src/components/PydanticClassDeclaration.js.map +1 -0
- package/dist/dev/src/components/StaticMethodDeclaration.js +19 -5
- package/dist/dev/src/components/StaticMethodDeclaration.js.map +1 -1
- package/dist/dev/src/components/index.js +1 -0
- package/dist/dev/src/components/index.js.map +1 -1
- package/dist/dev/test/classdeclarations.test.js +85 -52
- package/dist/dev/test/classdeclarations.test.js.map +1 -1
- package/dist/dev/test/dataclassdeclarations.test.js +122 -89
- package/dist/dev/test/dataclassdeclarations.test.js.map +1 -1
- package/dist/dev/test/decoratorlist.test.js +84 -0
- package/dist/dev/test/decoratorlist.test.js.map +1 -0
- package/dist/dev/test/enums.test.js +41 -10
- package/dist/dev/test/enums.test.js.map +1 -1
- package/dist/dev/test/functiondeclaration.test.js +81 -61
- package/dist/dev/test/functiondeclaration.test.js.map +1 -1
- package/dist/dev/test/methoddeclaration.test.js +117 -26
- package/dist/dev/test/methoddeclaration.test.js.map +1 -1
- package/dist/dev/test/propertydeclaration.test.js +109 -7
- package/dist/dev/test/propertydeclaration.test.js.map +1 -1
- package/dist/dev/test/pydanticclassdeclarations.test.js +1137 -0
- package/dist/dev/test/pydanticclassdeclarations.test.js.map +1 -0
- package/dist/src/builtins/python.d.ts +30 -0
- package/dist/src/builtins/python.d.ts.map +1 -1
- package/dist/src/builtins/python.js +46 -0
- package/dist/src/builtins/python.js.map +1 -1
- package/dist/src/components/ClassDeclaration.d.ts +21 -0
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +6 -1
- package/dist/src/components/ClassDeclaration.js.map +1 -1
- package/dist/src/components/ClassMethodDeclaration.d.ts +5 -1
- package/dist/src/components/ClassMethodDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassMethodDeclaration.js +14 -3
- package/dist/src/components/ClassMethodDeclaration.js.map +1 -1
- package/dist/src/components/DataclassDeclaration.d.ts.map +1 -1
- package/dist/src/components/DataclassDeclaration.js +10 -4
- package/dist/src/components/DataclassDeclaration.js.map +1 -1
- package/dist/src/components/DecoratorList.d.ts +43 -0
- package/dist/src/components/DecoratorList.d.ts.map +1 -0
- package/dist/src/components/DecoratorList.js +47 -0
- package/dist/src/components/DecoratorList.js.map +1 -0
- package/dist/src/components/EnumDeclaration.d.ts +9 -0
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +6 -1
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/FunctionBase.d.ts +31 -1
- package/dist/src/components/FunctionBase.d.ts.map +1 -1
- package/dist/src/components/FunctionBase.js +9 -2
- package/dist/src/components/FunctionBase.js.map +1 -1
- package/dist/src/components/FutureStatement.d.ts +1 -1
- package/dist/src/components/FutureStatement.js +1 -1
- package/dist/src/components/MethodBase.d.ts.map +1 -1
- package/dist/src/components/MethodBase.js +10 -2
- package/dist/src/components/MethodBase.js.map +1 -1
- package/dist/src/components/PropertyDeclaration.d.ts +29 -0
- package/dist/src/components/PropertyDeclaration.d.ts.map +1 -1
- package/dist/src/components/PropertyDeclaration.js +48 -1
- package/dist/src/components/PropertyDeclaration.js.map +1 -1
- package/dist/src/components/PydanticClassDeclaration.d.ts +120 -0
- package/dist/src/components/PydanticClassDeclaration.d.ts.map +1 -0
- package/dist/src/components/PydanticClassDeclaration.js +116 -0
- package/dist/src/components/PydanticClassDeclaration.js.map +1 -0
- package/dist/src/components/StaticMethodDeclaration.d.ts +3 -0
- package/dist/src/components/StaticMethodDeclaration.d.ts.map +1 -1
- package/dist/src/components/StaticMethodDeclaration.js +13 -3
- package/dist/src/components/StaticMethodDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/test/classdeclarations.test.js +25 -0
- package/dist/test/classdeclarations.test.js.map +1 -1
- package/dist/test/dataclassdeclarations.test.js +25 -0
- package/dist/test/dataclassdeclarations.test.js.map +1 -1
- package/dist/test/decoratorlist.test.d.ts +2 -0
- package/dist/test/decoratorlist.test.d.ts.map +1 -0
- package/dist/test/decoratorlist.test.js +60 -0
- package/dist/test/decoratorlist.test.js.map +1 -0
- package/dist/test/enums.test.js +27 -0
- package/dist/test/enums.test.js.map +1 -1
- package/dist/test/functiondeclaration.test.js +16 -0
- package/dist/test/functiondeclaration.test.js.map +1 -1
- package/dist/test/methoddeclaration.test.js +67 -0
- package/dist/test/methoddeclaration.test.js.map +1 -1
- package/dist/test/propertydeclaration.test.js +71 -1
- package/dist/test/propertydeclaration.test.js.map +1 -1
- package/dist/test/pydanticclassdeclarations.test.d.ts +2 -0
- package/dist/test/pydanticclassdeclarations.test.d.ts.map +1 -0
- package/dist/test/pydanticclassdeclarations.test.js +829 -0
- package/dist/test/pydanticclassdeclarations.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/ClassDeclaration.md +10 -7
- package/docs/api/components/ClassEnumDeclaration.md +9 -6
- package/docs/api/components/ClassMethodDeclaration.md +7 -5
- package/docs/api/components/DataclassDeclaration.md +9 -5
- package/docs/api/components/DunderMethodDeclaration.md +7 -5
- package/docs/api/components/FunctionDeclaration.md +9 -5
- package/docs/api/components/FutureStatement.md +1 -1
- package/docs/api/components/MethodDeclaration.md +11 -6
- package/docs/api/components/PropertyDeclaration.md +11 -8
- package/docs/api/components/PydanticClassDeclaration.md +146 -0
- package/docs/api/components/StaticMethodDeclaration.md +7 -5
- package/docs/api/components/index.md +1 -0
- package/docs/api/index.md +3 -3
- package/docs/api/types/CommonFunctionProps.md +4 -3
- package/docs/api/types/PydanticModelConfigDictProps.md +32 -0
- package/docs/api/types/index.md +1 -0
- package/docs/api/variables/index.md +3 -0
- package/docs/api/variables/pydanticModule.md +27 -0
- package/docs/api/variables/pydanticSettingsModule.md +7 -0
- package/docs/api/variables/typingModule.md +9 -0
- package/package.json +4 -4
- package/src/builtins/python.ts +539 -1
- package/src/components/ClassDeclaration.tsx +23 -0
- package/src/components/ClassMethodDeclaration.tsx +9 -1
- package/src/components/DataclassDeclaration.tsx +18 -11
- package/src/components/DecoratorList.tsx +50 -0
- package/src/components/EnumDeclaration.tsx +11 -0
- package/src/components/FunctionBase.tsx +34 -3
- package/src/components/FutureStatement.tsx +1 -1
- package/src/components/MethodBase.tsx +6 -2
- package/src/components/PropertyDeclaration.tsx +48 -1
- package/src/components/PydanticClassDeclaration.tsx +222 -0
- package/src/components/StaticMethodDeclaration.tsx +7 -1
- package/src/components/index.ts +1 -0
- package/temp/api.json +1142 -84
- package/test/classdeclarations.test.tsx +27 -0
- package/test/dataclassdeclarations.test.tsx +25 -0
- package/test/decoratorlist.test.tsx +95 -0
- package/test/enums.test.tsx +29 -0
- package/test/functiondeclaration.test.tsx +17 -0
- package/test/methoddeclaration.test.tsx +70 -0
- package/test/propertydeclaration.test.tsx +66 -1
- package/test/pydanticclassdeclarations.test.tsx +836 -0
|
@@ -10,6 +10,7 @@ Create a Python class declaration.
|
|
|
10
10
|
|
|
11
11
|
<ClassDeclaration
|
|
12
12
|
bases={Children[]}
|
|
13
|
+
decorators={Children[]}
|
|
13
14
|
doc={Children}
|
|
14
15
|
name={string | Namekey}
|
|
15
16
|
refkey={Refkey | Refkey[]}
|
|
@@ -24,6 +25,7 @@ Create a Python class declaration.
|
|
|
24
25
|
|
|
25
26
|
ClassDeclaration({
|
|
26
27
|
bases: Children[],
|
|
28
|
+
decorators: Children[],
|
|
27
29
|
doc: Children,
|
|
28
30
|
name: string | Namekey,
|
|
29
31
|
refkey: Refkey | Refkey[],
|
|
@@ -32,13 +34,14 @@ Create a Python class declaration.
|
|
|
32
34
|
|
|
33
35
|
## Props
|
|
34
36
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
| bases
|
|
38
|
-
| children
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
37
|
+
| | | |
|
|
38
|
+
| ---------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| bases | optional [Children](../../../core/types/children/)\[] | The base classes that this class inherits from. |
|
|
40
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
41
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above the `class` keyword, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the outermost decorator (applied last). Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries are skipped, so conditional decorators can be provided inline when needed. Wrappers like [`DataclassDeclaration`](DataclassDeclaration.md) build their intrinsic decorator (e.g. `@dataclass(...)`) and append it to this list at the position that keeps `@dataclass` closest to the class — i.e. user `decorators` end up **above** the intrinsic one, matching how Pydantic’s `@field_validator` sits above `@classmethod` on methods. Do **not** pass a wrapper’s intrinsic decorator here. For example, when using [`DataclassDeclaration`](DataclassDeclaration.md), do not include `@dataclass(...)` in `decorators` — the component renders it for you, and stacking it twice would produce invalid Python. |
|
|
42
|
+
| doc | optional [Children](../../../core/types/children/) | Documentation for this declaration |
|
|
43
|
+
| name | string \| [Namekey](../../../core/types/namekey/) | The base name of this declaration. May change depending on naming policy and any conflicts. |
|
|
44
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | The refkey or array of refkeys for this declaration. |
|
|
42
45
|
|
|
43
46
|
## Remarks
|
|
44
47
|
|
|
@@ -13,6 +13,7 @@ This generates enums using the `class Name(Enum):` syntax with member definition
|
|
|
13
13
|
<ClassEnumDeclaration
|
|
14
14
|
auto
|
|
15
15
|
baseType={"Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag"}
|
|
16
|
+
decorators={Children[]}
|
|
16
17
|
doc={Children}
|
|
17
18
|
members={Array<EnumMemberProps>}
|
|
18
19
|
/>
|
|
@@ -27,6 +28,7 @@ This generates enums using the `class Name(Enum):` syntax with member definition
|
|
|
27
28
|
ClassEnumDeclaration({
|
|
28
29
|
auto: boolean,
|
|
29
30
|
baseType: "Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag",
|
|
31
|
+
decorators: Children[],
|
|
30
32
|
doc: Children,
|
|
31
33
|
members: Array<EnumMemberProps>,
|
|
32
34
|
}).children(children)
|
|
@@ -34,12 +36,13 @@ This generates enums using the `class Name(Enum):` syntax with member definition
|
|
|
34
36
|
|
|
35
37
|
## Props
|
|
36
38
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
| auto
|
|
40
|
-
| baseType
|
|
41
|
-
|
|
|
42
|
-
|
|
|
39
|
+
| | | |
|
|
40
|
+
| ---------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| auto | optional boolean | Indicates that the enum members should be auto-generated. |
|
|
42
|
+
| baseType | optional “Enum” \| “IntEnum” \| “StrEnum” \| “Flag” \| “IntFlag” | The base type of the enum. One of: ‘Enum’, ‘IntEnum’, ‘StrEnum’, ‘Flag’, ‘IntFlag’. Defaults to ‘Enum’. |
|
|
43
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above `class <Name>(<BaseType>):`. See \[unresolved link] for the source-order and falsy skip semantics. Not available on functional-enum syntax (`Name = Enum(...)`), which is a variable assignment rather than a class definition. |
|
|
44
|
+
| doc | optional [Children](../../../core/types/children/) | Optional docstring for the enum. |
|
|
45
|
+
| members | optional Array<[EnumMemberProps](../enummember/)> | Members of the enum as an array of objects. |
|
|
43
46
|
|
|
44
47
|
## Examples
|
|
45
48
|
|
|
@@ -8,7 +8,7 @@ A Python class method declaration component.
|
|
|
8
8
|
import { ClassMethodDeclaration } from "@alloy-js/python";
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<ClassMethodDeclaration abstract async />
|
|
11
|
+
<ClassMethodDeclaration abstract async decorators={Children[]} />
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
* stc
|
|
@@ -20,12 +20,14 @@ A Python class method declaration component.
|
|
|
20
20
|
ClassMethodDeclaration({
|
|
21
21
|
abstract: boolean,
|
|
22
22
|
async: boolean,
|
|
23
|
+
decorators: Children[],
|
|
23
24
|
}).children(children)
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
## Props
|
|
27
28
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| abstract
|
|
31
|
-
| async
|
|
29
|
+
| | | |
|
|
30
|
+
| ---------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| abstract | optional boolean | |
|
|
32
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
33
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above `def`, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the **outermost** decorator (applied last) and wraps the result of every decorator below it. Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries (other than `0`) are skipped, so conditional decorators can be provided inline when needed. When used through wrappers that emit an intrinsic decorator ([`ClassMethodDeclaration`](ClassMethodDeclaration.md) → `@classmethod`, [`StaticMethodDeclaration`](StaticMethodDeclaration.md) → `@staticmethod`, [`PropertyDeclaration`](PropertyDeclaration.md) → `@property`), these decorators are rendered **above** the intrinsic line — the correct position for Pydantic’s `@field_validator` / `@model_validator` and other wrappers that must see the underlying function, not a descriptor. When used on plain [`MethodDeclaration`](MethodDeclaration.md) / [`FunctionDeclaration`](FunctionDeclaration.md), these decorators are rendered above `@abstractmethod` (if `abstract` is set) and above `def`. Do **not** pass intrinsic decorators here — i.e. `@classmethod`, `@staticmethod`, `@property`, or `@abstractmethod`. Those are emitted by the matching component ([`ClassMethodDeclaration`](ClassMethodDeclaration.md), [`StaticMethodDeclaration`](StaticMethodDeclaration.md), [`PropertyDeclaration`](PropertyDeclaration.md), or the `abstract` flag) and would otherwise be stacked twice in the output, producing invalid Python. |
|
|
@@ -36,7 +36,7 @@ class User:
|
|
|
36
36
|
import { DataclassDeclaration } from "@alloy-js/python";
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
<DataclassDeclaration bases={Children[]} />
|
|
39
|
+
<DataclassDeclaration bases={Children[]} decorators={Children[]} />
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
* stc
|
|
@@ -45,11 +45,15 @@ class User:
|
|
|
45
45
|
import { DataclassDeclaration } from "@alloy-js/python/stc";
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
DataclassDeclaration({
|
|
48
|
+
DataclassDeclaration({
|
|
49
|
+
bases: Children[],
|
|
50
|
+
decorators: Children[],
|
|
51
|
+
}).children(children)
|
|
49
52
|
```
|
|
50
53
|
|
|
51
54
|
## Props
|
|
52
55
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
| bases
|
|
56
|
+
| | | |
|
|
57
|
+
| ---------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| bases | optional [Children](../../../core/types/children/)\[] | The base classes that this class inherits from. |
|
|
59
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above the `class` keyword, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the outermost decorator (applied last). Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries are skipped, so conditional decorators can be provided inline when needed. Wrappers like [`DataclassDeclaration`](DataclassDeclaration.md) build their intrinsic decorator (e.g. `@dataclass(...)`) and append it to this list at the position that keeps `@dataclass` closest to the class — i.e. user `decorators` end up **above** the intrinsic one, matching how Pydantic’s `@field_validator` sits above `@classmethod` on methods. Do **not** pass a wrapper’s intrinsic decorator here. For example, when using [`DataclassDeclaration`](DataclassDeclaration.md), do not include `@dataclass(...)` in `decorators` — the component renders it for you, and stacking it twice would produce invalid Python. |
|
|
@@ -8,7 +8,7 @@ A Python dunder method declaration.
|
|
|
8
8
|
import { DunderMethodDeclaration } from "@alloy-js/python";
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<DunderMethodDeclaration abstract async />
|
|
11
|
+
<DunderMethodDeclaration abstract async decorators={Children[]} />
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
* stc
|
|
@@ -20,12 +20,14 @@ A Python dunder method declaration.
|
|
|
20
20
|
DunderMethodDeclaration({
|
|
21
21
|
abstract: boolean,
|
|
22
22
|
async: boolean,
|
|
23
|
+
decorators: Children[],
|
|
23
24
|
}).children(children)
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
## Props
|
|
27
28
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| abstract
|
|
31
|
-
| async
|
|
29
|
+
| | | |
|
|
30
|
+
| ---------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| abstract | optional boolean | |
|
|
32
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
33
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above `def`, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the **outermost** decorator (applied last) and wraps the result of every decorator below it. Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries (other than `0`) are skipped, so conditional decorators can be provided inline when needed. When used through wrappers that emit an intrinsic decorator ([`ClassMethodDeclaration`](ClassMethodDeclaration.md) → `@classmethod`, [`StaticMethodDeclaration`](StaticMethodDeclaration.md) → `@staticmethod`, [`PropertyDeclaration`](PropertyDeclaration.md) → `@property`), these decorators are rendered **above** the intrinsic line — the correct position for Pydantic’s `@field_validator` / `@model_validator` and other wrappers that must see the underlying function, not a descriptor. When used on plain [`MethodDeclaration`](MethodDeclaration.md) / [`FunctionDeclaration`](FunctionDeclaration.md), these decorators are rendered above `@abstractmethod` (if `abstract` is set) and above `def`. Do **not** pass intrinsic decorators here — i.e. `@classmethod`, `@staticmethod`, `@property`, or `@abstractmethod`. Those are emitted by the matching component ([`ClassMethodDeclaration`](ClassMethodDeclaration.md), [`StaticMethodDeclaration`](StaticMethodDeclaration.md), [`PropertyDeclaration`](PropertyDeclaration.md), or the `abstract` flag) and would otherwise be stacked twice in the output, producing invalid Python. |
|
|
@@ -8,7 +8,7 @@ A Python function declaration.
|
|
|
8
8
|
import { FunctionDeclaration } from "@alloy-js/python";
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<FunctionDeclaration async />
|
|
11
|
+
<FunctionDeclaration async decorators={Children[]} />
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
* stc
|
|
@@ -17,14 +17,18 @@ A Python function declaration.
|
|
|
17
17
|
import { FunctionDeclaration } from "@alloy-js/python/stc";
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
FunctionDeclaration({
|
|
20
|
+
FunctionDeclaration({
|
|
21
|
+
async: boolean,
|
|
22
|
+
decorators: Children[],
|
|
23
|
+
}).children(children)
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
## Props
|
|
24
27
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
| async
|
|
28
|
+
| | | |
|
|
29
|
+
| ---------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
30
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
31
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above `def`, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the **outermost** decorator (applied last) and wraps the result of every decorator below it. Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries (other than `0`) are skipped, so conditional decorators can be provided inline when needed. When used through wrappers that emit an intrinsic decorator ([`ClassMethodDeclaration`](ClassMethodDeclaration.md) → `@classmethod`, [`StaticMethodDeclaration`](StaticMethodDeclaration.md) → `@staticmethod`, [`PropertyDeclaration`](PropertyDeclaration.md) → `@property`), these decorators are rendered **above** the intrinsic line — the correct position for Pydantic’s `@field_validator` / `@model_validator` and other wrappers that must see the underlying function, not a descriptor. When used on plain [`MethodDeclaration`](MethodDeclaration.md) / [`FunctionDeclaration`](FunctionDeclaration.md), these decorators are rendered above `@abstractmethod` (if `abstract` is set) and above `def`. Do **not** pass intrinsic decorators here — i.e. `@classmethod`, `@staticmethod`, `@property`, or `@abstractmethod`. Those are emitted by the matching component ([`ClassMethodDeclaration`](ClassMethodDeclaration.md), [`StaticMethodDeclaration`](StaticMethodDeclaration.md), [`PropertyDeclaration`](PropertyDeclaration.md), or the `abstract` flag) and would otherwise be stacked twice in the output, producing invalid Python. |
|
|
28
32
|
|
|
29
33
|
## Remarks
|
|
30
34
|
|
|
@@ -33,7 +33,7 @@ Use this in the `futureImports` prop of SourceFile to ensure proper placement.
|
|
|
33
33
|
## Example
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
|
-
<SourceFile path="models.py" futureImports={<FutureStatement feature="annotations" />}>
|
|
36
|
+
<SourceFile path="models.py" futureImports={[<FutureStatement feature="annotations" />]}>
|
|
37
37
|
<ClassDeclaration name="User">
|
|
38
38
|
<PropertyDeclaration name="manager" type="User" />
|
|
39
39
|
</ClassDeclaration>
|
|
@@ -10,7 +10,7 @@ Shared base props for all method-like declarations.
|
|
|
10
10
|
import { MethodDeclaration } from "@alloy-js/python";
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
<MethodDeclaration abstract async />
|
|
13
|
+
<MethodDeclaration abstract async decorators={Children[]} />
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
* stc
|
|
@@ -19,15 +19,20 @@ Shared base props for all method-like declarations.
|
|
|
19
19
|
import { MethodDeclaration } from "@alloy-js/python/stc";
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
MethodDeclaration({
|
|
22
|
+
MethodDeclaration({
|
|
23
|
+
abstract: boolean,
|
|
24
|
+
async: boolean,
|
|
25
|
+
decorators: Children[],
|
|
26
|
+
}).children(children)
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
## Props
|
|
26
30
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
| abstract
|
|
30
|
-
| async
|
|
31
|
+
| | | |
|
|
32
|
+
| ---------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
33
|
+
| abstract | optional boolean | Indicates that the method is abstract. |
|
|
34
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
35
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above `def`, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the **outermost** decorator (applied last) and wraps the result of every decorator below it. Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries (other than `0`) are skipped, so conditional decorators can be provided inline when needed. When used through wrappers that emit an intrinsic decorator ([`ClassMethodDeclaration`](ClassMethodDeclaration.md) → `@classmethod`, [`StaticMethodDeclaration`](StaticMethodDeclaration.md) → `@staticmethod`, [`PropertyDeclaration`](PropertyDeclaration.md) → `@property`), these decorators are rendered **above** the intrinsic line — the correct position for Pydantic’s `@field_validator` / `@model_validator` and other wrappers that must see the underlying function, not a descriptor. When used on plain [`MethodDeclaration`](MethodDeclaration.md) / [`FunctionDeclaration`](FunctionDeclaration.md), these decorators are rendered above `@abstractmethod` (if `abstract` is set) and above `def`. Do **not** pass intrinsic decorators here — i.e. `@classmethod`, `@staticmethod`, `@property`, or `@abstractmethod`. Those are emitted by the matching component ([`ClassMethodDeclaration`](ClassMethodDeclaration.md), [`StaticMethodDeclaration`](StaticMethodDeclaration.md), [`PropertyDeclaration`](PropertyDeclaration.md), or the `abstract` flag) and would otherwise be stacked twice in the output, producing invalid Python. |
|
|
31
36
|
|
|
32
37
|
## Remarks
|
|
33
38
|
|
|
@@ -10,6 +10,7 @@ Declares a Python property with optional getter, setter, and deleter methods.
|
|
|
10
10
|
|
|
11
11
|
<PropertyDeclaration
|
|
12
12
|
abstract
|
|
13
|
+
decorators={Children[]}
|
|
13
14
|
doc={Children}
|
|
14
15
|
name="string"
|
|
15
16
|
refkey={Refkey}
|
|
@@ -27,6 +28,7 @@ Declares a Python property with optional getter, setter, and deleter methods.
|
|
|
27
28
|
|
|
28
29
|
PropertyDeclaration({
|
|
29
30
|
abstract: boolean,
|
|
31
|
+
decorators: Children[],
|
|
30
32
|
doc: Children,
|
|
31
33
|
name: string,
|
|
32
34
|
refkey: Refkey,
|
|
@@ -36,11 +38,12 @@ Declares a Python property with optional getter, setter, and deleter methods.
|
|
|
36
38
|
|
|
37
39
|
## Props
|
|
38
40
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
| abstract
|
|
42
|
-
| children
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
41
|
+
| | | |
|
|
42
|
+
| ---------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| abstract | optional boolean | |
|
|
44
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
45
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above the intrinsic `@property` line, in source order (`decorators[0]` is topmost / applied last). Use for decorators that wrap the resulting property, e.g. Pydantic’s `@computed_field`. |
|
|
46
|
+
| doc | optional [Children](../../../core/types/children/) | |
|
|
47
|
+
| name | string | |
|
|
48
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) | |
|
|
49
|
+
| type | optional [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# PydanticClassDeclaration
|
|
2
|
+
|
|
3
|
+
Renders a Python class that subclasses Pydantic’s `BaseModel`: `class Name(BaseModel): ...`.
|
|
4
|
+
|
|
5
|
+
When `bases` is omitted, the class extends `pydanticModule["."].BaseModel`. Pass `bases` to inherit from another generated class (or to combine bases explicitly).
|
|
6
|
+
|
|
7
|
+
Optional `modelConfig={{...}}` and top-level config props (for example `frozen`, `strict`, `extra`) emit `model_config = ConfigDict(...)` for common Pydantic v2 model settings (see [PydanticModelConfigDictProps](../../types/pydanticmodelconfigdictprops/)). When both are used, top-level props override `modelConfig` keys.
|
|
8
|
+
|
|
9
|
+
Fields are ordinary class body declarations; use `pydanticModule["."].Field` in initializers when you need `Field(...)`.
|
|
10
|
+
|
|
11
|
+
* jsx
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { PydanticClassDeclaration } from "@alloy-js/python";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<PydanticClassDeclaration
|
|
18
|
+
aliasGenerator="string"
|
|
19
|
+
arbitraryTypesAllowed
|
|
20
|
+
bases={Children[]}
|
|
21
|
+
coerceNumbersToStr
|
|
22
|
+
decorators={Children[]}
|
|
23
|
+
extra={"allow" | "forbid" | "ignore"}
|
|
24
|
+
fromAttributes
|
|
25
|
+
frozen
|
|
26
|
+
hideInputInErrors
|
|
27
|
+
jsonSchemaExtra={Record<string, unknown>}
|
|
28
|
+
locByAlias
|
|
29
|
+
modelConfig={PydanticModelConfigDictProps}
|
|
30
|
+
modelConfigExpression={Children}
|
|
31
|
+
populateByName
|
|
32
|
+
revalidateInstances={"always" | "never" | "subclass-instances"}
|
|
33
|
+
serJsonBytes={"utf8" | "base64" | "hex"}
|
|
34
|
+
serJsonInfNan={"null" | "constants" | "strings"}
|
|
35
|
+
strMaxLength={number}
|
|
36
|
+
strMinLength={number}
|
|
37
|
+
strStripWhitespace
|
|
38
|
+
strToLower
|
|
39
|
+
strToUpper
|
|
40
|
+
strict
|
|
41
|
+
useEnumValues
|
|
42
|
+
valJsonBytes={"utf8" | "base64" | "hex"}
|
|
43
|
+
validateAssignment
|
|
44
|
+
validateDefault
|
|
45
|
+
validateReturn
|
|
46
|
+
/>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
* stc
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { PydanticClassDeclaration } from "@alloy-js/python/stc";
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
PydanticClassDeclaration({
|
|
56
|
+
aliasGenerator: string,
|
|
57
|
+
arbitraryTypesAllowed: boolean,
|
|
58
|
+
bases: Children[],
|
|
59
|
+
coerceNumbersToStr: boolean,
|
|
60
|
+
decorators: Children[],
|
|
61
|
+
extra: "allow" | "forbid" | "ignore",
|
|
62
|
+
fromAttributes: boolean,
|
|
63
|
+
frozen: boolean,
|
|
64
|
+
hideInputInErrors: boolean,
|
|
65
|
+
jsonSchemaExtra: Record<string, unknown>,
|
|
66
|
+
locByAlias: boolean,
|
|
67
|
+
modelConfig: PydanticModelConfigDictProps,
|
|
68
|
+
modelConfigExpression: Children,
|
|
69
|
+
populateByName: boolean,
|
|
70
|
+
revalidateInstances: "always" | "never" | "subclass-instances",
|
|
71
|
+
serJsonBytes: "utf8" | "base64" | "hex",
|
|
72
|
+
serJsonInfNan: "null" | "constants" | "strings",
|
|
73
|
+
strMaxLength: number,
|
|
74
|
+
strMinLength: number,
|
|
75
|
+
strStripWhitespace: boolean,
|
|
76
|
+
strToLower: boolean,
|
|
77
|
+
strToUpper: boolean,
|
|
78
|
+
strict: boolean,
|
|
79
|
+
useEnumValues: boolean,
|
|
80
|
+
valJsonBytes: "utf8" | "base64" | "hex",
|
|
81
|
+
validateAssignment: boolean,
|
|
82
|
+
validateDefault: boolean,
|
|
83
|
+
validateReturn: boolean,
|
|
84
|
+
}).children(children)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Props
|
|
88
|
+
|
|
89
|
+
| | | |
|
|
90
|
+
| --------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
91
|
+
| aliasGenerator | optional string | Resolve field aliases from a configured alias generator. |
|
|
92
|
+
| arbitraryTypesAllowed | optional boolean | Allow non-pydantic/arbitrary Python types in field annotations. |
|
|
93
|
+
| bases | optional [Children](../../../core/types/children/)\[] | The base classes that this class inherits from. |
|
|
94
|
+
| coerceNumbersToStr | optional boolean | Coerce numeric input values to strings for `str` fields. |
|
|
95
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above the `class` keyword, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the outermost decorator (applied last). Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries are skipped, so conditional decorators can be provided inline when needed. Wrappers like [`DataclassDeclaration`](DataclassDeclaration.md) build their intrinsic decorator (e.g. `@dataclass(...)`) and append it to this list at the position that keeps `@dataclass` closest to the class — i.e. user `decorators` end up **above** the intrinsic one, matching how Pydantic’s `@field_validator` sits above `@classmethod` on methods. Do **not** pass a wrapper’s intrinsic decorator here. For example, when using [`DataclassDeclaration`](DataclassDeclaration.md), do not include `@dataclass(...)` in `decorators` — the component renders it for you, and stacking it twice would produce invalid Python. |
|
|
96
|
+
| extra | optional “allow” \| “forbid” \| “ignore” | Behavior for unknown input keys: allow, forbid, or ignore. |
|
|
97
|
+
| fromAttributes | optional boolean | Populate models from object attributes (ORM-style) instead of mapping keys. |
|
|
98
|
+
| frozen | optional boolean | Make models immutable (`frozen=True`). |
|
|
99
|
+
| hideInputInErrors | optional boolean | Hide input values in validation error messages. |
|
|
100
|
+
| jsonSchemaExtra | optional Record\<string, unknown> | Include JSON schema extras via a plain JSON-serializable object. |
|
|
101
|
+
| locByAlias | optional boolean | Use aliases in error locations instead of field names. |
|
|
102
|
+
| modelConfig | optional [PydanticModelConfigDictProps](../../types/pydanticmodelconfigdictprops/) | Canonical structured config object for `ConfigDict(...)`. Values here are merged with top-level config props. Top-level config props take precedence over `modelConfig` when the same key is provided in both places. |
|
|
103
|
+
| modelConfigExpression | optional [Children](../../../core/types/children/) | Emits `model_config = <expression>` verbatim (use for arbitrary `ConfigDict` kwargs or dynamic config). Takes precedence over both `modelConfig` and top-level config props. |
|
|
104
|
+
| populateByName | optional boolean | Allow population by field name even when aliases are defined. |
|
|
105
|
+
| revalidateInstances | optional “always” \| “never” \| “subclass-instances” | Re-validate model/dataclass instances on assignment boundaries. |
|
|
106
|
+
| serJsonBytes | optional “utf8” \| “base64” \| “hex” | JSON serialization format for bytes values. |
|
|
107
|
+
| serJsonInfNan | optional “null” \| “constants” \| “strings” | JSON serialization behavior for Infinity/NaN values. |
|
|
108
|
+
| strMaxLength | optional number | Upper-bound for constrained string lengths at model level. |
|
|
109
|
+
| strMinLength | optional number | Lower-bound for constrained string lengths at model level. |
|
|
110
|
+
| strStripWhitespace | optional boolean | Strip leading/trailing whitespace from all `str` fields. |
|
|
111
|
+
| strToLower | optional boolean | Convert all `str` values to lowercase. |
|
|
112
|
+
| strToUpper | optional boolean | Convert all `str` values to uppercase. |
|
|
113
|
+
| strict | optional boolean | Enable strict validation globally for the model. |
|
|
114
|
+
| useEnumValues | optional boolean | Use enum `.value` instead of enum instances during serialization. |
|
|
115
|
+
| valJsonBytes | optional “utf8” \| “base64” \| “hex” | JSON validation format for bytes values. |
|
|
116
|
+
| validateAssignment | optional boolean | Re-validate when attributes are assigned after model creation. |
|
|
117
|
+
| validateDefault | optional boolean | Validate default values in addition to provided input values. |
|
|
118
|
+
| validateReturn | optional boolean | Validate return values for call validators. |
|
|
119
|
+
|
|
120
|
+
## Example
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { pydanticModule } from "@alloy-js/python";
|
|
124
|
+
import * as py from "@alloy-js/python";
|
|
125
|
+
|
|
126
|
+
<py.PydanticClassDeclaration name="User" frozen>
|
|
127
|
+
<py.VariableDeclaration instanceVariable omitNone name="id" type="int" />
|
|
128
|
+
<py.VariableDeclaration
|
|
129
|
+
instanceVariable
|
|
130
|
+
name="name"
|
|
131
|
+
type="str"
|
|
132
|
+
initializer={"Field(default=\"anonymous\")"}
|
|
133
|
+
/>
|
|
134
|
+
</py.PydanticClassDeclaration>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```py
|
|
138
|
+
from pydantic import BaseModel
|
|
139
|
+
from pydantic import ConfigDict
|
|
140
|
+
from pydantic import Field
|
|
141
|
+
|
|
142
|
+
class User(BaseModel):
|
|
143
|
+
model_config = ConfigDict(frozen=True)
|
|
144
|
+
id: int
|
|
145
|
+
name: str = Field(default="anonymous")
|
|
146
|
+
```
|
|
@@ -8,7 +8,7 @@ A Python static method declaration component.
|
|
|
8
8
|
import { StaticMethodDeclaration } from "@alloy-js/python";
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<StaticMethodDeclaration abstract async />
|
|
11
|
+
<StaticMethodDeclaration abstract async decorators={Children[]} />
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
* stc
|
|
@@ -20,12 +20,14 @@ A Python static method declaration component.
|
|
|
20
20
|
StaticMethodDeclaration({
|
|
21
21
|
abstract: boolean,
|
|
22
22
|
async: boolean,
|
|
23
|
+
decorators: Children[],
|
|
23
24
|
}).children(children)
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
## Props
|
|
27
28
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| abstract
|
|
31
|
-
| async
|
|
29
|
+
| | | |
|
|
30
|
+
| ---------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| abstract | optional boolean | |
|
|
32
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
33
|
+
| decorators | optional [Children](../../../core/types/children/)\[] | Decorators rendered above `def`, in source order — `decorators[0]` is topmost. By Python’s bottom-up application order, the topmost entry is the **outermost** decorator (applied last) and wraps the result of every decorator below it. Each entry should produce a complete decorator line (typically starting with `@`). Falsy entries (other than `0`) are skipped, so conditional decorators can be provided inline when needed. When used through wrappers that emit an intrinsic decorator ([`ClassMethodDeclaration`](ClassMethodDeclaration.md) → `@classmethod`, [`StaticMethodDeclaration`](StaticMethodDeclaration.md) → `@staticmethod`, [`PropertyDeclaration`](PropertyDeclaration.md) → `@property`), these decorators are rendered **above** the intrinsic line — the correct position for Pydantic’s `@field_validator` / `@model_validator` and other wrappers that must see the underlying function, not a descriptor. When used on plain [`MethodDeclaration`](MethodDeclaration.md) / [`FunctionDeclaration`](FunctionDeclaration.md), these decorators are rendered above `@abstractmethod` (if `abstract` is set) and above `def`. Do **not** pass intrinsic decorators here — i.e. `@classmethod`, `@staticmethod`, `@property`, or `@abstractmethod`. Those are emitted by the matching component ([`ClassMethodDeclaration`](ClassMethodDeclaration.md), [`StaticMethodDeclaration`](StaticMethodDeclaration.md), [`PropertyDeclaration`](PropertyDeclaration.md), or the `abstract` flag) and would otherwise be stacked twice in the output, producing invalid Python. |
|