@alloy-js/python 0.4.0-dev.5 → 0.4.0-dev.6
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/name-conflict-resolver.js +2 -2
- package/dist/dev/src/name-conflict-resolver.js.map +1 -1
- package/dist/src/name-conflict-resolver.d.ts +2 -2
- package/dist/src/name-conflict-resolver.d.ts.map +1 -1
- package/dist/src/name-conflict-resolver.js +2 -2
- package/dist/src/name-conflict-resolver.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/AttributeDoc.md +36 -0
- package/docs/api/components/CallSignature.md +62 -0
- package/docs/api/components/CallSignatureParameters.md +49 -0
- package/docs/api/components/ClassDeclaration.md +67 -0
- package/docs/api/components/ClassDoc.md +55 -0
- package/docs/api/components/ClassEnumDeclaration.md +111 -0
- package/docs/api/components/ClassInstantiation.md +44 -0
- package/docs/api/components/ClassMethodDeclaration.md +31 -0
- package/docs/api/components/ConstructorDeclaration.md +27 -0
- package/docs/api/components/DataclassDeclaration.md +55 -0
- package/docs/api/components/Declaration.md +41 -0
- package/docs/api/components/DunderMethodDeclaration.md +31 -0
- package/docs/api/components/EnumMember.md +61 -0
- package/docs/api/components/ExceptionDoc.md +55 -0
- package/docs/api/components/FunctionCallExpression.md +43 -0
- package/docs/api/components/FunctionDeclaration.md +50 -0
- package/docs/api/components/FunctionDoc.md +61 -0
- package/docs/api/components/FunctionalEnumDeclaration.md +79 -0
- package/docs/api/components/FutureStatement.md +51 -0
- package/docs/api/components/GeneratorDoc.md +58 -0
- package/docs/api/components/InlineDoc.md +29 -0
- package/docs/api/components/LexicalScope.md +65 -0
- package/docs/api/components/MemberExpression.md +53 -0
- package/docs/api/components/MemberScope.md +28 -0
- package/docs/api/components/MethodDeclaration.md +49 -0
- package/docs/api/components/MethodDoc.md +61 -0
- package/docs/api/components/ModuleDoc.md +52 -0
- package/docs/api/components/PropertyDeclaration.md +46 -0
- package/docs/api/components/PropertyDoc.md +52 -0
- package/docs/api/components/PyDoc.md +29 -0
- package/docs/api/components/PyDocExample.md +29 -0
- package/docs/api/components/PythonBlock.md +47 -0
- package/docs/api/components/Reference.md +31 -0
- package/docs/api/components/SimpleCommentBlock.md +27 -0
- package/docs/api/components/SimpleInlineComment.md +27 -0
- package/docs/api/components/SourceFile.md +83 -0
- package/docs/api/components/StatementList.md +47 -0
- package/docs/api/components/StaticMethodDeclaration.md +31 -0
- package/docs/api/components/TypeArguments.md +27 -0
- package/docs/api/components/TypeRefContext.md +41 -0
- package/docs/api/components/TypeReference.md +37 -0
- package/docs/api/components/UnionTypeExpression.md +27 -0
- package/docs/api/components/VariableDeclaration.md +87 -0
- package/docs/api/components/index.md +46 -0
- package/docs/api/components/useSourceFile.md +19 -0
- package/docs/api/contexts/PythonSourceFile-context.md +18 -0
- package/docs/api/contexts/index.md +3 -0
- package/docs/api/functions/createFunctionSymbol.md +23 -0
- package/docs/api/functions/createMethodSymbol.md +23 -0
- package/docs/api/functions/createModule.md +18 -0
- package/docs/api/functions/createPythonNamePolicy.md +17 -0
- package/docs/api/functions/getCallSignatureProps.md +21 -0
- package/docs/api/functions/index.md +13 -0
- package/docs/api/functions/isParameterDescriptor.md +18 -0
- package/docs/api/functions/isTypeRefContext.md +17 -0
- package/docs/api/functions/ref.md +25 -0
- package/docs/api/functions/usePythonLexicalScope.md +17 -0
- package/docs/api/functions/usePythonNamePolicy.md +17 -0
- package/docs/api/functions/usePythonScope.md +17 -0
- package/docs/api/index.md +7 -0
- package/docs/api/types/AddImportOptions.md +7 -0
- package/docs/api/types/BaseDeclarationProps.md +10 -0
- package/docs/api/types/CommonFunctionProps.md +15 -0
- package/docs/api/types/CreateModuleProps.md +8 -0
- package/docs/api/types/CreatePythonSymbolFunctionOptions.md +9 -0
- package/docs/api/types/DataclassDecoratorKey.md +5 -0
- package/docs/api/types/DataclassDecoratorKwargs.md +5 -0
- package/docs/api/types/EnumPropsBase.md +11 -0
- package/docs/api/types/GoogleStyleDocAttributeProps.md +9 -0
- package/docs/api/types/ImportRecordProps.md +7 -0
- package/docs/api/types/ImportRecords.md +8 -0
- package/docs/api/types/ImportedSymbol.md +10 -0
- package/docs/api/types/LexicalScopeProps.md +5 -0
- package/docs/api/types/MemberExpressionPartProps.md +13 -0
- package/docs/api/types/ModuleDescriptor.md +7 -0
- package/docs/api/types/ModuleRefkeys.md +7 -0
- package/docs/api/types/NamedMap.md +7 -0
- package/docs/api/types/ParameterDescriptor.md +13 -0
- package/docs/api/types/ParameterMarker.md +5 -0
- package/docs/api/types/PropertyMethodDeclarationProps.md +9 -0
- package/docs/api/types/PythonElements.md +5 -0
- package/docs/api/types/PythonLexicalScope.md +11 -0
- package/docs/api/types/PythonMemberScope.md +9 -0
- package/docs/api/types/PythonModuleScope.md +13 -0
- package/docs/api/types/PythonOutputScope.md +5 -0
- package/docs/api/types/PythonOutputSymbol.md +21 -0
- package/docs/api/types/PythonOutputSymbolOptions.md +10 -0
- package/docs/api/types/RefOptions.md +7 -0
- package/docs/api/types/SubscriptionProps.md +9 -0
- package/docs/api/types/index.md +31 -0
- package/docs/api/variables/abcModule.md +7 -0
- package/docs/api/variables/dataclassDecoratorKeySet.md +5 -0
- package/docs/api/variables/dataclassDecoratorKeys.md +7 -0
- package/docs/api/variables/dataclassesModule.md +7 -0
- package/docs/api/variables/enumModule.md +7 -0
- package/docs/api/variables/index.md +8 -0
- package/docs/api/variables/requestsModule.md +8 -0
- package/package.json +4 -4
- package/src/name-conflict-resolver.ts +4 -10
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# VariableDeclaration
|
|
2
|
+
|
|
3
|
+
A variable declaration component for Python.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { VariableDeclaration } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<VariableDeclaration
|
|
12
|
+
callStatementVar
|
|
13
|
+
doc={Children}
|
|
14
|
+
initializer={Children}
|
|
15
|
+
instanceVariable
|
|
16
|
+
name={string | Namekey}
|
|
17
|
+
omitNone
|
|
18
|
+
refkey={Refkey | Refkey[]}
|
|
19
|
+
type={Children}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
* stc
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { VariableDeclaration } from "@alloy-js/python/stc";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
VariableDeclaration({
|
|
30
|
+
callStatementVar: boolean,
|
|
31
|
+
doc: Children,
|
|
32
|
+
initializer: Children,
|
|
33
|
+
instanceVariable: boolean,
|
|
34
|
+
name: string | Namekey,
|
|
35
|
+
omitNone: boolean,
|
|
36
|
+
refkey: Refkey | Refkey[],
|
|
37
|
+
type: Children,
|
|
38
|
+
}).children(children)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
| | | |
|
|
44
|
+
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
45
|
+
| callStatementVar | optional boolean | Indicates if this is a call statement variable. Optional. This is used to handle cases where the variable is part of a call statement. |
|
|
46
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
47
|
+
| doc | optional [Children](../../../core/types/children/) | Documentation for this declaration |
|
|
48
|
+
| initializer | optional [Children](../../../core/types/children/) | The initial value of the variable. |
|
|
49
|
+
| instanceVariable | optional boolean | Indicates if this variable is an instance variable. Optional. This is used to handle cases where the variable is part of a class instance. |
|
|
50
|
+
| name | string \| [Namekey](../../../core/types/namekey/) | The base name of this declaration. May change depending on naming policy and any conflicts. |
|
|
51
|
+
| omitNone | optional boolean | Indicates if we should omit the None assignment. Optional. |
|
|
52
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | The refkey or array of refkeys for this declaration. |
|
|
53
|
+
| type | optional [Children](../../../core/types/children/) | The type of the variable. Used only for type annotation. Optional. |
|
|
54
|
+
|
|
55
|
+
## Example
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<VariableDeclaration
|
|
59
|
+
name="myVar"
|
|
60
|
+
type="int"
|
|
61
|
+
initializer={42} // Initial value
|
|
62
|
+
/>
|
|
63
|
+
<VariableDeclaration
|
|
64
|
+
name="myOtherVar"
|
|
65
|
+
type="str"
|
|
66
|
+
omitNone={true}
|
|
67
|
+
/>
|
|
68
|
+
<VariableDeclaration
|
|
69
|
+
name="myCallStmtVar"
|
|
70
|
+
callStatementVar={true}
|
|
71
|
+
initializer={12}
|
|
72
|
+
/>
|
|
73
|
+
VariableDeclaration
|
|
74
|
+
name=""
|
|
75
|
+
callStatementVar={true}
|
|
76
|
+
initializer={12}
|
|
77
|
+
/>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
renders to
|
|
81
|
+
|
|
82
|
+
```py
|
|
83
|
+
myVar: int = 42
|
|
84
|
+
myOtherVar: str
|
|
85
|
+
myCallStmtVar=12
|
|
86
|
+
12
|
|
87
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# python — components
|
|
2
|
+
|
|
3
|
+
- [AttributeDoc](AttributeDoc.md) — A component that creates documentation for a single attribute.
|
|
4
|
+
- [CallSignature](CallSignature.md) — A Python call signature, e.g.
|
|
5
|
+
- [CallSignatureParameters](CallSignatureParameters.md) — A call signature parameters declaration, which can be used to define the parameters of a function or other callables.
|
|
6
|
+
- [ClassDeclaration](ClassDeclaration.md) — Create a Python class declaration.
|
|
7
|
+
- [ClassDoc](ClassDoc.md) — A component that creates a ClassDoc block for classes.
|
|
8
|
+
- [ClassEnumDeclaration](ClassEnumDeclaration.md) — Create a Python enum using the class-based syntax.
|
|
9
|
+
- [ClassInstantiation](ClassInstantiation.md) — Used to create new instances of classes in Python.
|
|
10
|
+
- [ClassMethodDeclaration](ClassMethodDeclaration.md) — A Python class method declaration component.
|
|
11
|
+
- [ConstructorDeclaration](ConstructorDeclaration.md) — A Python constructor declaration for `__new__`.
|
|
12
|
+
- [DataclassDeclaration](DataclassDeclaration.md) — Renders a Python dataclass.
|
|
13
|
+
- [Declaration](Declaration.md) — A Python declaration, which can be a class, function, variable, etc.
|
|
14
|
+
- [DunderMethodDeclaration](DunderMethodDeclaration.md) — A Python dunder method declaration.
|
|
15
|
+
- [EnumMember](EnumMember.md) — A Python enum member.
|
|
16
|
+
- [ExceptionDoc](ExceptionDoc.md) — A component that creates an ExceptionDoc block for custom exception classes.
|
|
17
|
+
- [FunctionalEnumDeclaration](FunctionalEnumDeclaration.md) — Create a Python enum using the functional syntax.
|
|
18
|
+
- [FunctionCallExpression](FunctionCallExpression.md) — A Python function call expression.
|
|
19
|
+
- [FunctionDeclaration](FunctionDeclaration.md) — A Python function declaration.
|
|
20
|
+
- [FunctionDoc](FunctionDoc.md) — A component that creates a FunctionDoc block for functions.
|
|
21
|
+
- [FutureStatement](FutureStatement.md) — A future statement that imports features from **future**.
|
|
22
|
+
- [GeneratorDoc](GeneratorDoc.md) — A component that creates a GeneratorDoc block for generator functions.
|
|
23
|
+
- [InlineDoc](InlineDoc.md) — An inline documentation component for attribute docstrings.
|
|
24
|
+
- [LexicalScope](LexicalScope.md) — import { LexicalScope } from "@alloy-js/python";
|
|
25
|
+
- [MemberExpression](MemberExpression.md) — Create a member expression from parts.
|
|
26
|
+
- [MemberScope](MemberScope.md) — import { MemberScope } from "@alloy-js/python";
|
|
27
|
+
- [MethodDeclaration](MethodDeclaration.md) — A Python instance method declaration component.
|
|
28
|
+
- [MethodDoc](MethodDoc.md) — A component that creates a MethodDoc block for class methods.
|
|
29
|
+
- [ModuleDoc](ModuleDoc.md) — A component that creates a ModuleDoc block for module-level documentation.
|
|
30
|
+
- [PropertyDeclaration](PropertyDeclaration.md) — Declares a Python property with optional getter, setter, and deleter methods.
|
|
31
|
+
- [PropertyDoc](PropertyDoc.md) — A component that creates a PropertyDoc block for `@property` decorated methods.
|
|
32
|
+
- [PyDoc](PyDoc.md) — A PyDoc comment.
|
|
33
|
+
- [PyDocExample](PyDocExample.md) — Create a PyDoc example, which is prepended by >>.
|
|
34
|
+
- [PythonBlock](PythonBlock.md) — A Python block component that can be used to render a block of Python code.
|
|
35
|
+
- [Reference](Reference.md) — A Python reference to a symbol, such as a variable, function, or class.
|
|
36
|
+
- [SimpleCommentBlock](SimpleCommentBlock.md) — import { SimpleCommentBlock } from "@alloy-js/python";
|
|
37
|
+
- [SimpleInlineComment](SimpleInlineComment.md) — import { SimpleInlineComment } from "@alloy-js/python";
|
|
38
|
+
- [SourceFile](SourceFile.md) — A Python source file component that represents a Python file in the source directory.
|
|
39
|
+
- [StatementList](StatementList.md) — A Python statement list, which is a list of statements that can be rendered in a Python source file.
|
|
40
|
+
- [StaticMethodDeclaration](StaticMethodDeclaration.md) — A Python static method declaration component.
|
|
41
|
+
- [TypeArguments](TypeArguments.md) — Render Python-style type arguments, e.g.
|
|
42
|
+
- [TypeRefContext](TypeRefContext.md) — Set the current context of reference to be type reference.
|
|
43
|
+
- [TypeReference](TypeReference.md) — A type reference like Foo\[T, P] or int.
|
|
44
|
+
- [UnionTypeExpression](UnionTypeExpression.md) — import { UnionTypeExpression } from "@alloy-js/python";
|
|
45
|
+
- [useSourceFile](useSourceFile.md) — import { useSourceFile } from "@alloy-js/python";
|
|
46
|
+
- [VariableDeclaration](VariableDeclaration.md) — A variable declaration component for Python.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# useSourceFile
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { useSourceFile } from "@alloy-js/python";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<useSourceFile />
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
* stc
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { useSourceFile } from "@alloy-js/python/stc";
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
useSourceFile({ }).children(children)
|
|
19
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# PythonSourceFile context
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
const PythonSourceFileContext: ComponentContext<PythonSourceFileContext>
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## Accessor
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const myContext = useContext(PythonSourceFileContext);
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Context interface
|
|
14
|
+
|
|
15
|
+
| | | |
|
|
16
|
+
| ------ | --------------------------------------------------- | ------------------------------------------------------ |
|
|
17
|
+
| module | string | The module name for this file, e.g. ‘test’ for test.py |
|
|
18
|
+
| scope | [PythonModuleScope](../../types/pythonmodulescope/) | |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# createFunctionSymbol
|
|
2
|
+
|
|
3
|
+
Creates a function symbol in the current scope.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createFunctionSymbol } from "@alloy-js/python";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function createFunctionSymbol(name: string | Namekey, options?: {
|
|
10
|
+
refkeys?: any;
|
|
11
|
+
}): PythonOutputSymbol;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
| | | |
|
|
17
|
+
| ------- | --------------------------- | - |
|
|
18
|
+
| name | string \| Namekey | |
|
|
19
|
+
| options | optional { refkeys?: any; } | |
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
[PythonOutputSymbol](../../types/pythonoutputsymbol/)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# createMethodSymbol
|
|
2
|
+
|
|
3
|
+
Creates a method symbol in a class. Validates that the current scope is a member scope.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createMethodSymbol } from "@alloy-js/python";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function createMethodSymbol(name: string | Namekey, options?: {
|
|
10
|
+
refkeys?: any;
|
|
11
|
+
}): PythonOutputSymbol;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
| | | |
|
|
17
|
+
| ------- | --------------------------- | - |
|
|
18
|
+
| name | string \| Namekey | |
|
|
19
|
+
| options | optional { refkeys?: any; } | |
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
[PythonOutputSymbol](../../types/pythonoutputsymbol/)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# createModule
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { createModule } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function createModule<const T extends ModuleDescriptor>(props: CreateModuleProps<T>): ModuleRefkeys<T> & SymbolCreator;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| | | |
|
|
13
|
+
| ----- | --------------------- | - |
|
|
14
|
+
| props | CreateModuleProps\<T> | |
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
[ModuleRefkeys](../../types/modulerefkeys/)\<T> & [SymbolCreator](../../../core/types/symbolcreator/)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# createPythonNamePolicy
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { createPythonNamePolicy } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function createPythonNamePolicy(): NamePolicy<PythonElements>;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| |
|
|
13
|
+
| - |
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[NamePolicy](../../../core/types/namepolicy/)<[PythonElements](../../types/pythonelements/)>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# getCallSignatureProps
|
|
2
|
+
|
|
3
|
+
Extract only the call signature props from a props object which extends `CallSignatureProps`. You can provide default values for the props.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { getCallSignatureProps } from "@alloy-js/python";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function getCallSignatureProps(props: CallSignatureProps, defaults?: Partial<CallSignatureProps>): CallSignatureProps;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
|
|
14
|
+
| | | |
|
|
15
|
+
| -------- | ------------------------------------- | - |
|
|
16
|
+
| props | CallSignatureProps | |
|
|
17
|
+
| defaults | optional Partial\<CallSignatureProps> | |
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
[CallSignatureProps](../../components/callsignature/)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# python — functions
|
|
2
|
+
|
|
3
|
+
- [createFunctionSymbol](createFunctionSymbol.md) — Creates a function symbol in the current scope.
|
|
4
|
+
- [createMethodSymbol](createMethodSymbol.md) — Creates a method symbol in a class.
|
|
5
|
+
- [createModule](createModule.md) — import { createModule } from "@alloy-js/python";
|
|
6
|
+
- [createPythonNamePolicy](createPythonNamePolicy.md) — import { createPythonNamePolicy } from "@alloy-js/python";
|
|
7
|
+
- [getCallSignatureProps](getCallSignatureProps.md) — Extract only the call signature props from a props object which extends `CallSignatureProps`.
|
|
8
|
+
- [isParameterDescriptor](isParameterDescriptor.md) — import { isParameterDescriptor } from "@alloy-js/python";
|
|
9
|
+
- [isTypeRefContext](isTypeRefContext.md) — import { isTypeRefContext } from "@alloy-js/python";
|
|
10
|
+
- [ref](ref.md) — import { ref } from "@alloy-js/python";
|
|
11
|
+
- [usePythonLexicalScope](usePythonLexicalScope.md) — import { usePythonLexicalScope } from "@alloy-js/python";
|
|
12
|
+
- [usePythonNamePolicy](usePythonNamePolicy.md) — import { usePythonNamePolicy } from "@alloy-js/python";
|
|
13
|
+
- [usePythonScope](usePythonScope.md) — import { usePythonScope } from "@alloy-js/python";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# isParameterDescriptor
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { isParameterDescriptor } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function isParameterDescriptor(param: unknown): param is ParameterDescriptor;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| | | |
|
|
13
|
+
| ----- | ------- | - |
|
|
14
|
+
| param | unknown | |
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
param is [ParameterDescriptor](../../types/parameterdescriptor/)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# isTypeRefContext
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { isTypeRefContext } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function isTypeRefContext(): boolean;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| |
|
|
13
|
+
| - |
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
boolean ‘true’ if in a type context, ‘false’ if in a value context.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ref
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { ref } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function ref(refkey: Refkey, options?: RefOptions): () => [Children, PythonOutputSymbol | undefined];
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| | | |
|
|
13
|
+
| ------- | ------------------- | - |
|
|
14
|
+
| refkey | Refkey | |
|
|
15
|
+
| options | optional RefOptions | |
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
| | | |
|
|
20
|
+
| ---- | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| type | optional boolean | If true, this reference is only used in a type annotation context. The import will be guarded with `if TYPE_CHECKING:`. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
() => \[[Children](../../../core/types/children/), [PythonOutputSymbol](../../types/pythonoutputsymbol/) | undefined]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# usePythonLexicalScope
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { usePythonLexicalScope } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function usePythonLexicalScope(): PythonLexicalScope | PythonModuleScope;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| |
|
|
13
|
+
| - |
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[PythonLexicalScope](../../types/pythonlexicalscope/) | [PythonModuleScope](../../types/pythonmodulescope/)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# usePythonNamePolicy
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { usePythonNamePolicy } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function usePythonNamePolicy(): NamePolicy<PythonElements>;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| |
|
|
13
|
+
| - |
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[NamePolicy](../../../core/types/namepolicy/)<[PythonElements](../../types/pythonelements/)>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# usePythonScope
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { usePythonScope } from "@alloy-js/python";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function usePythonScope(): PythonOutputScope;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| |
|
|
13
|
+
| - |
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[PythonOutputScope](../../types/pythonoutputscope/)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# AddImportOptions
|
|
2
|
+
|
|
3
|
+
## Members
|
|
4
|
+
|
|
5
|
+
| | | |
|
|
6
|
+
| ---- | ---------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| type | optional boolean | If true, this import is only used in type annotation contexts. Such imports will be guarded with `if TYPE_CHECKING:`. |
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# BaseDeclarationProps
|
|
2
|
+
|
|
3
|
+
## Members
|
|
4
|
+
|
|
5
|
+
| | | |
|
|
6
|
+
| -------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
|
|
7
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
8
|
+
| doc | optional [Children](../../../core/types/children/) | Documentation for this declaration |
|
|
9
|
+
| name | string \| [Namekey](../../../core/types/namekey/) | The base name of this declaration. May change depending on naming policy and any conflicts. |
|
|
10
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | The refkey or array of refkeys for this declaration. |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# CommonFunctionProps
|
|
2
|
+
|
|
3
|
+
Shared base interface for function-like components.
|
|
4
|
+
|
|
5
|
+
## Members
|
|
6
|
+
|
|
7
|
+
Extends [BaseDeclarationProps](../basedeclarationprops/),[CallSignatureProps](../../components/callsignature/)
|
|
8
|
+
|
|
9
|
+
| | | |
|
|
10
|
+
| ----- | ---------------- | ------------------------------------- |
|
|
11
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
12
|
+
|
|
13
|
+
## Remarks
|
|
14
|
+
|
|
15
|
+
This interface is consumed by public components like [`FunctionDeclaration`](../components/FunctionDeclaration.md), [`MethodDeclaration`](../components/MethodDeclaration.md), and property method helpers. It combines declaration metadata with call signature shape.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# EnumPropsBase
|
|
2
|
+
|
|
3
|
+
## Members
|
|
4
|
+
|
|
5
|
+
Extends [BaseDeclarationProps](../basedeclarationprops/)
|
|
6
|
+
|
|
7
|
+
| | | |
|
|
8
|
+
| -------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| baseType | optional “Enum” \| “IntEnum” \| “StrEnum” \| “Flag” \| “IntFlag” | The base type of the enum. One of: ‘Enum’, ‘IntEnum’, ‘StrEnum’, ‘Flag’, ‘IntFlag’. Defaults to ‘Enum’. |
|
|
10
|
+
| doc | optional [Children](../../../core/types/children/) | Optional docstring for the enum. |
|
|
11
|
+
| members | optional Array<[EnumMemberProps](../../components/enummember/)> | Members of the enum as an array of objects. |
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# GoogleStyleDocAttributeProps
|
|
2
|
+
|
|
3
|
+
## Members
|
|
4
|
+
|
|
5
|
+
| | | |
|
|
6
|
+
| -------- | -------------------------------------------------- | - |
|
|
7
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
8
|
+
| name | [Children](../../../core/types/children/) | |
|
|
9
|
+
| type | optional [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# ImportedSymbol
|
|
2
|
+
|
|
3
|
+
## Members
|
|
4
|
+
|
|
5
|
+
| | | |
|
|
6
|
+
| ----------- | ------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
7
|
+
| constructor | (target: PythonOutputSymbol, local: PythonOutputSymbol) | Constructs a new instance of the [`ImportedSymbol`](ImportedSymbol.md) class |
|
|
8
|
+
| from | (target: PythonOutputSymbol, local: PythonOutputSymbol) => ImportedSymbol | |
|
|
9
|
+
| local | [PythonOutputSymbol](../pythonoutputsymbol/) | |
|
|
10
|
+
| target | [PythonOutputSymbol](../pythonoutputsymbol/) | |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# MemberExpressionPartProps
|
|
2
|
+
|
|
3
|
+
## Members
|
|
4
|
+
|
|
5
|
+
| | | |
|
|
6
|
+
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
7
|
+
| args | optional [Children](../../../core/types/children/)\[] \| boolean | Arguments to construct a call expression. |
|
|
8
|
+
| id | optional string \| number | The identifier for attribute access (obj.attr). Use this for Python attribute references. |
|
|
9
|
+
| key | optional [Children](../../../core/types/children/) | Single key for subscription access (obj\[key] or obj\[0]). Use this for single subscription access. |
|
|
10
|
+
| keys | optional [Children](../../../core/types/children/)\[] | Multiple keys for tuple subscription access (obj\[a, b] -> obj\[(a, b)]). Use this when you need tuple key access. |
|
|
11
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) | A refkey for a symbol whose name becomes the identifier. |
|
|
12
|
+
| slice | optional { start?: [Children](../../../core/types/children/); stop?: [Children](../../../core/types/children/); step?: [Children](../../../core/types/children/); } | Slice notation for subscription access (obj\[start:stop:step]). Use this for Python slice syntax. |
|
|
13
|
+
| symbol | optional [OutputSymbol](../../../core/types/outputsymbol/) | A symbol whose name becomes the identifier. |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# ParameterDescriptor
|
|
2
|
+
|
|
3
|
+
Information for a Python function parameter.
|
|
4
|
+
|
|
5
|
+
## Members
|
|
6
|
+
|
|
7
|
+
| | | |
|
|
8
|
+
| ------- | ------------------------------------------------------------------------------------------ | ----------------------------------- |
|
|
9
|
+
| default | optional [Children](../../../core/types/children/) | The default value of the parameter. |
|
|
10
|
+
| doc | optional [Children](../../../core/types/children/) | Documentation for the parameter. |
|
|
11
|
+
| name | string \| [Namekey](../../../core/types/namekey/) | The name of the parameter. |
|
|
12
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | The refkey for this parameter. |
|
|
13
|
+
| type | optional [Children](../../../core/types/children/) | The type of the parameter. |
|