@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,30 @@
|
|
|
1
|
+
import { createModule } from "../create-module.js";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
|
|
5
|
+
export const abcModule = createModule({
|
|
6
|
+
name: "abc",
|
|
7
|
+
descriptor: {
|
|
8
|
+
".": ["abstractmethod"]
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export const dataclassesModule = createModule({
|
|
12
|
+
name: "dataclasses",
|
|
13
|
+
descriptor: {
|
|
14
|
+
".": ["dataclass", "KW_ONLY"]
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export const enumModule = createModule({
|
|
18
|
+
name: "enum",
|
|
19
|
+
descriptor: {
|
|
20
|
+
".": ["auto", "Enum", "Flag", "IntEnum", "IntFlag", "StrEnum"]
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export const requestsModule = createModule({
|
|
24
|
+
name: "requests",
|
|
25
|
+
descriptor: {
|
|
26
|
+
".": ["get", "post", "put", "delete", "patch", "head", "options"],
|
|
27
|
+
models: ["Response", "Request"]
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createModule","abcModule","name","descriptor","dataclassesModule","enumModule","requestsModule","models"],"sources":["../../../../src/builtins/python.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAY,QAAQ,qBAAqB;;AAElD;;AAGA,OAAO,MAAMC,SAAS,GAAGD,YAAY,CAAC;EACpCE,IAAI,EAAE,KAAK;EACXC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,gBAAgB;EACxB;AACF,CAAC,CAAC;AAEF,OAAO,MAAMC,iBAAiB,GAAGJ,YAAY,CAAC;EAC5CE,IAAI,EAAE,aAAa;EACnBC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,WAAW,EAAE,SAAS;EAC9B;AACF,CAAC,CAAC;AAEF,OAAO,MAAME,UAAU,GAAGL,YAAY,CAAC;EACrCE,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;EAC/D;AACF,CAAC,CAAC;AAEF,OAAO,MAAMG,cAAc,GAAGN,YAAY,CAAC;EACzCE,IAAI,EAAE,UAAU;EAChBC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;IACjEI,MAAM,EAAE,CAAC,UAAU,EAAE,SAAS;EAChC;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { For, Indent, memo } from "@alloy-js/core";
|
|
3
|
+
/**
|
|
4
|
+
* A component that renders a JavaScript value as a Python atom (atomic value).
|
|
5
|
+
* It handles various types of atomic values including numbers, booleans, strings,
|
|
6
|
+
* functions, arrays, and objects, converting them to Python-like syntax.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Atom jsValue={42} /> // renders "42"
|
|
11
|
+
* <Atom jsValue={true} /> // renders "True"
|
|
12
|
+
* <Atom jsValue="Hello" /> // renders '"Hello"'
|
|
13
|
+
* <Atom jsValue={[1, 2, 3]} /> // renders "[1, 2, 3]"
|
|
14
|
+
* <Atom jsValue={{ key: "value" }} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function Atom(props) {
|
|
18
|
+
return memo(() => {
|
|
19
|
+
const jsValue = props.jsValue;
|
|
20
|
+
if (typeof jsValue === "undefined") {
|
|
21
|
+
return "None";
|
|
22
|
+
} else if (typeof jsValue === "number") {
|
|
23
|
+
if (props.asFloat && Number.isInteger(jsValue)) {
|
|
24
|
+
return jsValue.toFixed(1);
|
|
25
|
+
}
|
|
26
|
+
return String(jsValue);
|
|
27
|
+
} else if (typeof jsValue === "boolean") {
|
|
28
|
+
return jsValue ? "True" : "False";
|
|
29
|
+
} else if (typeof jsValue === "string") {
|
|
30
|
+
return `"${jsValue.replace(/"/g, '\\"')}"`;
|
|
31
|
+
} else if (typeof jsValue === "function") {
|
|
32
|
+
// functions are inserted as-is.
|
|
33
|
+
return jsValue;
|
|
34
|
+
} else if (typeof jsValue === "object") {
|
|
35
|
+
if (jsValue === null) {
|
|
36
|
+
return "None";
|
|
37
|
+
} else if (Array.isArray(jsValue)) {
|
|
38
|
+
// Recursively emit each element of arrays
|
|
39
|
+
return _$createIntrinsic("group", {
|
|
40
|
+
get children() {
|
|
41
|
+
return ["[", _$createComponent(Indent, {
|
|
42
|
+
softline: true,
|
|
43
|
+
trailingBreak: true,
|
|
44
|
+
get children() {
|
|
45
|
+
return _$createComponent(For, {
|
|
46
|
+
each: jsValue,
|
|
47
|
+
comma: true,
|
|
48
|
+
line: true,
|
|
49
|
+
children: v => _$createComponent(Atom, {
|
|
50
|
+
jsValue: v
|
|
51
|
+
}, {
|
|
52
|
+
fileName: import.meta.url,
|
|
53
|
+
lineNumber: 50,
|
|
54
|
+
columnNumber: 25
|
|
55
|
+
})
|
|
56
|
+
}, {
|
|
57
|
+
fileName: import.meta.url,
|
|
58
|
+
lineNumber: 49,
|
|
59
|
+
columnNumber: 15
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
fileName: import.meta.url,
|
|
64
|
+
lineNumber: 48,
|
|
65
|
+
columnNumber: 13
|
|
66
|
+
}), "]"];
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
fileName: import.meta.url,
|
|
70
|
+
lineNumber: 46,
|
|
71
|
+
columnNumber: 11
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
const entries = Object.entries(jsValue);
|
|
75
|
+
if (entries.length === 0) {
|
|
76
|
+
return "{}";
|
|
77
|
+
}
|
|
78
|
+
// Recursively emit each key-value pair of objects
|
|
79
|
+
return _$createIntrinsic("group", {
|
|
80
|
+
get children() {
|
|
81
|
+
return ["{", _$createComponent(Indent, {
|
|
82
|
+
softline: true,
|
|
83
|
+
get children() {
|
|
84
|
+
return _$createComponent(For, {
|
|
85
|
+
each: entries,
|
|
86
|
+
comma: true,
|
|
87
|
+
line: true,
|
|
88
|
+
children: ([k, v]) => [_$createComponent(Atom, {
|
|
89
|
+
jsValue: k
|
|
90
|
+
}, {
|
|
91
|
+
fileName: import.meta.url,
|
|
92
|
+
lineNumber: 69,
|
|
93
|
+
columnNumber: 21
|
|
94
|
+
}), ": ", _$createComponent(Atom, {
|
|
95
|
+
jsValue: v
|
|
96
|
+
}, {
|
|
97
|
+
fileName: import.meta.url,
|
|
98
|
+
lineNumber: 69,
|
|
99
|
+
columnNumber: 43
|
|
100
|
+
})]
|
|
101
|
+
}, {
|
|
102
|
+
fileName: import.meta.url,
|
|
103
|
+
lineNumber: 66,
|
|
104
|
+
columnNumber: 15
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
fileName: import.meta.url,
|
|
109
|
+
lineNumber: 65,
|
|
110
|
+
columnNumber: 13
|
|
111
|
+
}), "}"];
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
fileName: import.meta.url,
|
|
115
|
+
lineNumber: 63,
|
|
116
|
+
columnNumber: 11
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=Atom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["For","Indent","memo","Atom","props","jsValue","asFloat","Number","isInteger","toFixed","String","replace","Array","isArray","_$createIntrinsic","children","_$createComponent","softline","trailingBreak","each","comma","line","v","fileName","import","meta","url","lineNumber","columnNumber","entries","Object","length","k"],"sources":["../../../../src/components/Atom.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,GAAG,EAAEC,MAAM,EAAEC,IAAI,QAAQ,gBAAgB;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAACC,KAAgB,EAAO;EAC1C,OAAOF,IAAI,CAAC,MAAM;IAChB,MAAMG,OAAO,GAAGD,KAAK,CAACC,OAAO;IAE7B,IAAI,OAAOA,OAAO,KAAK,WAAW,EAAE;MAClC,OAAO,MAAM;IACf,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,IAAID,KAAK,CAACE,OAAO,IAAIC,MAAM,CAACC,SAAS,CAACH,OAAO,CAAC,EAAE;QAC9C,OAAOA,OAAO,CAACI,OAAO,CAAC,CAAC,CAAC;MAC3B;MACA,OAAOC,MAAM,CAACL,OAAO,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,SAAS,EAAE;MACvC,OAAOA,OAAO,GAAG,MAAM,GAAG,OAAO;IACnC,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,OAAO,IAAIA,OAAO,CAACM,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG;IAC5C,CAAC,MAAM,IAAI,OAAON,OAAO,KAAK,UAAU,EAAE;MACxC;MACA,OAAOA,OAAO;IAChB,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,IAAIA,OAAO,KAAK,IAAI,E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iBAAA,CAEHb,IAAI;oBAACE,OAAO,EAAE2B;kBAAC;oBAAAT,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;oBAAAC,UAAA;oBAAAC,YAAA;kBAAA,UAAAZ,iBAAA,CAAOb,IAAI;oBAACE,OAAO,EAAEiB;kBAAC;oBAAAC,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;oBAAAC,UAAA;oBAAAC,YAAA;kBAAA;gBAEzC;kBAAAL,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;kBAAAC,UAAA;kBAAAC,YAAA;gBAAA;cAAA;YAAA;cAAAL,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;cAAAC,UAAA;cAAAC,YAAA;YAAA,IAGJ,GAAG;UAAA;QAAA;UAAAL,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;UAAAC,UAAA;UAAAC,YAAA;QAAA;MAGV;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, memo as _$memo, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { computed, createSymbolSlot, For, Show } from "@alloy-js/core";
|
|
3
|
+
import { isParameterDescriptor } from "../parameter-descriptor.js";
|
|
4
|
+
import { createPythonSymbol } from "../symbol-creation.js";
|
|
5
|
+
import { Atom } from "./Atom.js";
|
|
6
|
+
import { TypeRefContext } from "./TypeRefContext.js";
|
|
7
|
+
function isParameterMarker(param) {
|
|
8
|
+
return typeof param === "string" && (param === "*" || param === "/");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A call signature parameters declaration, which can be used to define the
|
|
12
|
+
* parameters of a function or other callables.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <py.CallSignatureParameters parameters={[ "a", "b" ]} />
|
|
17
|
+
* ```
|
|
18
|
+
* This will generate:
|
|
19
|
+
* ```python
|
|
20
|
+
* a, b
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function CallSignatureParameters(props) {
|
|
24
|
+
const parameterList = computed(() => {
|
|
25
|
+
const params = (props.parameters ?? []).map(p => {
|
|
26
|
+
return isParameterMarker(p) ? p : parameter(normalizeAndDeclareParameter(p));
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Add *args if specified
|
|
30
|
+
if (props.args) {
|
|
31
|
+
params.push("*args");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Add **kwargs if specified
|
|
35
|
+
if (props.kwargs) {
|
|
36
|
+
params.push("**kwargs");
|
|
37
|
+
}
|
|
38
|
+
return params;
|
|
39
|
+
});
|
|
40
|
+
return _$createComponent(For, {
|
|
41
|
+
each: parameterList,
|
|
42
|
+
comma: true,
|
|
43
|
+
space: true,
|
|
44
|
+
children: param => param
|
|
45
|
+
}, {
|
|
46
|
+
fileName: import.meta.url,
|
|
47
|
+
lineNumber: 67,
|
|
48
|
+
columnNumber: 5
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function parameter(param) {
|
|
52
|
+
const TypeSlot = param.TypeSlot; // TypeSlot will always be present when param.type is true.
|
|
53
|
+
return _$createIntrinsic("group", {
|
|
54
|
+
get children() {
|
|
55
|
+
return [_$memo(() => param.symbol.name, false, "param.symbol.name"), _$createComponent(Show, {
|
|
56
|
+
get when() {
|
|
57
|
+
return !!param.type;
|
|
58
|
+
},
|
|
59
|
+
get children() {
|
|
60
|
+
return [":", " ", _$createComponent(TypeRefContext, {
|
|
61
|
+
get children() {
|
|
62
|
+
return _$createComponent(TypeSlot, {
|
|
63
|
+
get children() {
|
|
64
|
+
return param.type;
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
fileName: import.meta.url,
|
|
68
|
+
lineNumber: 81,
|
|
69
|
+
columnNumber: 11
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
fileName: import.meta.url,
|
|
74
|
+
lineNumber: 80,
|
|
75
|
+
columnNumber: 9
|
|
76
|
+
})];
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
fileName: import.meta.url,
|
|
80
|
+
lineNumber: 78,
|
|
81
|
+
columnNumber: 7
|
|
82
|
+
}), _$createComponent(Show, {
|
|
83
|
+
get when() {
|
|
84
|
+
return param.default !== undefined;
|
|
85
|
+
},
|
|
86
|
+
get children() {
|
|
87
|
+
return [_$createComponent(Show, {
|
|
88
|
+
get when() {
|
|
89
|
+
return !param.type;
|
|
90
|
+
},
|
|
91
|
+
children: "="
|
|
92
|
+
}, {
|
|
93
|
+
fileName: import.meta.url,
|
|
94
|
+
lineNumber: 85,
|
|
95
|
+
columnNumber: 9
|
|
96
|
+
}), _$createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return !!param.type;
|
|
99
|
+
},
|
|
100
|
+
children: " = "
|
|
101
|
+
}, {
|
|
102
|
+
fileName: import.meta.url,
|
|
103
|
+
lineNumber: 86,
|
|
104
|
+
columnNumber: 9
|
|
105
|
+
}), [_$createComponent(Atom, {
|
|
106
|
+
get jsValue() {
|
|
107
|
+
return param.default;
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
fileName: import.meta.url,
|
|
111
|
+
lineNumber: 88,
|
|
112
|
+
columnNumber: 11
|
|
113
|
+
})]];
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
fileName: import.meta.url,
|
|
117
|
+
lineNumber: 84,
|
|
118
|
+
columnNumber: 7
|
|
119
|
+
})];
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
fileName: import.meta.url,
|
|
123
|
+
lineNumber: 76,
|
|
124
|
+
columnNumber: 5
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function normalizeAndDeclareParameter(param) {
|
|
128
|
+
if (isParameterDescriptor(param)) {
|
|
129
|
+
const TypeSlot = createSymbolSlot();
|
|
130
|
+
const symbol = createPythonSymbol(param.name, {
|
|
131
|
+
refkeys: param.refkey,
|
|
132
|
+
type: TypeSlot.firstSymbol
|
|
133
|
+
}, "parameter");
|
|
134
|
+
return {
|
|
135
|
+
...param,
|
|
136
|
+
symbol,
|
|
137
|
+
TypeSlot
|
|
138
|
+
};
|
|
139
|
+
} else {
|
|
140
|
+
const symbol = createPythonSymbol(param, {}, "parameter");
|
|
141
|
+
return {
|
|
142
|
+
symbol
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A Python call signature, e.g. the part after the `def` keyword and the name in a
|
|
148
|
+
* function expression.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```tsx
|
|
152
|
+
* <CallSignature
|
|
153
|
+
* parameters={[{ name: "a", type: "int" }, { name: "b", type: "str" }]}
|
|
154
|
+
* returnType="int"
|
|
155
|
+
* />
|
|
156
|
+
* ```
|
|
157
|
+
* renders to
|
|
158
|
+
* ```py
|
|
159
|
+
* (a: int, b: str) -> int
|
|
160
|
+
* ```
|
|
161
|
+
* @remarks
|
|
162
|
+
*
|
|
163
|
+
* Any parameters or type parameters declared in this signature will be placed
|
|
164
|
+
* in the current scope. This component does not make a scope to hold its
|
|
165
|
+
* parameters.
|
|
166
|
+
*/
|
|
167
|
+
export function CallSignature(props) {
|
|
168
|
+
const sParams = _$createComponent(CallSignatureParameters, {
|
|
169
|
+
get parameters() {
|
|
170
|
+
return props.parameters;
|
|
171
|
+
},
|
|
172
|
+
get args() {
|
|
173
|
+
return props.args;
|
|
174
|
+
},
|
|
175
|
+
get kwargs() {
|
|
176
|
+
return props.kwargs;
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
fileName: import.meta.url,
|
|
180
|
+
lineNumber: 179,
|
|
181
|
+
columnNumber: 5
|
|
182
|
+
});
|
|
183
|
+
const typeParams = props.typeParameters ? `[${props.typeParameters.join(", ")}]` : "";
|
|
184
|
+
const sReturnType = props.returnType ? [" -> ", _$createComponent(TypeRefContext, {
|
|
185
|
+
get children() {
|
|
186
|
+
return props.returnType;
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
fileName: import.meta.url,
|
|
190
|
+
lineNumber: 191,
|
|
191
|
+
columnNumber: 9
|
|
192
|
+
})] : undefined;
|
|
193
|
+
return [typeParams, "(", sParams, ")", sReturnType];
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=CallSignature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["computed","createSymbolSlot","For","Show","isParameterDescriptor","createPythonSymbol","Atom","TypeRefContext","isParameterMarker","param","CallSignatureParameters","props","parameterList","params","parameters","map","p","parameter","normalizeAndDeclareParameter","args","push","kwargs","_$createComponent","each","comma","space","children","fileName","import","meta","url","lineNumber","columnNumber","TypeSlot","_$createIntrinsic","_$memo","symbol","name","when","type","default","undefined","jsValue","refkeys","refkey","firstSymbol","CallSignature","sParams","typeParams","typeParameters","join","sReturnType","returnType"],"sources":["../../../../src/components/CallSignature.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAEEA,QAAQ,EACRC,gBAAgB,EAChBC,GAAG,EACHC,IAAI,QAEC,gBAAgB;AACvB,SACEC,qBAAqB,QAEhB,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,IAAI;AACb,SAASC,cAAc;AAIvB,SAASC,iBAAiBA,CACxBC,KAA+C,EACrB;EAC1B,OAAO,OAAOA,KAAK,KAAK,QAAQ,KAAKA,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,CAAC;AACtE;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,KAAmC,EAAE;EAC3E,MAAMC,aAAa,GAAGZ,QAAQ,CAAC,MAAM;IACnC,MAAMa,MAAM,GAAG,CAACF,KAAK,C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AAA;IAAAC,YAAA;EAAA,MAEnCS,SAAS;EAEb,QAEKO,UAAU,OAAGD,OAAO,OAAGI,WAAW;AAGzC","ignoreList":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, memo as _$memo, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { List, Name, Show, createContentSlot } from "@alloy-js/core";
|
|
3
|
+
import { createPythonSymbol } from "../symbol-creation.js";
|
|
4
|
+
import { Declaration } from "./Declaration.js";
|
|
5
|
+
import { MemberScope } from "./MemberScope.js";
|
|
6
|
+
import { PythonBlock } from "./PythonBlock.js";
|
|
7
|
+
/**
|
|
8
|
+
* Create a Python class declaration.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <ClassDeclaration name="MyClass" bases={["BaseClass"]}>
|
|
13
|
+
* <VariableDeclaration name="a" type="int" />
|
|
14
|
+
* <VariableDeclaration name="b" type="str" />
|
|
15
|
+
* <py.FunctionDeclaration name="my_method" parameters={[{ name: "a", type: "int" }, { name: "b", type: "str" }]} returnType="int">
|
|
16
|
+
* return a + b
|
|
17
|
+
* </py.FunctionDeclaration>
|
|
18
|
+
* </ClassDeclaration>
|
|
19
|
+
* ```
|
|
20
|
+
* renders to
|
|
21
|
+
* ```py
|
|
22
|
+
* class MyClass(BaseClass):
|
|
23
|
+
* a: int = None
|
|
24
|
+
* b: str = None
|
|
25
|
+
* def my_method(self, a: int, b: str) -> int:
|
|
26
|
+
* return a + b
|
|
27
|
+
* ```
|
|
28
|
+
* @remarks
|
|
29
|
+
*
|
|
30
|
+
* Any child declarations (methods, fields, nested classes) will be placed
|
|
31
|
+
* in the class scope. This component creates a class scope to hold its
|
|
32
|
+
* members.
|
|
33
|
+
*/
|
|
34
|
+
export function ClassDeclaration(props) {
|
|
35
|
+
const basesPart = props.bases && ["(", _$createComponent(List, {
|
|
36
|
+
get children() {
|
|
37
|
+
return props.bases;
|
|
38
|
+
},
|
|
39
|
+
comma: true,
|
|
40
|
+
space: true
|
|
41
|
+
}, {
|
|
42
|
+
fileName: import.meta.url,
|
|
43
|
+
lineNumber: 44,
|
|
44
|
+
columnNumber: 8
|
|
45
|
+
}), ")"];
|
|
46
|
+
const sym = createPythonSymbol(props.name, {
|
|
47
|
+
refkeys: props.refkey
|
|
48
|
+
}, "class");
|
|
49
|
+
const ContentSlot = createContentSlot();
|
|
50
|
+
return _$createComponent(Declaration, {
|
|
51
|
+
symbol: sym,
|
|
52
|
+
get children() {
|
|
53
|
+
return ["class ", _$createComponent(Name, {}, {
|
|
54
|
+
fileName: import.meta.url,
|
|
55
|
+
lineNumber: 60,
|
|
56
|
+
columnNumber: 13
|
|
57
|
+
}), _$createComponent(MemberScope, {
|
|
58
|
+
ownerSymbol: sym,
|
|
59
|
+
get children() {
|
|
60
|
+
return [basesPart, _$createComponent(PythonBlock, {
|
|
61
|
+
opener: ":",
|
|
62
|
+
get children() {
|
|
63
|
+
return [_$createComponent(Show, {
|
|
64
|
+
get when() {
|
|
65
|
+
return Boolean(props.doc);
|
|
66
|
+
},
|
|
67
|
+
get children() {
|
|
68
|
+
return [_$memo(() => props.doc, false, "props.doc"), _$createIntrinsic("line", {}, {
|
|
69
|
+
fileName: import.meta.url,
|
|
70
|
+
lineNumber: 66,
|
|
71
|
+
columnNumber: 13
|
|
72
|
+
})];
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
fileName: import.meta.url,
|
|
76
|
+
lineNumber: 64,
|
|
77
|
+
columnNumber: 11
|
|
78
|
+
}), _$createComponent(ContentSlot.WhenEmpty, {
|
|
79
|
+
children: "pass"
|
|
80
|
+
}, {
|
|
81
|
+
fileName: import.meta.url,
|
|
82
|
+
lineNumber: 68,
|
|
83
|
+
columnNumber: 11
|
|
84
|
+
}), _$createComponent(ContentSlot, {
|
|
85
|
+
get children() {
|
|
86
|
+
return props.children;
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
fileName: import.meta.url,
|
|
90
|
+
lineNumber: 69,
|
|
91
|
+
columnNumber: 11
|
|
92
|
+
})];
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
fileName: import.meta.url,
|
|
96
|
+
lineNumber: 63,
|
|
97
|
+
columnNumber: 9
|
|
98
|
+
})];
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
fileName: import.meta.url,
|
|
102
|
+
lineNumber: 61,
|
|
103
|
+
columnNumber: 7
|
|
104
|
+
})];
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
fileName: import.meta.url,
|
|
108
|
+
lineNumber: 59,
|
|
109
|
+
columnNumber: 5
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=ClassDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["List","Name","Show","createContentSlot","createPythonSymbol","Declaration","MemberScope","PythonBlock","ClassDeclaration","props","basesPart","bases","_$createComponent","children","comma","space","fileName","import","meta","url","lineNumber","columnNumber","sym","name","refkeys","refkey","ContentSlot","symbol","ownerSymbol","opener","when","Boolean","doc","_$memo","_$createIntrinsic","WhenEmpty"],"sources":["../../../../src/components/ClassDeclaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAmBA,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,iBAAiB,QAAQ,gBAAgB;AAC9E,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAA+BC,WAAW,QAAQ,kBAAkB;AACpE,SAASC,WAAW;AACpB,SAASC,WAAW;AASpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAA4B,EAAE;EAC7D,MAAMC,SAAS,GAAGD,KAAK,CAACE,KAAK,UAAAC,iBAAA,CAE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AAAC,GAAA;gBAAAC,UAAA;gBAAAC,YAAA;cAAA,IAAAT,iBAAA,CACrBc,WAAW;gBAAA,IAAAb,SAAA;kBAAA,OAAEJ,KAAK,CAACI,QAAQ;gBAAA;cAAA;gBAAAG,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;gBAAAC,UAAA;gBAAAC,YAAA;cAAA;YAAA;UAAA;YAAAL,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;YAAAC,UAAA;YAAAC,YAAA;UAAA;QAAA;MAAA;QAAAL,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;QAAAC,UAAA;QAAAC,YAAA;MAAA;IAAA;EAAA;IAAAL,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;IAAAC,UAAA;IAAAC,YAAA;EAAA;AAKtC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { emitSymbol, instantiateTakenMembersTo, useContext } from "@alloy-js/core";
|
|
3
|
+
import { createPythonSymbol } from "../symbol-creation.js";
|
|
4
|
+
import { FunctionCallExpression } from "./FunctionCallExpression.js";
|
|
5
|
+
import { PythonSourceFileContext } from "./SourceFile.js";
|
|
6
|
+
/**
|
|
7
|
+
* Used to create new instances of classes in Python.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <ClassInstantiation target="MyClass" args={["arg1", "arg2"]} />
|
|
12
|
+
* ```
|
|
13
|
+
* This will generate:
|
|
14
|
+
* ```python
|
|
15
|
+
* MyClass(arg1, arg2)
|
|
16
|
+
* ```
|
|
17
|
+
* @remarks
|
|
18
|
+
*
|
|
19
|
+
* It is similar to FunctionCallExpression but specifically for class instantiation.
|
|
20
|
+
* Args should be a list arguments that can be either simple js values or py.Atoms, which will render as positional arguments,
|
|
21
|
+
* or py.VariableDeclarations, which will render as named arguments in the call statement. This component will
|
|
22
|
+
* not check for the correctness of the python grammar and will just work with any children you provide.
|
|
23
|
+
* It is up to you to ensure that the arguments you provide are valid in the context of a class instantiation.
|
|
24
|
+
*/
|
|
25
|
+
export function ClassInstantiation(props) {
|
|
26
|
+
const sfContext = useContext(PythonSourceFileContext);
|
|
27
|
+
const module = sfContext?.module;
|
|
28
|
+
const sym = createPythonSymbol("", {
|
|
29
|
+
transient: true,
|
|
30
|
+
module: module
|
|
31
|
+
});
|
|
32
|
+
instantiateTakenMembersTo(sym, "static", "instance");
|
|
33
|
+
emitSymbol(sym);
|
|
34
|
+
return [_$createComponent(FunctionCallExpression, props, {
|
|
35
|
+
fileName: import.meta.url,
|
|
36
|
+
lineNumber: 45,
|
|
37
|
+
columnNumber: 7
|
|
38
|
+
})];
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ClassInstantiation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["emitSymbol","instantiateTakenMembersTo","useContext","createPythonSymbol","FunctionCallExpression","PythonSourceFileContext","ClassInstantiation","props","sfContext","module","sym","transient","_$createComponent","fileName","import","meta","url","lineNumber","columnNumber"],"sources":["../../../../src/components/ClassInstantiation.tsx"],"sourcesContent":[null],"mappings":";AAAA,SACEA,UAAU,EACVC,yBAAyB,EACzBC,UAAU,QACL,gBAAgB;AACvB,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SACEC,sBAAsB;AAGxB,SAASC,uBAAuB;AAIhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,KAA8B,EAAE;EACjE,MAAMC,SAAS,GAAGN,UAAU,CAACG,uBAAuB,CAAC;EACrD,MAAMI,MAAM,GAAGD,SAAS,EAAEC,MAAM;EAChC,MAAMC,GAAG,GAAGP,kBAAkB,CAAC,EAAE,EAAE;IACjCQ,SAAS,EAAE,IAAI;IACfF,MAAM,EAAEA;EACV,CAAC,CAAC;EACFR,yBAAyB,CAACS,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC;EACpDV,UAAU,CAACU,GAAG,CAAC;EACf,QAAAE,iBAAA,CAEKR,sBAAsB,EAAKG,KAAK;IAAAM,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;IAAAC,UAAA;IAAAC,YAAA;EAAA;AAGvC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic, mergeProps as _$mergeProps, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createMethodSymbol } from "../symbols/factories.js";
|
|
3
|
+
import { MethodDeclarationBase } from "./MethodBase.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A Python class method declaration component.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <py.ClassMethodDeclaration name="create" parameters={[{ name: "value", type: "str" }]}>
|
|
11
|
+
* return cls(value)
|
|
12
|
+
* </py.ClassMethodDeclaration>
|
|
13
|
+
* ```
|
|
14
|
+
* Generates:
|
|
15
|
+
* ```python
|
|
16
|
+
* @classmethod
|
|
17
|
+
* def create(cls, value: str) -> None:
|
|
18
|
+
* return cls(value)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export function ClassMethodDeclaration(props) {
|
|
23
|
+
const sym = createMethodSymbol(props.name, {
|
|
24
|
+
refkeys: props.refkey
|
|
25
|
+
});
|
|
26
|
+
return ["@classmethod", _$createIntrinsic("hbr", {}, {
|
|
27
|
+
fileName: import.meta.url,
|
|
28
|
+
lineNumber: 30,
|
|
29
|
+
columnNumber: 7
|
|
30
|
+
}), _$createComponent(MethodDeclarationBase, _$mergeProps({
|
|
31
|
+
functionType: "class"
|
|
32
|
+
}, props, {
|
|
33
|
+
sym: sym
|
|
34
|
+
}), {
|
|
35
|
+
fileName: import.meta.url,
|
|
36
|
+
lineNumber: 31,
|
|
37
|
+
columnNumber: 7
|
|
38
|
+
})];
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ClassMethodDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createMethodSymbol","MethodDeclarationBase","ClassMethodDeclaration","props","sym","name","refkeys","refkey","_$createIntrinsic","fileName","import","meta","url","lineNumber","columnNumber","_$createComponent","_$mergeProps","functionType"],"sources":["../../../../src/components/ClassMethodDeclaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAE5D,SAASC,qBAAqB,QAAQ,iBAAiB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASC,sBAAsBA,CAACC,KAAkC,EAAE;EACzE,MAAMC,GAAG,GAAGJ,kBAAkB,CAACG,KAAK,CAACE,IAAI,EAAE;IAAEC,OAAO,EAAEH,KAAK,CAACI;EAAO,CAAC,CAAC;EACrE,QAEK,cAAc,EAAAC,iBAAA;IAAAC,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;IAAAC,UAAA;IAAAC,YAAA;EAAA,IAAAC,iBAAA,CAEdd,qBAAqB,EAAAe,YAAA;IAACC,YAAY;EAAA,GAAad,KAAK;IAAEC,GAAG,EAAEA;EAAG;IAAAK,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;IAAAC,UAAA;IAAAC,YAAA;EAAA;AAGrE","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { mergeProps as _$mergeProps, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { namekey } from "@alloy-js/core";
|
|
3
|
+
import { createMethodSymbol } from "../symbols/factories.js";
|
|
4
|
+
import { MethodDeclarationBase } from "./MethodBase.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A Python constructor declaration for `__new__`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <py.ConstructorDeclaration parameters={[{ name: "value", type: "int" }]}>
|
|
12
|
+
* pass
|
|
13
|
+
* </py.ConstructorDeclaration>
|
|
14
|
+
* ```
|
|
15
|
+
* Generates:
|
|
16
|
+
* ```python
|
|
17
|
+
* def __new__(cls, value: int):
|
|
18
|
+
* pass
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export function ConstructorDeclaration(props) {
|
|
23
|
+
const name = namekey("__new__", {
|
|
24
|
+
ignoreNamePolicy: true
|
|
25
|
+
});
|
|
26
|
+
const sym = createMethodSymbol(name, {
|
|
27
|
+
refkeys: props.refkey
|
|
28
|
+
});
|
|
29
|
+
return _$createComponent(MethodDeclarationBase, _$mergeProps(props, {
|
|
30
|
+
name: name,
|
|
31
|
+
functionType: "class",
|
|
32
|
+
sym: sym
|
|
33
|
+
}), {
|
|
34
|
+
fileName: import.meta.url,
|
|
35
|
+
lineNumber: 30,
|
|
36
|
+
columnNumber: 5
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ConstructorDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["namekey","createMethodSymbol","MethodDeclarationBase","ConstructorDeclaration","props","name","ignoreNamePolicy","sym","refkeys","refkey","_$createComponent","_$mergeProps","functionType","fileName","import","meta","url","lineNumber","columnNumber"],"sources":["../../../../src/components/ConstructorDeclaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,OAAO,QAAQ,gBAAgB;AACxC,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,SAASC,qBAAqB,QAAQ,iBAAiB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAO,SAASC,sBAAsBA,CAACC,KAAkC,EAAE;EACzE,MAAMC,IAAI,GAAGL,OAAO,CAAC,SAAS,EAAE;IAAEM,gBAAgB,EAAE;EAAK,CAAC,CAAC;EAC3D,MAAMC,GAAG,GAAGN,kBAAkB,CAACI,IAAI,EAAE;IAAEG,OAAO,EAAEJ,KAAK,CAACK;EAAO,CAAC,CAAC;EAC/D,OAAAC,iBAAA,CACGR,qBAAqB,EAAAS,YAAA,CAChBP,KAAK;IACTC,IAAI,EAAEA,IAAI;IACVO,YAAY;IACZL,GAAG,EAAEA;EAAG;IAAAM,QAAA,EAAAC,MAAA,CAAAC,IAAA,CAAAC,GAAA;IAAAC,UAAA;IAAAC,YAAA;EAAA;AAGd","ignoreList":[]}
|