@alloy-js/python 0.4.0-dev.3 → 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/builtins/python.js +30 -0
- package/dist/dev/src/builtins/python.js.map +1 -0
- package/dist/dev/src/components/Atom.js +122 -0
- package/dist/dev/src/components/Atom.js.map +1 -0
- package/dist/dev/src/components/CallSignature.js +195 -0
- package/dist/dev/src/components/CallSignature.js.map +1 -0
- package/dist/dev/src/components/ClassDeclaration.js +112 -0
- package/dist/dev/src/components/ClassDeclaration.js.map +1 -0
- package/dist/dev/src/components/ClassInstantiation.js +40 -0
- package/dist/dev/src/components/ClassInstantiation.js.map +1 -0
- package/dist/dev/src/components/ClassMethodDeclaration.js +40 -0
- package/dist/dev/src/components/ClassMethodDeclaration.js.map +1 -0
- package/dist/dev/src/components/ConstructorDeclaration.js +39 -0
- package/dist/dev/src/components/ConstructorDeclaration.js.map +1 -0
- package/dist/dev/src/components/DataclassDeclaration.js +177 -0
- package/dist/dev/src/components/DataclassDeclaration.js.map +1 -0
- package/dist/dev/src/components/Declaration.js +31 -0
- package/dist/dev/src/components/Declaration.js.map +1 -0
- package/dist/dev/src/components/DunderMethodDeclaration.js +33 -0
- package/dist/dev/src/components/DunderMethodDeclaration.js.map +1 -0
- package/dist/dev/src/components/EnumDeclaration.js +259 -0
- package/dist/dev/src/components/EnumDeclaration.js.map +1 -0
- package/dist/dev/src/components/EnumMember.js +95 -0
- package/dist/dev/src/components/EnumMember.js.map +1 -0
- package/dist/dev/src/components/FunctionBase.js +130 -0
- package/dist/dev/src/components/FunctionBase.js.map +1 -0
- package/dist/dev/src/components/FunctionCallExpression.js +53 -0
- package/dist/dev/src/components/FunctionCallExpression.js.map +1 -0
- package/dist/dev/src/components/FunctionDeclaration.js +45 -0
- package/dist/dev/src/components/FunctionDeclaration.js.map +1 -0
- package/dist/dev/src/components/FutureStatement.js +31 -0
- package/dist/dev/src/components/FutureStatement.js.map +1 -0
- package/dist/dev/src/components/ImportStatement.js +167 -0
- package/dist/dev/src/components/ImportStatement.js.map +1 -0
- package/dist/dev/src/components/LexicalScope.js +26 -0
- package/dist/dev/src/components/LexicalScope.js.map +1 -0
- package/dist/dev/src/components/MemberExpression.js +290 -0
- package/dist/dev/src/components/MemberExpression.js.map +1 -0
- package/dist/dev/src/components/MemberScope.js +23 -0
- package/dist/dev/src/components/MemberScope.js.map +1 -0
- package/dist/dev/src/components/MethodBase.js +40 -0
- package/dist/dev/src/components/MethodBase.js.map +1 -0
- package/dist/dev/src/components/MethodDeclaration.js +38 -0
- package/dist/dev/src/components/MethodDeclaration.js.map +1 -0
- package/dist/dev/src/components/PropertyDeclaration.js +287 -0
- package/dist/dev/src/components/PropertyDeclaration.js.map +1 -0
- package/dist/dev/src/components/PyDoc.js +1478 -0
- package/dist/dev/src/components/PyDoc.js.map +1 -0
- package/dist/dev/src/components/PythonBlock.js +35 -0
- package/dist/dev/src/components/PythonBlock.js.map +1 -0
- package/dist/dev/src/components/Reference.js +23 -0
- package/dist/dev/src/components/Reference.js.map +1 -0
- package/dist/dev/src/components/SourceFile.js +385 -0
- package/dist/dev/src/components/SourceFile.js.map +1 -0
- package/dist/dev/src/components/StatementList.js +34 -0
- package/dist/dev/src/components/StatementList.js.map +1 -0
- package/dist/dev/src/components/StaticMethodDeclaration.js +40 -0
- package/dist/dev/src/components/StaticMethodDeclaration.js.map +1 -0
- package/dist/dev/src/components/TypeArguments.js +22 -0
- package/dist/dev/src/components/TypeArguments.js.map +1 -0
- package/dist/dev/src/components/TypeRefContext.js +33 -0
- package/dist/dev/src/components/TypeRefContext.js.map +1 -0
- package/dist/dev/src/components/TypeReference.js +67 -0
- package/dist/dev/src/components/TypeReference.js.map +1 -0
- package/dist/dev/src/components/UnionTypeExpression.js +57 -0
- package/dist/dev/src/components/UnionTypeExpression.js.map +1 -0
- package/dist/dev/src/components/VariableDeclaration.js +150 -0
- package/dist/dev/src/components/VariableDeclaration.js.map +1 -0
- package/dist/dev/src/components/index.js +32 -0
- package/dist/dev/src/components/index.js.map +1 -0
- package/dist/dev/src/context/index.js +2 -0
- package/dist/dev/src/context/index.js.map +1 -0
- package/dist/dev/src/context/type-ref-context.js +17 -0
- package/dist/dev/src/context/type-ref-context.js.map +1 -0
- package/dist/dev/src/create-module.js +64 -0
- package/dist/dev/src/create-module.js.map +1 -0
- package/dist/dev/src/index.js +8 -0
- package/dist/dev/src/index.js.map +1 -0
- package/dist/dev/src/name-conflict-resolver.js +8 -0
- package/dist/dev/src/name-conflict-resolver.js.map +1 -0
- package/dist/dev/src/name-policy.js +48 -0
- package/dist/dev/src/name-policy.js.map +1 -0
- package/dist/dev/src/parameter-descriptor.js +8 -0
- package/dist/dev/src/parameter-descriptor.js.map +1 -0
- package/dist/dev/src/symbol-creation.js +58 -0
- package/dist/dev/src/symbol-creation.js.map +1 -0
- package/dist/dev/src/symbols/factories.js +28 -0
- package/dist/dev/src/symbols/factories.js.map +1 -0
- package/dist/dev/src/symbols/index.js +8 -0
- package/dist/dev/src/symbols/index.js.map +1 -0
- package/dist/dev/src/symbols/python-lexical-scope.js +15 -0
- package/dist/dev/src/symbols/python-lexical-scope.js.map +1 -0
- package/dist/dev/src/symbols/python-member-scope.js +7 -0
- package/dist/dev/src/symbols/python-member-scope.js.map +1 -0
- package/dist/dev/src/symbols/python-module-scope.js +86 -0
- package/dist/dev/src/symbols/python-module-scope.js.map +1 -0
- package/dist/dev/src/symbols/python-output-symbol.js +73 -0
- package/dist/dev/src/symbols/python-output-symbol.js.map +1 -0
- package/dist/dev/src/symbols/reference.js +87 -0
- package/dist/dev/src/symbols/reference.js.map +1 -0
- package/dist/dev/src/symbols/scopes.js +13 -0
- package/dist/dev/src/symbols/scopes.js.map +1 -0
- package/dist/dev/src/utils.js +13 -0
- package/dist/dev/src/utils.js.map +1 -0
- package/dist/dev/test/callsignatures.test.js +482 -0
- package/dist/dev/test/callsignatures.test.js.map +1 -0
- package/dist/dev/test/class-method-declaration.test.js +85 -0
- package/dist/dev/test/class-method-declaration.test.js.map +1 -0
- package/dist/dev/test/classdeclarations.test.js +654 -0
- package/dist/dev/test/classdeclarations.test.js.map +1 -0
- package/dist/dev/test/classinstantiations.test.js +281 -0
- package/dist/dev/test/classinstantiations.test.js.map +1 -0
- package/dist/dev/test/constructordeclaration.test.js +86 -0
- package/dist/dev/test/constructordeclaration.test.js.map +1 -0
- package/dist/dev/test/dataclassdeclarations.test.js +1068 -0
- package/dist/dev/test/dataclassdeclarations.test.js.map +1 -0
- package/dist/dev/test/dundermethoddeclaration.test.js +93 -0
- package/dist/dev/test/dundermethoddeclaration.test.js.map +1 -0
- package/dist/dev/test/enums.test.js +263 -0
- package/dist/dev/test/enums.test.js.map +1 -0
- package/dist/dev/test/externals.test.js +307 -0
- package/dist/dev/test/externals.test.js.map +1 -0
- package/dist/dev/test/factories.test.js +122 -0
- package/dist/dev/test/factories.test.js.map +1 -0
- package/dist/dev/test/functioncallexpressions.test.js +257 -0
- package/dist/dev/test/functioncallexpressions.test.js.map +1 -0
- package/dist/dev/test/functiondeclaration.test.js +817 -0
- package/dist/dev/test/functiondeclaration.test.js.map +1 -0
- package/dist/dev/test/imports.test.js +372 -0
- package/dist/dev/test/imports.test.js.map +1 -0
- package/dist/dev/test/memberexpressions.test.js +1668 -0
- package/dist/dev/test/memberexpressions.test.js.map +1 -0
- package/dist/dev/test/methoddeclaration.test.js +344 -0
- package/dist/dev/test/methoddeclaration.test.js.map +1 -0
- package/dist/dev/test/namepolicies.test.js +154 -0
- package/dist/dev/test/namepolicies.test.js.map +1 -0
- package/dist/dev/test/propertydeclaration.test.js +354 -0
- package/dist/dev/test/propertydeclaration.test.js.map +1 -0
- package/dist/dev/test/pydocs.test.js +1675 -0
- package/dist/dev/test/pydocs.test.js.map +1 -0
- package/dist/dev/test/references.test.js +66 -0
- package/dist/dev/test/references.test.js.map +1 -0
- package/dist/dev/test/sourcefiles.test.js +1802 -0
- package/dist/dev/test/sourcefiles.test.js.map +1 -0
- package/dist/dev/test/staticmethoddeclaration.test.js +85 -0
- package/dist/dev/test/staticmethoddeclaration.test.js.map +1 -0
- package/dist/dev/test/type-checking-imports.test.js +617 -0
- package/dist/dev/test/type-checking-imports.test.js.map +1 -0
- package/dist/dev/test/typereference.test.js +79 -0
- package/dist/dev/test/typereference.test.js.map +1 -0
- package/dist/dev/test/uniontypeexpression.test.js +307 -0
- package/dist/dev/test/uniontypeexpression.test.js.map +1 -0
- package/dist/dev/test/utils.js +100 -0
- package/dist/dev/test/utils.js.map +1 -0
- package/dist/dev/test/values.test.js +182 -0
- package/dist/dev/test/values.test.js.map +1 -0
- package/dist/dev/test/variables.test.js +363 -0
- package/dist/dev/test/variables.test.js.map +1 -0
- package/dist/src/components/CallSignature.d.ts.map +1 -1
- package/dist/src/components/CallSignature.js +12 -3
- package/dist/src/components/CallSignature.js.map +1 -1
- package/dist/src/components/ImportStatement.d.ts +12 -0
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js +45 -3
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +5 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +46 -7
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TypeRefContext.d.ts +26 -0
- package/dist/src/components/TypeRefContext.d.ts.map +1 -0
- package/dist/src/components/TypeRefContext.js +29 -0
- package/dist/src/components/TypeRefContext.js.map +1 -0
- package/dist/src/components/TypeReference.d.ts +5 -0
- package/dist/src/components/TypeReference.d.ts.map +1 -1
- package/dist/src/components/TypeReference.js +19 -9
- package/dist/src/components/TypeReference.js.map +1 -1
- package/dist/src/components/VariableDeclaration.d.ts.map +1 -1
- package/dist/src/components/VariableDeclaration.js +7 -2
- package/dist/src/components/VariableDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/context/index.d.ts +2 -0
- package/dist/src/context/index.d.ts.map +1 -0
- package/dist/src/context/index.js +2 -0
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/type-ref-context.d.ts +13 -0
- package/dist/src/context/type-ref-context.d.ts.map +1 -0
- package/dist/src/context/type-ref-context.js +17 -0
- package/dist/src/context/type-ref-context.js.map +1 -0
- 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/src/symbols/python-module-scope.d.ts +13 -1
- package/dist/src/symbols/python-module-scope.d.ts.map +1 -1
- package/dist/src/symbols/python-module-scope.js +36 -2
- package/dist/src/symbols/python-module-scope.js.map +1 -1
- package/dist/src/symbols/python-output-symbol.d.ts +11 -0
- package/dist/src/symbols/python-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/python-output-symbol.js +26 -2
- package/dist/src/symbols/python-output-symbol.js.map +1 -1
- package/dist/src/symbols/reference.d.ts +8 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +4 -2
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/test/dataclassdeclarations.test.js +5 -2
- package/dist/test/dataclassdeclarations.test.js.map +1 -1
- package/dist/test/externals.test.js +8 -2
- package/dist/test/externals.test.js.map +1 -1
- package/dist/test/functiondeclaration.test.js +6 -3
- package/dist/test/functiondeclaration.test.js.map +1 -1
- package/dist/test/imports.test.js +3 -3
- package/dist/test/imports.test.js.map +1 -1
- package/dist/test/references.test.js +1 -1
- package/dist/test/references.test.js.map +1 -1
- package/dist/test/sourcefiles.test.js +26 -26
- package/dist/test/sourcefiles.test.js.map +1 -1
- package/dist/test/type-checking-imports.test.d.ts +2 -0
- package/dist/test/type-checking-imports.test.d.ts.map +1 -0
- package/dist/test/type-checking-imports.test.js +437 -0
- package/dist/test/type-checking-imports.test.js.map +1 -0
- package/dist/test/uniontypeexpression.test.js +4 -1
- package/dist/test/uniontypeexpression.test.js.map +1 -1
- package/dist/test/variables.test.js +4 -1
- package/dist/test/variables.test.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 +7 -5
- package/src/components/CallSignature.tsx +6 -2
- package/src/components/ImportStatement.tsx +51 -4
- package/src/components/Reference.tsx +3 -1
- package/src/components/SourceFile.tsx +44 -8
- package/src/components/TypeRefContext.tsx +36 -0
- package/src/components/TypeReference.tsx +15 -7
- package/src/components/VariableDeclaration.tsx +5 -1
- package/src/components/index.ts +1 -1
- package/src/context/index.ts +1 -0
- package/src/context/type-ref-context.tsx +16 -0
- package/src/name-conflict-resolver.ts +4 -10
- package/src/symbols/python-module-scope.ts +55 -2
- package/src/symbols/python-output-symbol.ts +32 -1
- package/src/symbols/reference.tsx +10 -0
- package/temp/api.json +441 -336
- package/test/dataclassdeclarations.test.tsx +8 -2
- package/test/externals.test.tsx +8 -2
- package/test/functiondeclaration.test.tsx +6 -3
- package/test/imports.test.tsx +6 -6
- package/test/references.test.tsx +1 -1
- package/test/sourcefiles.test.tsx +13 -13
- package/test/type-checking-imports.test.tsx +363 -0
- package/test/uniontypeexpression.test.tsx +4 -1
- package/test/variables.test.tsx +4 -1
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# ExceptionDoc
|
|
2
|
+
|
|
3
|
+
A component that creates an ExceptionDoc block for custom exception classes.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { ExceptionDoc } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<ExceptionDoc
|
|
12
|
+
attributes={GoogleStyleDocAttributeProps[]}
|
|
13
|
+
deprecated="string"
|
|
14
|
+
description={Children[]}
|
|
15
|
+
examples={Children[]}
|
|
16
|
+
note="string"
|
|
17
|
+
parameters={ParameterDescriptor[]}
|
|
18
|
+
seeAlso={string[]}
|
|
19
|
+
style={"google"}
|
|
20
|
+
warning="string"
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
* stc
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { ExceptionDoc } from "@alloy-js/python/stc";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
ExceptionDoc({
|
|
31
|
+
attributes: GoogleStyleDocAttributeProps[],
|
|
32
|
+
deprecated: string,
|
|
33
|
+
description: Children[],
|
|
34
|
+
examples: Children[],
|
|
35
|
+
note: string,
|
|
36
|
+
parameters: ParameterDescriptor[],
|
|
37
|
+
seeAlso: string[],
|
|
38
|
+
style: "google",
|
|
39
|
+
warning: string,
|
|
40
|
+
}).children(children)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Props
|
|
44
|
+
|
|
45
|
+
| | | |
|
|
46
|
+
| ----------- | ------------------------------------------------------------------------------------- | - |
|
|
47
|
+
| attributes | optional [GoogleStyleDocAttributeProps](../../types/googlestyledocattributeprops/)\[] | |
|
|
48
|
+
| deprecated | optional string | |
|
|
49
|
+
| description | [Children](../../../core/types/children/)\[] | |
|
|
50
|
+
| examples | optional [Children](../../../core/types/children/)\[] | |
|
|
51
|
+
| note | optional string | |
|
|
52
|
+
| parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
|
|
53
|
+
| seeAlso | optional string\[] | |
|
|
54
|
+
| style | optional “google” | |
|
|
55
|
+
| warning | optional string | |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# FunctionCallExpression
|
|
2
|
+
|
|
3
|
+
A Python function call expression.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FunctionCallExpression } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<FunctionCallExpression args={Children[]} target={Children} />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
* stc
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { FunctionCallExpression } from "@alloy-js/python/stc";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
FunctionCallExpression({
|
|
21
|
+
args: Children[],
|
|
22
|
+
target: Children,
|
|
23
|
+
}).children(children)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| | | |
|
|
29
|
+
| ------ | ----------------------------------------------------- | - |
|
|
30
|
+
| args | optional [Children](../../../core/types/children/)\[] | |
|
|
31
|
+
| target | [Children](../../../core/types/children/) | |
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<FunctionCallExpression target="foo" args={["arg1", "arg2"]} />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This will generate:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
foo(arg1, arg2)
|
|
43
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# FunctionDeclaration
|
|
2
|
+
|
|
3
|
+
A Python function declaration.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FunctionDeclaration } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<FunctionDeclaration async />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
* stc
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { FunctionDeclaration } from "@alloy-js/python/stc";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
FunctionDeclaration({ async: boolean }).children(children)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
| | | |
|
|
26
|
+
| ----- | ---------------- | ------------------------------------- |
|
|
27
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
28
|
+
|
|
29
|
+
## Remarks
|
|
30
|
+
|
|
31
|
+
This component creates a Python function declaration with optional type annotations, parameters, and return types. It supports async functions and automatically handles symbol creation and emission.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<FunctionDeclaration
|
|
37
|
+
name="my_function"
|
|
38
|
+
returnType="int"
|
|
39
|
+
parameters={[{ name: "a", type: { children: "int" } }, { name: "b", type: { children: "str" } }]}
|
|
40
|
+
>
|
|
41
|
+
return a + b
|
|
42
|
+
</FunctionDeclaration>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This will generate:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
def my_function(a: int, b: str) -> int:
|
|
49
|
+
return a + b
|
|
50
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# FunctionDoc
|
|
2
|
+
|
|
3
|
+
A component that creates a FunctionDoc block for functions.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FunctionDoc } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<FunctionDoc
|
|
12
|
+
deprecated="string"
|
|
13
|
+
description={Children[]}
|
|
14
|
+
examples={Children[]}
|
|
15
|
+
note="string"
|
|
16
|
+
parameters={ParameterDescriptor[]}
|
|
17
|
+
raises={string[]}
|
|
18
|
+
returns="string"
|
|
19
|
+
seeAlso={string[]}
|
|
20
|
+
style={"google"}
|
|
21
|
+
warning="string"
|
|
22
|
+
yields="string"
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
* stc
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { FunctionDoc } from "@alloy-js/python/stc";
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
FunctionDoc({
|
|
33
|
+
deprecated: string,
|
|
34
|
+
description: Children[],
|
|
35
|
+
examples: Children[],
|
|
36
|
+
note: string,
|
|
37
|
+
parameters: ParameterDescriptor[],
|
|
38
|
+
raises: string[],
|
|
39
|
+
returns: string,
|
|
40
|
+
seeAlso: string[],
|
|
41
|
+
style: "google",
|
|
42
|
+
warning: string,
|
|
43
|
+
yields: string,
|
|
44
|
+
}).children(children)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
| | | |
|
|
50
|
+
| ----------- | ------------------------------------------------------------------- | - |
|
|
51
|
+
| deprecated | optional string | |
|
|
52
|
+
| description | [Children](../../../core/types/children/)\[] | |
|
|
53
|
+
| examples | optional [Children](../../../core/types/children/)\[] | |
|
|
54
|
+
| note | optional string | |
|
|
55
|
+
| parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
|
|
56
|
+
| raises | optional string\[] | |
|
|
57
|
+
| returns | optional string | |
|
|
58
|
+
| seeAlso | optional string\[] | |
|
|
59
|
+
| style | optional “google” | |
|
|
60
|
+
| warning | optional string | |
|
|
61
|
+
| yields | optional string | |
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# FunctionalEnumDeclaration
|
|
2
|
+
|
|
3
|
+
Create a Python enum using the functional syntax.
|
|
4
|
+
|
|
5
|
+
This generates enums using the `Enum('Name', [...])` or `Enum('Name', {...})` syntax. The format depends on whether enum members have explicit values:
|
|
6
|
+
|
|
7
|
+
* Members without values: `Enum('Direction', ['NORTH', 'SOUTH', 'EAST', 'WEST'])`
|
|
8
|
+
* Members with values: `Enum('Direction', {'NORTH': 1, 'SOUTH': 2, 'EAST': 3, 'WEST': 4})`
|
|
9
|
+
|
|
10
|
+
- jsx
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { FunctionalEnumDeclaration } from "@alloy-js/python";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<FunctionalEnumDeclaration
|
|
17
|
+
baseType={"Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag"}
|
|
18
|
+
doc={Children}
|
|
19
|
+
members={Array<EnumMemberProps>}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- stc
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { FunctionalEnumDeclaration } from "@alloy-js/python/stc";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
FunctionalEnumDeclaration({
|
|
30
|
+
baseType: "Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag",
|
|
31
|
+
doc: Children,
|
|
32
|
+
members: Array<EnumMemberProps>,
|
|
33
|
+
}).children(children)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Props
|
|
37
|
+
|
|
38
|
+
| | | |
|
|
39
|
+
| -------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| baseType | optional “Enum” \| “IntEnum” \| “StrEnum” \| “Flag” \| “IntFlag” | The base type of the enum. One of: ‘Enum’, ‘IntEnum’, ‘StrEnum’, ‘Flag’, ‘IntFlag’. Defaults to ‘Enum’. |
|
|
41
|
+
| doc | optional [Children](../../../core/types/children/) | Optional docstring for the enum. |
|
|
42
|
+
| members | optional Array<[EnumMemberProps](../enummember/)> | Members of the enum as an array of objects. |
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<FunctionalEnumDeclaration
|
|
48
|
+
name="Direction"
|
|
49
|
+
members={[
|
|
50
|
+
{ name: "NORTH" },
|
|
51
|
+
{ name: "SOUTH" },
|
|
52
|
+
{ name: "EAST" },
|
|
53
|
+
{ name: "WEST" }
|
|
54
|
+
]}
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
renders to:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
Direction = Enum('Direction', ['NORTH', 'SOUTH', 'EAST', 'WEST'])
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<FunctionalEnumDeclaration
|
|
66
|
+
name="Status"
|
|
67
|
+
members={[
|
|
68
|
+
{ name: "PENDING", value: 1 },
|
|
69
|
+
{ name: "ACTIVE", value: 2 },
|
|
70
|
+
{ name: "INACTIVE", value: 3 }
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
renders to:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
Status = Enum('Status', {'PENDING': 1, 'ACTIVE': 2, 'INACTIVE': 3})
|
|
79
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# FutureStatement
|
|
2
|
+
|
|
3
|
+
A future statement that imports features from **future**.
|
|
4
|
+
|
|
5
|
+
Future statements are directives to the compiler that a particular module should be compiled using syntax or semantics from a future Python release. They must appear near the top of the module, after the module docstring (if any).
|
|
6
|
+
|
|
7
|
+
Use this in the `futureImports` prop of SourceFile to ensure proper placement.
|
|
8
|
+
|
|
9
|
+
* jsx
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { FutureStatement } from "@alloy-js/python";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<FutureStatement feature="string" />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
* stc
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { FutureStatement } from "@alloy-js/python/stc";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
FutureStatement({ feature: string }).children(children)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Props
|
|
28
|
+
|
|
29
|
+
| | | |
|
|
30
|
+
| ------- | ------ | -------------------------------------------------- |
|
|
31
|
+
| feature | string | The name of the feature to import from **future**. |
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<SourceFile path="models.py" futureImports={<FutureStatement feature="annotations" />}>
|
|
37
|
+
<ClassDeclaration name="User">
|
|
38
|
+
<PropertyDeclaration name="manager" type="User" />
|
|
39
|
+
</ClassDeclaration>
|
|
40
|
+
</SourceFile>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
renders to
|
|
44
|
+
|
|
45
|
+
```py
|
|
46
|
+
from __future__ import annotations
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class User:
|
|
50
|
+
manager: User
|
|
51
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# GeneratorDoc
|
|
2
|
+
|
|
3
|
+
A component that creates a GeneratorDoc block for generator functions.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { GeneratorDoc } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<GeneratorDoc
|
|
12
|
+
deprecated="string"
|
|
13
|
+
description={Children[]}
|
|
14
|
+
examples={Children[]}
|
|
15
|
+
note="string"
|
|
16
|
+
parameters={ParameterDescriptor[]}
|
|
17
|
+
raises={string[]}
|
|
18
|
+
seeAlso={string[]}
|
|
19
|
+
style={"google"}
|
|
20
|
+
warning="string"
|
|
21
|
+
yields="string"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
* stc
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { GeneratorDoc } from "@alloy-js/python/stc";
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
GeneratorDoc({
|
|
32
|
+
deprecated: string,
|
|
33
|
+
description: Children[],
|
|
34
|
+
examples: Children[],
|
|
35
|
+
note: string,
|
|
36
|
+
parameters: ParameterDescriptor[],
|
|
37
|
+
raises: string[],
|
|
38
|
+
seeAlso: string[],
|
|
39
|
+
style: "google",
|
|
40
|
+
warning: string,
|
|
41
|
+
yields: string,
|
|
42
|
+
}).children(children)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Props
|
|
46
|
+
|
|
47
|
+
| | | |
|
|
48
|
+
| ----------- | ------------------------------------------------------------------- | - |
|
|
49
|
+
| deprecated | optional string | |
|
|
50
|
+
| description | [Children](../../../core/types/children/)\[] | |
|
|
51
|
+
| examples | optional [Children](../../../core/types/children/)\[] | |
|
|
52
|
+
| note | optional string | |
|
|
53
|
+
| parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
|
|
54
|
+
| raises | optional string\[] | |
|
|
55
|
+
| seeAlso | optional string\[] | |
|
|
56
|
+
| style | optional “google” | |
|
|
57
|
+
| warning | optional string | |
|
|
58
|
+
| yields | optional string | |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# InlineDoc
|
|
2
|
+
|
|
3
|
+
An inline documentation component for attribute docstrings. Unlike PyDoc, this doesn’t add a trailing line break after the closing quotes, which is appropriate for documenting consecutive attributes like enum members.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { InlineDoc } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<InlineDoc >
|
|
12
|
+
{children}
|
|
13
|
+
</InlineDoc>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* stc
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { InlineDoc } from "@alloy-js/python/stc";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
InlineDoc({ }).children(children)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| | | |
|
|
28
|
+
| -------- | ----------------------------------------- | - |
|
|
29
|
+
| children | [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# LexicalScope
|
|
2
|
+
|
|
3
|
+
## Overload 1
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { LexicalScope } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<LexicalScope value={OutputScope} />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
* stc
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { LexicalScope } from "@alloy-js/python/stc";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
LexicalScope({ value: OutputScope }).children(children)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Props
|
|
24
|
+
|
|
25
|
+
| | | |
|
|
26
|
+
| -------- | -------------------------------------------------- | --------------------------------------------------------------- |
|
|
27
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
28
|
+
| value | [OutputScope](../../../core/types/outputscope/) | The scope to use. If not provided, a new scope will be created. |
|
|
29
|
+
|
|
30
|
+
## Overload 2
|
|
31
|
+
|
|
32
|
+
* jsx
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { LexicalScope } from "@alloy-js/python";
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
<LexicalScope
|
|
39
|
+
metadata={Record<string, unknown>}
|
|
40
|
+
name="string"
|
|
41
|
+
ownerSymbol={OutputSymbol}
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
* stc
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { LexicalScope } from "@alloy-js/python/stc";
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
LexicalScope({
|
|
52
|
+
metadata: Record<string, unknown>,
|
|
53
|
+
name: string,
|
|
54
|
+
ownerSymbol: OutputSymbol,
|
|
55
|
+
}).children(children)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Props
|
|
59
|
+
|
|
60
|
+
| | | |
|
|
61
|
+
| ----------- | ---------------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
62
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
63
|
+
| metadata | optional Record\<string, unknown> | Additional metadata for the scope. |
|
|
64
|
+
| name | optional string | The name of this scope. |
|
|
65
|
+
| ownerSymbol | optional [OutputSymbol](../../../core/types/outputsymbol/) | Create a member scope with the owner symbol providing the in-scope symbols. |
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# MemberExpression
|
|
2
|
+
|
|
3
|
+
Create a member expression from parts. Each part can provide one of the following:
|
|
4
|
+
|
|
5
|
+
* **id**: The identifier for the member expression part
|
|
6
|
+
* **refkey**: a refkey for a symbol whose name becomes the identifier
|
|
7
|
+
* **symbol**: a symbol whose name becomes the identifier part
|
|
8
|
+
* **args**: create a method call with the given args
|
|
9
|
+
* **children**: arbitrary contents for the identifier part.
|
|
10
|
+
|
|
11
|
+
- jsx
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { MemberExpression } from "@alloy-js/python";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<MemberExpression >
|
|
18
|
+
{children}
|
|
19
|
+
</MemberExpression>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- stc
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { MemberExpression } from "@alloy-js/python/stc";
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
MemberExpression({ }).children(children)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Props
|
|
32
|
+
|
|
33
|
+
| | | |
|
|
34
|
+
| -------- | ----------------------------------------- | - |
|
|
35
|
+
| children | [Children](../../../core/types/children/) | |
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<MemberExpression>
|
|
41
|
+
<MemberExpression.Part id="base" />
|
|
42
|
+
<MemberExpression.Part refkey={rk} />
|
|
43
|
+
<MemberExpression.Part symbol={sym} />
|
|
44
|
+
<MemberExpression.Part args={["hello", "world"]} />
|
|
45
|
+
<MemberExpression.Part>SomeValue</MemberExpression.Part>
|
|
46
|
+
</MemberExpression>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Assuming `rk` is a refkey to a symbol name “prop1”, and `sym` is a symbol with a name of “prop2”, this will render:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
base.prop1.prop2("hello", "world").SomeValue
|
|
53
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# MemberScope
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { MemberScope } from "@alloy-js/python";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<MemberScope ownerSymbol={PythonOutputSymbol}>
|
|
10
|
+
{children}
|
|
11
|
+
</MemberScope>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
* stc
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { MemberScope } from "@alloy-js/python/stc";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
MemberScope({ ownerSymbol: PythonOutputSymbol }).children(children)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
| | | |
|
|
26
|
+
| ----------- | ----------------------------------------------------- | - |
|
|
27
|
+
| children | [Children](../../../core/types/children/) | |
|
|
28
|
+
| ownerSymbol | [PythonOutputSymbol](../../types/pythonoutputsymbol/) | |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# MethodDeclaration
|
|
2
|
+
|
|
3
|
+
A Python instance method declaration component.
|
|
4
|
+
|
|
5
|
+
Shared base props for all method-like declarations.
|
|
6
|
+
|
|
7
|
+
* jsx
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { MethodDeclaration } from "@alloy-js/python";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<MethodDeclaration abstract async />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* stc
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { MethodDeclaration } from "@alloy-js/python/stc";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
MethodDeclaration({ abstract: boolean, async: boolean }).children(children)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| | | |
|
|
28
|
+
| -------- | ---------------- | -------------------------------------- |
|
|
29
|
+
| abstract | optional boolean | Indicates that the method is abstract. |
|
|
30
|
+
| async | optional boolean | Indicates that the function is async. |
|
|
31
|
+
|
|
32
|
+
## Remarks
|
|
33
|
+
|
|
34
|
+
Automatically injects the `self` parameter for instance methods and enforces that the declaration appears within a class body.
|
|
35
|
+
|
|
36
|
+
## Example
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<py.MethodDeclaration name="do_work" parameters={[{ name: "value", type: "int" }]}>
|
|
40
|
+
return value * 2
|
|
41
|
+
</py.MethodDeclaration>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Generates:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
def do_work(self, value: int) -> None:
|
|
48
|
+
return value * 2
|
|
49
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# MethodDoc
|
|
2
|
+
|
|
3
|
+
A component that creates a MethodDoc block for class methods. Automatically adds a note about not including ‘self’ parameter if no custom note is provided.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { MethodDoc } from "@alloy-js/python";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<MethodDoc
|
|
12
|
+
deprecated="string"
|
|
13
|
+
description={Children[]}
|
|
14
|
+
examples={Children[]}
|
|
15
|
+
note="string"
|
|
16
|
+
overrides="string"
|
|
17
|
+
parameters={ParameterDescriptor[]}
|
|
18
|
+
raises={string[]}
|
|
19
|
+
returns="string"
|
|
20
|
+
seeAlso={string[]}
|
|
21
|
+
style={"google"}
|
|
22
|
+
warning="string"
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
* stc
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { MethodDoc } from "@alloy-js/python/stc";
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
MethodDoc({
|
|
33
|
+
deprecated: string,
|
|
34
|
+
description: Children[],
|
|
35
|
+
examples: Children[],
|
|
36
|
+
note: string,
|
|
37
|
+
overrides: string,
|
|
38
|
+
parameters: ParameterDescriptor[],
|
|
39
|
+
raises: string[],
|
|
40
|
+
returns: string,
|
|
41
|
+
seeAlso: string[],
|
|
42
|
+
style: "google",
|
|
43
|
+
warning: string,
|
|
44
|
+
}).children(children)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
| | | |
|
|
50
|
+
| ----------- | ------------------------------------------------------------------- | - |
|
|
51
|
+
| deprecated | optional string | |
|
|
52
|
+
| description | [Children](../../../core/types/children/)\[] | |
|
|
53
|
+
| examples | optional [Children](../../../core/types/children/)\[] | |
|
|
54
|
+
| note | optional string | |
|
|
55
|
+
| overrides | optional string | |
|
|
56
|
+
| parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
|
|
57
|
+
| raises | optional string\[] | |
|
|
58
|
+
| returns | optional string | |
|
|
59
|
+
| seeAlso | optional string\[] | |
|
|
60
|
+
| style | optional “google” | |
|
|
61
|
+
| warning | optional string | |
|