diff --git a/packages/codemaker/lib/case-utils.ts b/packages/codemaker/lib/case-utils.ts index c1f29a6b4b..9d9ac6c322 100644 --- a/packages/codemaker/lib/case-utils.ts +++ b/packages/codemaker/lib/case-utils.ts @@ -1,5 +1,11 @@ import { default as camelcase } from 'camelcase'; -import * as decamelize from 'decamelize'; +import decamelize = require('decamelize'); + +const COMMON_ABBREVIATIONS = [ + 'KiB', + 'MiB', + 'GiB', +]; export function toCamelCase(...args: string[]) { return camelcase(args); @@ -10,5 +16,17 @@ export function toPascalCase(...args: string[]) { } export function toSnakeCase(s: string, sep = '_') { + // Save common abbrevations + s = s.replace(ABBREV_RE, (_, before, abbr, after) => before + ucfirst(abbr.toLowerCase()) + after); return decamelize(s, sep); } + +function regexQuote(s: string) { + return s.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); +} + +const ABBREV_RE = new RegExp('(^|[^A-Z])(' + COMMON_ABBREVIATIONS.map(regexQuote).join('|') + ')($|[^a-z])', 'g'); + +function ucfirst(s: string) { + return s.substr(0, 1).toUpperCase() + s.substr(1).toLowerCase(); +} \ No newline at end of file diff --git a/packages/codemaker/test/test.case-utils.ts b/packages/codemaker/test/test.case-utils.ts index 0f354dbb3c..5475312e2d 100644 --- a/packages/codemaker/test/test.case-utils.ts +++ b/packages/codemaker/test/test.case-utils.ts @@ -2,15 +2,32 @@ import nodeunit = require('nodeunit'); import caseUtils = require('../lib/case-utils'); export = nodeunit.testCase({ - toCamelCase(test: nodeunit.Test) { + 'toCamelCase'(test: nodeunit.Test) { test.equal(caseUtils.toCamelCase('EXAMPLE_VALUE'), 'exampleValue'); test.equal(caseUtils.toCamelCase('example', 'value'), 'exampleValue'); test.done(); }, - toPascalCase(test: nodeunit.Test) { + 'toPascalCase'(test: nodeunit.Test) { test.equal(caseUtils.toPascalCase('EXAMPLE_VALUE'), 'ExampleValue'); test.equal(caseUtils.toPascalCase('example', 'value'), 'ExampleValue'); + test.done(); + }, + + 'toSnakeCase'(test: nodeunit.Test) { + test.equal(caseUtils.toSnakeCase('EXAMPLE_VALUE'), 'example_value'); + test.equal(caseUtils.toSnakeCase('exampleValue'), 'example_value'); + test.equal(caseUtils.toSnakeCase('ExampleValue'), 'example_value'); + test.equal(caseUtils.toSnakeCase('EPSConduit'), 'eps_conduit'); + test.equal(caseUtils.toSnakeCase('SomeEBSVolume'), 'some_ebs_volume'); + test.done(); + }, + + 'reserved word snake-casing'(test: nodeunit.Test) { + test.equal(caseUtils.toSnakeCase('SizeMiB'), 'size_mib'); + test.equal(caseUtils.toSnakeCase('SizeMiBiBytes'), 'size_mi_bi_bytes'); + test.equal(caseUtils.toSnakeCase('MiBSize'), 'mib_size'); + test.done(); } }); diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index b67894ffc6..27935a7742 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -1741,3 +1741,46 @@ export class DataRenderer { return JSON.stringify(map, null, 2); } } + +export interface TopLevelStruct { + /** + * This is a required field + */ + readonly required: string; + + /** + * You don't have to pass this + */ + readonly optional?: string; + + /** + * A union to really stress test our serialization + */ + readonly secondLevel: SecondLevelStruct | number; +} + +export interface SecondLevelStruct { + /** + * It's long and required + */ + readonly deeperRequiredProp: string; + + /** + * It's long, but you'll almost never pass it. + */ + readonly deeperOptionalProp?: string; +} + +export class StructPassing { + public static roundTrip(_positional: number, input: TopLevelStruct): TopLevelStruct { + return { + required: input.required, + optional: input.optional, + secondLevel: input.secondLevel, + }; + } + + public static howManyVarArgsDidIPass(_positional: number, inputs: TopLevelStruct[]): number { + return inputs.length; + } +} \ No newline at end of file diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 96b9dfec33..c0c5d5d7be 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -7150,6 +7150,55 @@ ], "name": "RuntimeTypeChecking" }, + "jsii-calc.SecondLevelStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.SecondLevelStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1762 + }, + "name": "SecondLevelStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "It's long and required." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1766 + }, + "name": "deeperRequiredProp", + "type": { + "primitive": "string" + } + }, + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "It's long, but you'll almost never pass it." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1771 + }, + "name": "deeperOptionalProp", + "optional": true, + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.SingleInstanceTwoTypes": { "assembly": "jsii-calc", "docs": { @@ -7756,6 +7805,87 @@ } ] }, + "jsii-calc.StructPassing": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.StructPassing", + "initializer": {}, + "kind": "class", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1774 + }, + "methods": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1783 + }, + "name": "howManyVarArgsDidIPass", + "parameters": [ + { + "name": "_positional", + "type": { + "primitive": "number" + } + }, + { + "name": "inputs", + "type": { + "collection": { + "elementtype": { + "fqn": "jsii-calc.TopLevelStruct" + }, + "kind": "array" + } + } + } + ], + "returns": { + "type": { + "primitive": "number" + } + }, + "static": true + }, + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1775 + }, + "name": "roundTrip", + "parameters": [ + { + "name": "_positional", + "type": { + "primitive": "number" + } + }, + { + "name": "input", + "type": { + "fqn": "jsii-calc.TopLevelStruct" + } + } + ], + "returns": { + "type": { + "fqn": "jsii-calc.TopLevelStruct" + } + }, + "static": true + } + ], + "name": "StructPassing" + }, "jsii-calc.Sum": { "assembly": "jsii-calc", "base": "jsii-calc.composition.CompositeOperation", @@ -8104,6 +8234,80 @@ ], "name": "Thrower" }, + "jsii-calc.TopLevelStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.TopLevelStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1745 + }, + "name": "TopLevelStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "This is a required field." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1749 + }, + "name": "required", + "type": { + "primitive": "string" + } + }, + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "A union to really stress test our serialization." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1759 + }, + "name": "secondLevel", + "type": { + "union": { + "types": [ + { + "primitive": "number" + }, + { + "fqn": "jsii-calc.SecondLevelStruct" + } + ] + } + } + }, + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "You don't have to pass this." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1754 + }, + "name": "optional", + "optional": true, + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.UnaryOperation": { "abstract": true, "assembly": "jsii-calc", @@ -8851,5 +9055,5 @@ } }, "version": "0.13.4", - "fingerprint": "T+Xf0Qtu6HVsykkz6vGH8OhMtRQbt7Jzq4O7Rsv5SeM=" + "fingerprint": "7VlL0zBte+Qeew8qdhvaeS0ZtQtbbT8m3wjT7mDtAoE=" } diff --git a/packages/jsii-pacmak/bin/jsii-pacmak.ts b/packages/jsii-pacmak/bin/jsii-pacmak.ts index 429477fa64..fef12de9cd 100644 --- a/packages/jsii-pacmak/bin/jsii-pacmak.ts +++ b/packages/jsii-pacmak/bin/jsii-pacmak.ts @@ -1,5 +1,6 @@ #!/usr/bin/env node import fs = require('fs-extra'); +import reflect = require('jsii-reflect'); import spec = require('jsii-spec'); import os = require('os'); import path = require('path'); @@ -136,6 +137,10 @@ import { VERSION_DESC } from '../lib/version'; const tarball = await timers.recordAsync('npm pack', () => { return npmPack(packageDir, tmpdir); }); + + const ts = new reflect.TypeSystem(); + const assembly = await ts.loadModule(packageDir); + for (const targetName of targets) { // if we are targeting a single language, output to outdir, otherwise outdir/ const targetOutputDir = (targets.length > 1 || forceSubdirectory) @@ -144,7 +149,7 @@ import { VERSION_DESC } from '../lib/version'; logging.debug(`Building ${pkg.name}/${targetName}: ${targetOutputDir}`); await timers.recordAsync(targetName.toString(), () => - generateTarget(packageDir, targetName.toString(), targetOutputDir, tarball) + generateTarget(assembly, packageDir, targetName.toString(), targetOutputDir, tarball) ); } } finally { @@ -159,7 +164,7 @@ import { VERSION_DESC } from '../lib/version'; logging.info(`Packaged. ${timers.display()}`); } - async function generateTarget(packageDir: string, targetName: string, targetOutputDir: string, tarball: string) { + async function generateTarget(assembly: reflect.Assembly, packageDir: string, targetName: string, targetOutputDir: string, tarball: string) { // ``argv.target`` is guaranteed valid by ``yargs`` through the ``choices`` directive. const targetConstructor = targetConstructors[targetName]; if (!targetConstructor) { @@ -169,6 +174,7 @@ import { VERSION_DESC } from '../lib/version'; const target = new targetConstructor({ targetName, packageDir, + assembly, fingerprint: argv.fingerprint, force: argv.force, arguments: argv diff --git a/packages/jsii-pacmak/lib/generator.ts b/packages/jsii-pacmak/lib/generator.ts index 0291c0d2b7..d95b8e67af 100644 --- a/packages/jsii-pacmak/lib/generator.ts +++ b/packages/jsii-pacmak/lib/generator.ts @@ -2,9 +2,10 @@ import * as clone from 'clone'; import { CodeMaker } from 'codemaker'; import * as crypto from 'crypto'; import * as fs from 'fs-extra'; +import reflect = require('jsii-reflect'); import * as spec from 'jsii-spec'; import * as path from 'path'; -import util = require('./util'); +import { assemblySpec, typeSpec } from './reflect-hacks'; import { VERSION_DESC } from './version'; // tslint:disable @@ -12,24 +13,24 @@ import { VERSION_DESC } from './version'; /** * Options for the code generator framework. */ -export class GeneratorOptions { +export interface GeneratorOptions { /** * If this property is set to 'true', union properties are "expanded" into multiple * properties, each with a different type and a postfix based on the type name. This * can be used by languages that don't have support for union types (e.g. Java). */ - expandUnionProperties? = false + expandUnionProperties?: boolean; /** * If this property is set to 'true', methods that have optional arguments are duplicated * and overloads are created with all parameters. */ - generateOverloadsForMethodWithOptionals? = false + generateOverloadsForMethodWithOptionals?: boolean; /** * If this property is set, the generator will add "Base" to abstract class names */ - addBasePostfixToAbstractClassNames? = false + addBasePostfixToAbstractClassNames?: boolean; } export interface IGenerator { @@ -39,7 +40,7 @@ export interface IGenerator { * Load a module into the generator. * @param packageDir is the root directory of the module. */ - load(packageDir: string): Promise; + load(packageDir: string, assembly: reflect.Assembly): Promise; /** * Determine if the generated artifacts for this generator are already up-to-date. @@ -55,27 +56,29 @@ export interface IGenerator { * Given a jsii module, it will invoke "events" to emit various elements. */ export abstract class Generator implements IGenerator { - private readonly options: GeneratorOptions; private readonly excludeTypes = new Array(); protected readonly code = new CodeMaker(); protected assembly: spec.Assembly; - private externals: { [name: string]: spec.Type | undefined } = {}; + protected _reflectAssembly?: reflect.Assembly; private fingerprint: string; - constructor(options = new GeneratorOptions()) { - this.options = options; + constructor(private readonly options: GeneratorOptions = {}) { + } + + public get reflectAssembly(): reflect.Assembly { + if (!this._reflectAssembly) { + throw new Error('Call load() first'); + } + return this._reflectAssembly; } public get metadata() { return { fingerprint: this.fingerprint }; } - public async load(packageDir: string) { - this.assembly = await util.loadAssembly(packageDir); - - if (this.assembly.schema !== spec.SchemaVersion.LATEST) { - throw new Error(`Invalid schema version "${this.assembly.schema}". Expecting "${spec.SchemaVersion.LATEST}"`); - } + public async load(_packageRoot: string, assembly: reflect.Assembly) { + this._reflectAssembly = assembly; + this.assembly = assemblySpec(assembly); // Including the version of jsii-pacmak in the fingerprint, as a new version may imply different code generation. this.fingerprint = crypto.createHash('sha256') @@ -83,12 +86,6 @@ export abstract class Generator implements IGenerator { .update('\0') .update(this.assembly.fingerprint) .digest('base64'); - - this.externals = {}; - const loaded = new Set(); - for (const name of Object.keys(this.assembly.dependencies || {})) { - await this.loadDependency(name, this.assembly.dependencies![name].version, packageDir, loaded); - } } /** @@ -518,57 +515,11 @@ export abstract class Generator implements IGenerator { } protected findType(fqn: string) { - - const lookupType = (asm: spec.Assembly): spec.Type | undefined => { - - const type = asm.types && asm.types[fqn]; - if (type) { - return type; - } - - const externalType = this.externals[fqn]; - if (externalType) { - return externalType; - } - - return undefined; - } - - const ret = lookupType(this.assembly); + const ret = this.reflectAssembly.system.tryFindFqn(fqn); if (!ret) { throw new Error(`Cannot find type '${fqn}' either as internal or external type`); } - return ret; - } - - /** - * Loads a dependency assembly and makes the types it defines available in ``this.externals``. The modules are - * loaded transitively (dependencies of the assembly will be loaded using this function, too). - * - * @param name the name of the dependency to be loaded. - * @param version the expected (aka declared) version of the dependency. - * @param packageDir the root directory of the package that declares the dependency. - * @param loaded a cache of already-loaded modules (helps avoid multi-loading dependencies that appear multiple - * times in the full dependency closure). - * - * @throws if no module with the requested name can be resolved (using npm resolution mechanisms), if the resolved - * module lacks a ``.jsii`` file, or if the version does not match the requested one (TODO: Semver?). - */ - private async loadDependency(name: string, version: string, packageDir: string, loaded: Set) { - if (loaded.has(name)) { return; } - const moduleRoot = util.resolveDependencyDirectory(packageDir, name); - const assm = await util.loadAssembly(moduleRoot); - if (assm.version !== version) { - throw new Error(`Module ${name} found with version ${assm.version}, but version ${version} was expected`); - } - for (const type of Object.values(assm.types || {})) { - this.externals[type.fqn] = type; - } - loaded.add(name); - for (const depName of Object.keys(assm.dependencies || {})) { - const dep = assm.dependencies![depName]; - await this.loadDependency(depName, dep.version, moduleRoot, loaded); - } + return typeSpec(ret); } } diff --git a/packages/jsii-pacmak/lib/index.ts b/packages/jsii-pacmak/lib/index.ts index c86af746eb..4bb77426e8 100644 --- a/packages/jsii-pacmak/lib/index.ts +++ b/packages/jsii-pacmak/lib/index.ts @@ -1 +1 @@ -export { Target } from './target'; +export { Target } from './target'; \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/reflect-hacks.ts b/packages/jsii-pacmak/lib/reflect-hacks.ts new file mode 100644 index 0000000000..2257c19ec0 --- /dev/null +++ b/packages/jsii-pacmak/lib/reflect-hacks.ts @@ -0,0 +1,28 @@ +import * as reflect from 'jsii-reflect'; +import * as spec from 'jsii-spec'; + +// All current functions are written against jsii-spec, but jsii-reflect +// is more convenient. +// +// These functions exist to break the isolation barrier until we have time +// to rewrite the code to properly use jsii-reflect. + +export function assemblySpec(x: reflect.Assembly): spec.Assembly { + return (x as any).spec; +} + +export function optionalValueSpec(x: reflect.OptionalValue): spec.OptionalValue | undefined { + return (x as any).spec; +} + +export function typeSpec(x: reflect.Type): spec.Type { + return (x as any).spec; +} + +export function docsSpec(x: reflect.Docs): spec.Docs { + return (x as any).spec; +} + +export function propertySpec(x: reflect.Property): spec.Property { + return (x as any).propSpec; +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/target.ts b/packages/jsii-pacmak/lib/target.ts index 48d40eaf9e..8b4808b722 100644 --- a/packages/jsii-pacmak/lib/target.ts +++ b/packages/jsii-pacmak/lib/target.ts @@ -1,4 +1,5 @@ import fs = require('fs-extra'); +import reflect = require('jsii-reflect'); import spec = require('jsii-spec'); import path = require('path'); @@ -28,11 +29,13 @@ export abstract class Target { protected readonly force: boolean; protected readonly arguments: { [name: string]: any }; protected readonly targetName: string; + protected readonly assembly: reflect.Assembly; protected abstract get generator(): IGenerator; constructor(options: TargetOptions) { this.packageDir = options.packageDir; + this.assembly = options.assembly; this.fingerprint = options.fingerprint != null ? options.fingerprint : true; this.force = options.force != null ? options.force : false; this.arguments = options.arguments; @@ -45,7 +48,8 @@ export abstract class Target { * @param outDir the directory where the generated source will be placed. */ public async generateCode(outDir: string, tarball: string): Promise { - await this.generator.load(this.packageDir); + await this.generator.load(this.packageDir, this.assembly); + if (this.force || !await this.generator.upToDate(outDir)) { await this.generator.generate(this.fingerprint); await this.generator.save(outDir, tarball); @@ -181,6 +185,10 @@ export interface TargetOptions { /** The directory where the JSII package is located */ packageDir: string; + + /** The JSII-reflect assembly for this JSII assembly */ + assembly: reflect.Assembly; + /** * Whether to fingerprint the produced artifacts. * @default true diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index 635826dd04..bbcd5c1cb6 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -2,9 +2,12 @@ import path = require('path'); import { CodeMaker, toSnakeCase } from 'codemaker'; import * as escapeStringRegexp from 'escape-string-regexp'; +import * as reflect from 'jsii-reflect'; import * as spec from 'jsii-spec'; +import { Stability } from 'jsii-spec'; import { Generator, GeneratorOptions } from '../generator'; import { md2rst } from '../markdown'; +import { propertySpec } from '../reflect-hacks'; import { Target, TargetOptions } from '../target'; import { shell } from '../util'; @@ -130,19 +133,6 @@ const sortMembers = (sortable: PythonBase[], resolver: TypeResolver): PythonBase return sorted; }; -/** - * Iterates over an iterable, yielding true for every element after the first - * - * Useful for separating item lists. - */ -function* separate(xs: Iterable): IterableIterator<[T, boolean]> { - let sep = false; - for (const x of xs) { - yield [x, sep]; - sep = true; - } -} - const recurseForNamedTypeReferences = (typeRef: spec.TypeReference): spec.NamedTypeReference[] => { if (spec.isPrimitiveTypeReference(typeRef)) { return []; @@ -162,7 +152,7 @@ const recurseForNamedTypeReferences = (typeRef: spec.TypeReference): spec.NamedT }; interface PythonBase { - readonly name: string; + readonly pythonName: string; emit(code: CodeMaker, resolver: TypeResolver, opts?: any): void; } @@ -188,20 +178,19 @@ interface PythonTypeOpts { } abstract class BasePythonClassType implements PythonType, ISortableType { - - public readonly name: string; - public readonly fqn: string | null; - protected bases: spec.TypeReference[]; protected members: PythonBase[]; - constructor(name: string, fqn: string, opts: PythonTypeOpts, protected readonly docs: spec.Docs | undefined) { + constructor( + protected readonly generator: PythonGenerator, + public readonly pythonName: string, + public readonly fqn: string | null, + opts: PythonTypeOpts, + protected readonly docs: spec.Docs | undefined) { const { bases = [], } = opts; - this.name = name; - this.fqn = fqn; this.bases = bases; this.members = []; } @@ -247,7 +236,7 @@ abstract class BasePythonClassType implements PythonType, ISortableType { const classParams = this.getClassParams(resolver); const bases = classParams.length > 0 ? `(${classParams.join(", ")})` : ""; - code.openBlock(`class ${this.name}${bases}`); + code.openBlock(`class ${this.pythonName}${bases}`); emitDocString(code, this.docs); this.emitPreamble(code, resolver); @@ -293,7 +282,8 @@ abstract class BaseMethod implements PythonBase { private readonly liftedProp?: spec.InterfaceType; private readonly parent?: spec.NamedTypeReference; - constructor(public readonly name: string, + constructor(protected readonly generator: PythonGenerator, + public readonly pythonName: string, private readonly jsName: string | undefined, private readonly parameters: spec.Parameter[], private readonly returns?: spec.OptionalValue, @@ -403,7 +393,7 @@ abstract class BaseMethod implements PythonBase { code.line("@abc.abstractmethod"); } - code.openBlock(`def ${this.name}(${pythonParams.join(", ")}) -> ${returnType}`); + code.openBlock(`def ${this.pythonName}(${pythonParams.join(", ")}) -> ${returnType}`); emitDocString(code, this.docs, { arguments: documentableArgs }); this.emitBody(code, resolver, renderAbstract, forceEmitBody); code.closeBlock(); @@ -428,28 +418,13 @@ abstract class BaseMethod implements PythonBase { // We need to build up a list of properties, which are mandatory, these are the // ones we will specifiy to start with in our dictionary literal. - const mandatoryPropMembers: string[] = []; - for (const prop of this.getLiftedProperties(resolver)) { - if (prop.optional) { - continue; - } + const liftedProps = this.getLiftedProperties(resolver).map(p => new StructField(p)); + const assignments = liftedProps + .map(p => p.pythonName) + .map(v => `${v}=${v}`); - mandatoryPropMembers.push(`"${prop.name}": ${toPythonParameterName(prop.name)}`); - } - code.line(`${argName}: ${typeName} = {${mandatoryPropMembers.join(", ")}}`); + code.line(`${argName} = ${typeName}(${assignments.join(', ')})`); code.line(); - - // Now we'll go through our optional properties, and if they haven't been set - // we'll add them to our dictionary. - for (const prop of this.getLiftedProperties(resolver)) { - if (!prop.optional) { - continue; - } - - code.openBlock(`if ${toPythonParameterName(prop.name)} is not None`); - code.line(`${argName}["${prop.name}"] = ${toPythonParameterName(prop.name)}`); - code.closeBlock(); - } } private emitJsiiMethodCall(code: CodeMaker, resolver: TypeResolver) { @@ -468,12 +443,14 @@ abstract class BaseMethod implements PythonBase { } // If the last arg is variadic, expand the tuple - const paramNames: string[] = []; + const params: string[] = []; for (const param of this.parameters) { - paramNames.push((param.variadic ? '*' : '') + toPythonParameterName(param.name)); + let expr = toPythonParameterName(param.name); + if (param.variadic) { expr = `*${expr}`; } + params.push(expr); } - code.line(`${methodPrefix}jsii.${this.jsiiMethod}(${jsiiMethodParams.join(", ")}, [${paramNames.join(", ")}])`); + code.line(`${methodPrefix}jsii.${this.jsiiMethod}(${jsiiMethodParams.join(", ")}, [${params.join(", ")}])`); } private getLiftedProperties(resolver: TypeResolver): spec.Property[] { @@ -521,7 +498,7 @@ abstract class BaseProperty implements PythonBase { private readonly immutable: boolean; - constructor(public readonly name: string, + constructor(public readonly pythonName: string, private readonly jsName: string, private readonly type: spec.OptionalValue, private readonly docs: spec.Docs | undefined, @@ -544,7 +521,7 @@ abstract class BaseProperty implements PythonBase { if (renderAbstract && this.abstract) { code.line("@abc.abstractmethod"); } - code.openBlock(`def ${this.name}(${this.implicitParameter}) -> ${pythonType}`); + code.openBlock(`def ${this.pythonName}(${this.implicitParameter}) -> ${pythonType}`); emitDocString(code, this.docs); if ((this.shouldEmitBody || forceEmitBody) && (!renderAbstract || !this.abstract)) { code.line(`return jsii.${this.jsiiGetMethod}(${this.implicitParameter}, "${this.jsName}")`); @@ -554,11 +531,11 @@ abstract class BaseProperty implements PythonBase { code.closeBlock(); if (!this.immutable) { - code.line(`@${this.name}.setter`); + code.line(`@${this.pythonName}.setter`); if (renderAbstract && this.abstract) { code.line("@abc.abstractmethod"); } - code.openBlock(`def ${this.name}(${this.implicitParameter}, value: ${pythonType})`); + code.openBlock(`def ${this.pythonName}(${this.implicitParameter}, value: ${pythonType})`); if ((this.shouldEmitBody || forceEmitBody) && (!renderAbstract || !this.abstract)) { code.line(`return jsii.${this.jsiiSetMethod}(${this.implicitParameter}, "${this.jsName}", value)`); } else { @@ -611,7 +588,7 @@ class Interface extends BasePythonClassType { } private getProxyClassName(): string { - return `_${this.name}Proxy`; + return `_${this.pythonName}Proxy`; } } @@ -630,103 +607,157 @@ class InterfaceProperty extends BaseProperty { protected readonly shouldEmitBody: boolean = false; } -class TypedDict extends BasePythonClassType { +class Struct extends BasePythonClassType { + protected directMembers = new Array(); + + public addMember(member: PythonBase): void { + if (!(member instanceof StructField)) { + throw new Error('Must add StructField to Struct'); + } + this.directMembers.push(member); + } public emit(code: CodeMaker, resolver: TypeResolver) { resolver = this.fqn ? resolver.bind(this.fqn) : resolver; - // MyPy doesn't let us mark some keys as optional, and some keys as mandatory, - // we can either mark either the entire class as mandatory or the entire class - // as optional. However, we can make two classes, one with all mandatory keys - // and one with all optional keys in order to emulate this. So we'll go ahead - // and implement this "split" class logic. + const baseInterfaces = this.getClassParams(resolver); - const classParams = this.getClassParams(resolver); - const baseInterfaces = classParams.slice(0, classParams.length - 1); + code.line(`@jsii.data_type(jsii_type="${this.fqn}", jsii_struct_bases=[${baseInterfaces.join(', ')}], name_mapping=${this.propertyMap()})`); + code.openBlock(`class ${this.pythonName}(${baseInterfaces.join(', ')})`); + this.emitConstructor(code, resolver); - const mandatoryMembers = this.members.filter( - item => item instanceof TypedDictProperty ? !item.optional : true - ); - const optionalMembers = this.members.filter( - item => item instanceof TypedDictProperty ? item.optional : false - ); + for (const member of this.allMembers) { + this.emitGetter(member, code, resolver); + } - if (mandatoryMembers.length >= 1 && optionalMembers.length >= 1) { - // In this case, we have both mandatory *and* optional members, so we'll - // do our split class logic. + this.emitMagicMethods(code); - // We'll emit the optional members first, just because it's a little nicer - // for the final class in the chain to have the mandatory members. - code.line(`@jsii.data_type_optionals(jsii_struct_bases=[${baseInterfaces.join(', ')}])`); - code.openBlock(`class _${this.name}(${classParams.concat(["total=False"]).join(", ")})`); - for (const member of optionalMembers) { - member.emit(code, resolver); - } - code.closeBlock(); + code.closeBlock(); + } - // Now we'll emit the mandatory members. - code.line(`@jsii.data_type(jsii_type="${this.fqn}", jsii_struct_bases=[_${this.name}])`); - code.openBlock(`class ${this.name}(_${this.name})`); - emitDocString(code, this.docs); - for (const [member, sep] of separate(sortMembers(mandatoryMembers, resolver))) { - if (sep) { code.line(''); } - member.emit(code, resolver); - } - code.closeBlock(); - } else { - code.line(`@jsii.data_type(jsii_type="${this.fqn}", jsii_struct_bases=[${baseInterfaces.join(', ')}])`); + protected getClassParams(resolver: TypeResolver): string[] { + return this.bases.map(b => resolver.resolve({ type: b })); + } - // In this case we either have no members, or we have all of one type, so - // we'll see if we have any optional members, if we don't then we'll use - // total=True instead of total=False for the class. - if (optionalMembers.length >= 1) { - code.openBlock(`class ${this.name}(${classParams.concat(["total=False"]).join(", ")})`); - } else { - code.openBlock(`class ${this.name}(${classParams.join(", ")})`); - } - emitDocString(code, this.docs); + /** + * Find all fields (inherited as well) + */ + private get allMembers(): StructField[] { + return this.thisInterface.allProperties.map(x => new StructField(propertySpec(x))); + } - // Finally we'll just iterate over and emit all of our members. - if (this.members.length > 0) { - for (const [member, sep] of separate(sortMembers(this.members, resolver))) { - if (sep) { code.line(''); } - member.emit(code, resolver); - } - } else { - code.line("pass"); - } + private get thisInterface() { + if (this.fqn === null) { throw new Error('FQN not set'); } + return this.generator.reflectAssembly.system.findInterface(this.fqn); + } - code.closeBlock(); + private emitConstructor(code: CodeMaker, resolver: TypeResolver) { + const members = this.allMembers; + + const kwargs = members.map(m => m.constructorDecl(resolver)); + + const constructorArguments = kwargs.length > 0 ? ['self', '*', ...kwargs] : ['self']; + + code.openBlock(`def __init__(${constructorArguments.join(', ')})`); + this.emitConstructorDocstring(code); + + // Required properties, those will always be put into the dict + code.line('self._values = {'); + for (const member of members.filter(m => !m.optional)) { + code.line(` '${member.pythonName}': ${member.pythonName},`); + } + code.line('}'); + + // Optional properties, will only be put into the dict if they're not None + for (const member of members.filter(m => m.optional)) { + code.line(`if ${member.pythonName} is not None: self._values["${member.pythonName}"] = ${member.pythonName}`); } + + code.closeBlock(); } - protected getClassParams(resolver: TypeResolver): string[] { - const params: string[] = this.bases.map(b => resolver.resolve({ type: b })); + private emitConstructorDocstring(code: CodeMaker) { + const args: DocumentableArgument[] = this.allMembers.map(m => ({ + name: m.pythonName, + docs: m.docs, + })); + emitDocString(code, this.docs, { arguments: args }); + } - params.push("jsii.compat.TypedDict"); + private emitGetter(member: StructField, code: CodeMaker, resolver: TypeResolver) { + code.line('@property'); + code.openBlock(`def ${member.pythonName}(self) -> ${member.typeAnnotation(resolver)}`); + member.emitDocString(code); + code.line(`return self._values.get('${member.pythonName}')`); + code.closeBlock(); + } - return params; + private emitMagicMethods(code: CodeMaker) { + code.openBlock(`def __eq__(self, rhs) -> bool`); + code.line('return isinstance(rhs, self.__class__) and rhs._values == self._values'); + code.closeBlock(); + + code.openBlock(`def __ne__(self, rhs) -> bool`); + code.line('return not (rhs == self)'); + code.closeBlock(); + + code.openBlock(`def __repr__(self) -> str`); + code.line(`return '${this.pythonName}(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items())`); + code.closeBlock(); } + private propertyMap() { + const ret = new Array(); + for (const member of this.allMembers) { + ret.push(`'${member.pythonName}': '${member.jsiiName}'`); + } + return `{${ret.join(', ')}}`; + } } -class TypedDictProperty implements PythonBase { +class StructField implements PythonBase { + public readonly pythonName: string; + public readonly jsiiName: string; + public readonly docs?: spec.Docs; + private readonly type: spec.OptionalValue; - constructor(public readonly name: string, - private readonly type: spec.OptionalValue, - private readonly docs: spec.Docs | undefined, - ) {} + constructor(public readonly prop: spec.Property) { + this.pythonName = toPythonPropertyName(prop.name); + this.jsiiName = prop.name; + this.type = prop; + this.docs = prop.docs; + } public get optional(): boolean { return !!this.type.optional; } - public emit(code: CodeMaker, resolver: TypeResolver) { - const resolvedType = resolver.resolve( + public isStruct(generator: PythonGenerator): boolean { + return isStruct(generator.reflectAssembly.system, this.type.type); + } + + public constructorDecl(resolver: TypeResolver) { + const opt = this.optional ? '=None' : ''; + return `${this.pythonName}: ${this.typeAnnotation(resolver)}${opt}`; + } + + /** + * Return the Python type annotation for this type + */ + public typeAnnotation(resolver: TypeResolver) { + return resolver.resolve( this.type, - { forwardReferences: false, ignoreOptional: true } + { forwardReferences: false } ); - code.line(`${this.name}: ${resolvedType}`); + } + + public emitDocString(code: CodeMaker) { + emitDocString(code, this.docs); + } + + public emit(code: CodeMaker, resolver: TypeResolver) { + const resolvedType = this.typeAnnotation(resolver); + code.line(`${this.pythonName}: ${resolvedType}`); emitDocString(code, this.docs); } } @@ -743,8 +774,8 @@ class Class extends BasePythonClassType { private abstractBases: spec.ClassType[]; private interfaces: spec.NamedTypeReference[]; - constructor(name: string, fqn: string, opts: ClassOpts, docs: spec.Docs | undefined) { - super(name, fqn, opts, docs); + constructor(generator: PythonGenerator, name: string, fqn: string, opts: ClassOpts, docs: spec.Docs | undefined) { + super(generator, name, fqn, opts, docs); const { abstract = false, interfaces = [], abstractBases = [] } = opts; @@ -800,7 +831,7 @@ class Class extends BasePythonClassType { if (this.abstract) { resolver = this.fqn ? resolver.bind(this.fqn) : resolver; - const proxyBases: string[] = [this.name]; + const proxyBases: string[] = [this.pythonName]; for (const base of this.abstractBases) { proxyBases.push(`jsii.proxy_for(${resolver.resolve({ type: base })})`); } @@ -844,7 +875,7 @@ class Class extends BasePythonClassType { } private getProxyClassName(): string { - return `_${this.name}Proxy`; + return `_${this.pythonName}Proxy`; } } @@ -899,13 +930,13 @@ class Enum extends BasePythonClassType { } class EnumMember implements PythonBase { - constructor(public readonly name: string, private readonly value: string, private readonly docs: spec.Docs | undefined) { - this.name = name; + constructor(public readonly pythonName: string, private readonly value: string, private readonly docs: spec.Docs | undefined) { + this.pythonName = pythonName; this.value = value; } public emit(code: CodeMaker, _resolver: TypeResolver) { - code.line(`${this.name} = "${this.value}"`); + code.line(`${this.pythonName} = "${this.value}"`); emitDocString(code, this.docs); } } @@ -924,7 +955,7 @@ interface ModuleOpts { class Module implements PythonType { - public readonly name: string; + public readonly pythonName: string; public readonly fqn: string | null; private assembly: spec.Assembly; @@ -933,7 +964,7 @@ class Module implements PythonType { private members: PythonBase[]; constructor(name: string, fqn: string | null, opts: ModuleOpts) { - this.name = name; + this.pythonName = name; this.fqn = fqn; this.assembly = opts.assembly; @@ -947,7 +978,7 @@ class Module implements PythonType { } public emit(code: CodeMaker, resolver: TypeResolver) { - resolver = this.fqn ? resolver.bind(this.fqn, this.name) : resolver; + resolver = this.fqn ? resolver.bind(this.fqn, this.pythonName) : resolver; // Before we write anything else, we need to write out our module headers, this // is where we handle stuff like imports, any required initialization, etc. @@ -982,7 +1013,7 @@ class Module implements PythonType { } // Whatever names we've exported, we'll write out our __all__ that lists them. - const exportedMembers = this.members.map(m => `"${m.name}"`); + const exportedMembers = this.members.map(m => `"${m.pythonName}"`); if (this.loadAssembly) { exportedMembers.push(`"__jsii_assembly__"`); } @@ -1039,23 +1070,23 @@ class Package { } public addModule(module: Module) { - this.modules.set(module.name, module); + this.modules.set(module.pythonName, module); } public addData(module: Module, filename: string, data: string | null) { - if (!this.data.has(module.name)) { - this.data.set(module.name, new Array()); + if (!this.data.has(module.pythonName)) { + this.data.set(module.pythonName, new Array()); } - this.data.get(module.name)!.push({filename, data}); + this.data.get(module.pythonName)!.push({filename, data}); } public write(code: CodeMaker, resolver: TypeResolver) { - const modules = [...this.modules.values()].sort((a, b) => a.name.localeCompare(b.name)); + const modules = [...this.modules.values()].sort((a, b) => a.pythonName.localeCompare(b.pythonName)); // Iterate over all of our modules, and write them out to disk. for (const mod of modules) { - const filename = path.join("src", pythonModuleNameToFilename(mod.name), "__init__.py"); + const filename = path.join("src", pythonModuleNameToFilename(mod.pythonName), "__init__.py"); code.openFile(filename); mod.emit(code, resolver); @@ -1117,7 +1148,7 @@ class Package { Source: this.metadata.repository.url, }, package_dir: {"": "src"}, - packages: modules.map(m => m.name), + packages: modules.map(m => m.pythonName), package_data: packageData, python_requires: ">=3.6", install_requires: [`jsii~=${jsiiVersionSimple}`, "publication>=0.0.3"].concat(dependencies), @@ -1381,11 +1412,10 @@ class TypeResolver { } class PythonGenerator extends Generator { - private package: Package; private types: Map; - constructor(options = new GeneratorOptions()) { + constructor(options: GeneratorOptions = {}) { super(options); this.code.openBlockFormatter = s => `${s}:`; @@ -1394,6 +1424,16 @@ class PythonGenerator extends Generator { this.types = new Map(); } + public getPythonType(fqn: string): PythonType { + const type = this.types.get(fqn); + + if (type === undefined) { + throw new Error(`Could not locate type: "${fqn}"`); + } + + return type; + } + protected getAssemblyOutputDir(assm: spec.Assembly) { return path.join("src", pythonModuleNameToFilename(this.getAssemblyModuleName(assm))); } @@ -1451,6 +1491,7 @@ class PythonGenerator extends Generator { // https://github.com/awslabs/jsii/issues/283 are solved. this.addPythonType( new Namespace( + this, toPythonIdentifier(ns.replace(/^.+\.([^\.]+)$/, "$1")), ns, {}, @@ -1462,6 +1503,7 @@ class PythonGenerator extends Generator { protected onBeginClass(cls: spec.ClassType, abstract: boolean | undefined) { const klass = new Class( + this, toPythonIdentifier(cls.name), cls.fqn, { @@ -1478,6 +1520,7 @@ class PythonGenerator extends Generator { klass.addMember( new Initializer( + this, "__init__", undefined, parameters, @@ -1496,6 +1539,7 @@ class PythonGenerator extends Generator { this.getPythonType(cls.fqn).addMember( new StaticMethod( + this, toPythonMethodName(method.name!), method.name, parameters, @@ -1524,6 +1568,7 @@ class PythonGenerator extends Generator { if (method.async) { this.getPythonType(cls.fqn).addMember( new AsyncMethod( + this, toPythonMethodName(method.name!, method.protected), method.name, parameters, @@ -1535,6 +1580,7 @@ class PythonGenerator extends Generator { } else { this.getPythonType(cls.fqn).addMember( new Method( + this, toPythonMethodName(method.name!, method.protected), method.name, parameters, @@ -1563,10 +1609,11 @@ class PythonGenerator extends Generator { } protected onBeginInterface(ifc: spec.InterfaceType) { - let iface: Interface | TypedDict; + let iface: Interface | Struct; if (ifc.datatype) { - iface = new TypedDict( + iface = new Struct( + this, toPythonIdentifier(ifc.name), ifc.fqn, { bases: ifc.interfaces && ifc.interfaces.map(base => this.findType(base)) }, @@ -1574,6 +1621,7 @@ class PythonGenerator extends Generator { ); } else { iface = new Interface( + this, toPythonIdentifier(ifc.name), ifc.fqn, { bases: ifc.interfaces && ifc.interfaces.map(base => this.findType(base)) }, @@ -1591,6 +1639,7 @@ class PythonGenerator extends Generator { this.getPythonType(ifc.fqn).addMember( new InterfaceMethod( + this, toPythonMethodName(method.name!, method.protected), method.name, parameters, @@ -1602,14 +1651,10 @@ class PythonGenerator extends Generator { } protected onInterfaceProperty(ifc: spec.InterfaceType, prop: spec.Property) { - let ifaceProperty: InterfaceProperty | TypedDictProperty; + let ifaceProperty: InterfaceProperty | StructField; if (ifc.datatype) { - ifaceProperty = new TypedDictProperty( - toPythonIdentifier(prop.name), - prop, - prop.docs, - ); + ifaceProperty = new StructField(prop); } else { ifaceProperty = new InterfaceProperty( toPythonPropertyName(prop.name, prop.const, prop.protected), @@ -1624,7 +1669,7 @@ class PythonGenerator extends Generator { } protected onBeginEnum(enm: spec.EnumType) { - this.addPythonType(new Enum(toPythonIdentifier(enm.name), enm.fqn, {}, enm.docs)); + this.addPythonType(new Enum(this, toPythonIdentifier(enm.name), enm.fqn, {}, enm.docs)); } protected onEnumMember(enm: spec.EnumType, member: spec.EnumMember) { @@ -1667,16 +1712,6 @@ class PythonGenerator extends Generator { return this.getPythonType(this.getParentFQN(fqn)); } - private getPythonType(fqn: string): PythonType { - const type = this.types.get(fqn); - - if (type === undefined) { - throw new Error(`Could not locate type: "${fqn}"`); - } - - return type; - } - private addPythonType(type: PythonType) { if (type.fqn === null) { throw new Error("Cannot add a Python type without a FQN."); @@ -1692,7 +1727,7 @@ class PythonGenerator extends Generator { // as keyword arguments to this function. if (method.parameters !== undefined && method.parameters.length >= 1) { const lastParameter = method.parameters.slice(-1)[0]; - if (spec.isNamedTypeReference(lastParameter.type)) { + if (!lastParameter.variadic && spec.isNamedTypeReference(lastParameter.type)) { const lastParameterType = this.findType(lastParameter.type.fqn); if (spec.isInterfaceType(lastParameterType) && lastParameterType.datatype) { return lastParameterType; @@ -1752,8 +1787,15 @@ function emitDocString(code: CodeMaker, docs: spec.Docs | undefined, options: { function block(heading: string, content: string, doBrk = true) { if (doBrk) { brk(); } lines.push(heading); - for (const line of md2rst(content).split('\n')) { - lines.push(` ${line}`); + const contentLines = md2rst(content).split('\n'); + if (contentLines.length <= 1) { + lines.push(`:${heading}: ${contentLines.join('')}`); + } else { + lines.push(`:${heading}:`); + brk(); + for (const line of contentLines) { + lines.push(`${line}`); + } } if (doBrk) { brk(); } } @@ -1766,21 +1808,20 @@ function emitDocString(code: CodeMaker, docs: spec.Docs | undefined, options: { if (options.arguments && options.arguments.length > 0) { brk(); - lines.push('Arguments:'); for (const param of options.arguments) { // Add a line for every argument. Even if there is no description, we need // the docstring so that the Sphinx extension can add the type annotations. - lines.push(` ${toPythonParameterName(param.name)}: ${onelineDescription(param.docs)}`); + lines.push(`:param ${toPythonParameterName(param.name)}: ${onelineDescription(param.docs)}`); } brk(); } - if (docs.default) { block('Default:', docs.default); } - if (docs.returns) { block('Returns:', docs.returns); } - if (docs.deprecated) { block('Deprecated:', docs.deprecated); } - if (docs.see) { block('See:', docs.see, false); } - if (docs.stability) { block('Stability:', docs.stability, false); } - if (docs.subclassable) { block('Subclassable:', 'Yes'); } + if (docs.default) { block('default', docs.default); } + if (docs.returns) { block('return', docs.returns); } + if (docs.deprecated) { block('deprecated', docs.deprecated); } + if (docs.see) { block('see', docs.see, false); } + if (docs.stability && shouldMentionStability(docs.stability)) { block('stability', docs.stability, false); } + if (docs.subclassable) { block('subclassable', 'Yes'); } for (const [k, v] of Object.entries(docs.custom || {})) { block(k + ':', v, false); @@ -1827,3 +1868,13 @@ function onelineDescription(docs: spec.Docs | undefined) { if (docs.default) { parts.push(`Default: ${md2rst(docs.default)}`); } return parts.join(' ').replace(/\s+/g, ' '); } + +function shouldMentionStability(s: Stability) { + return s === Stability.Deprecated || s === Stability.Experimental; +} + +function isStruct(typeSystem: reflect.TypeSystem, ref: spec.TypeReference): boolean { + if (!spec.isNamedTypeReference(ref)) { return false; } + const type = typeSystem.tryFindFqn(ref.fqn); + return type !== undefined && type.isInterfaceType() && type.isDataType(); +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/sphinx.ts b/packages/jsii-pacmak/lib/targets/sphinx.ts index 8b9d827fa1..0ba82c40bb 100644 --- a/packages/jsii-pacmak/lib/targets/sphinx.ts +++ b/packages/jsii-pacmak/lib/targets/sphinx.ts @@ -1,4 +1,5 @@ import fs = require('fs-extra'); +import reflect = require('jsii-reflect'); import spec = require('jsii-spec'); import path = require('path'); import { Generator } from '../generator'; @@ -46,8 +47,8 @@ class SphinxDocsGenerator extends Generator { this.code.indentation = 3; } - public async load(packageRoot: string) { - await super.load(packageRoot); + public async load(packageRoot: string, assembly: reflect.Assembly) { + await super.load(packageRoot, assembly); this.targets = await Target.findAll(); } diff --git a/packages/jsii-pacmak/package.json b/packages/jsii-pacmak/package.json index 539e8c20fb..d5af7caed4 100644 --- a/packages/jsii-pacmak/package.json +++ b/packages/jsii-pacmak/package.json @@ -26,6 +26,7 @@ "escape-string-regexp": "^2.0.0", "fs-extra": "^8.0.1", "jsii-spec": "^0.13.4", + "jsii-reflect": "^0.13.4", "spdx-license-list": "^6.0.0", "xmlbuilder": "^13.0.2", "yargs": "^13.2.4" diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/python/src/scope/jsii_calc_base/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc-base/python/src/scope/jsii_calc_base/__init__.py index 789efc72de..66f4319738 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/python/src/scope/jsii_calc_base/__init__.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/python/src/scope/jsii_calc_base/__init__.py @@ -23,8 +23,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="typeName") def type_name(self) -> typing.Any: """ - Returns: - the name of the class (to verify native type names are created for derived classes). + return + :return: the name of the class (to verify native type names are created for derived classes). """ return jsii.invoke(self, "typeName", []) @@ -32,9 +32,35 @@ def type_name(self) -> typing.Any: class _BaseProxy(Base): pass -@jsii.data_type(jsii_type="@scope/jsii-calc-base.BaseProps", jsii_struct_bases=[scope.jsii_calc_base_of_base.VeryBaseProps]) -class BaseProps(scope.jsii_calc_base_of_base.VeryBaseProps, jsii.compat.TypedDict): - bar: str +@jsii.data_type(jsii_type="@scope/jsii-calc-base.BaseProps", jsii_struct_bases=[scope.jsii_calc_base_of_base.VeryBaseProps], name_mapping={'foo': 'foo', 'bar': 'bar'}) +class BaseProps(scope.jsii_calc_base_of_base.VeryBaseProps): + def __init__(self, *, foo: scope.jsii_calc_base_of_base.Very, bar: str): + """ + :param foo: - + :param bar: - + """ + self._values = { + 'foo': foo, + 'bar': bar, + } + + @property + def foo(self) -> scope.jsii_calc_base_of_base.Very: + return self._values.get('foo') + + @property + def bar(self) -> str: + return self._values.get('bar') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'BaseProps(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + @jsii.interface(jsii_type="@scope/jsii-calc-base.IBaseInterface") class IBaseInterface(scope.jsii_calc_base_of_base.IVeryBaseInterface, jsii.compat.Protocol): diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/__init__.py index f0f252037f..43378ff998 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/__init__.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/__init__.py @@ -15,26 +15,26 @@ class EnumFromScopedModule(enum.Enum): """Check that enums from @scoped packages can be references. See awslabs/jsii#138. - Stability: - deprecated + stability + :stability: deprecated """ VALUE1 = "VALUE1" """ - Stability: - deprecated + stability + :stability: deprecated """ VALUE2 = "VALUE2" """ - Stability: - deprecated + stability + :stability: deprecated """ @jsii.interface(jsii_type="@scope/jsii-calc-lib.IDoublable") class IDoublable(jsii.compat.Protocol): """The general contract for a concrete number. - Stability: - deprecated + stability + :stability: deprecated """ @staticmethod def __jsii_proxy_class__(): @@ -44,8 +44,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="doubleValue") def double_value(self) -> jsii.Number: """ - Stability: - deprecated + stability + :stability: deprecated """ ... @@ -53,16 +53,16 @@ def double_value(self) -> jsii.Number: class _IDoublableProxy(): """The general contract for a concrete number. - Stability: - deprecated + stability + :stability: deprecated """ __jsii_type__ = "@scope/jsii-calc-lib.IDoublable" @property @jsii.member(jsii_name="doubleValue") def double_value(self) -> jsii.Number: """ - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "doubleValue") @@ -74,8 +74,8 @@ class IFriendly(jsii.compat.Protocol): These classes can be greeted with a "hello" or "goodbye" blessing and they will respond back in a fun and friendly manner. - Stability: - deprecated + stability + :stability: deprecated """ @staticmethod def __jsii_proxy_class__(): @@ -85,8 +85,8 @@ def __jsii_proxy_class__(): def hello(self) -> str: """Say hello! - Stability: - deprecated + stability + :stability: deprecated """ ... @@ -97,16 +97,16 @@ class _IFriendlyProxy(): These classes can be greeted with a "hello" or "goodbye" blessing and they will respond back in a fun and friendly manner. - Stability: - deprecated + stability + :stability: deprecated """ __jsii_type__ = "@scope/jsii-calc-lib.IFriendly" @jsii.member(jsii_name="hello") def hello(self) -> str: """Say hello! - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "hello", []) @@ -118,8 +118,8 @@ class IThreeLevelsInterface(scope.jsii_calc_base.IBaseInterface, jsii.compat.Pro Their presence validates that .NET/Java/jsii-reflect can track all fields far enough up the tree. - Stability: - deprecated + stability + :stability: deprecated """ @staticmethod def __jsii_proxy_class__(): @@ -128,8 +128,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="baz") def baz(self) -> None: """ - Stability: - deprecated + stability + :stability: deprecated """ ... @@ -140,79 +140,131 @@ class _IThreeLevelsInterfaceProxy(jsii.proxy_for(scope.jsii_calc_base.IBaseInter Their presence validates that .NET/Java/jsii-reflect can track all fields far enough up the tree. - Stability: - deprecated + stability + :stability: deprecated """ __jsii_type__ = "@scope/jsii-calc-lib.IThreeLevelsInterface" @jsii.member(jsii_name="baz") def baz(self) -> None: """ - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "baz", []) -@jsii.data_type_optionals(jsii_struct_bases=[]) -class _MyFirstStruct(jsii.compat.TypedDict, total=False): - firstOptional: typing.List[str] - """ - Stability: - deprecated - """ +@jsii.data_type(jsii_type="@scope/jsii-calc-lib.MyFirstStruct", jsii_struct_bases=[], name_mapping={'anumber': 'anumber', 'astring': 'astring', 'first_optional': 'firstOptional'}) +class MyFirstStruct(): + def __init__(self, *, anumber: jsii.Number, astring: str, first_optional: typing.Optional[typing.List[str]]=None): + """This is the first struct we have created in jsii. -@jsii.data_type(jsii_type="@scope/jsii-calc-lib.MyFirstStruct", jsii_struct_bases=[_MyFirstStruct]) -class MyFirstStruct(_MyFirstStruct): - """This is the first struct we have created in jsii. + :param anumber: An awesome number value. + :param astring: A string value. + :param first_optional: - Stability: - deprecated - """ - anumber: jsii.Number - """An awesome number value. + stability + :stability: deprecated + """ + self._values = { + 'anumber': anumber, + 'astring': astring, + } + if first_optional is not None: self._values["first_optional"] = first_optional - Stability: - deprecated - """ + @property + def anumber(self) -> jsii.Number: + """An awesome number value. - astring: str - """A string value. + stability + :stability: deprecated + """ + return self._values.get('anumber') - Stability: - deprecated - """ + @property + def astring(self) -> str: + """A string value. + + stability + :stability: deprecated + """ + return self._values.get('astring') -@jsii.data_type(jsii_type="@scope/jsii-calc-lib.StructWithOnlyOptionals", jsii_struct_bases=[]) -class StructWithOnlyOptionals(jsii.compat.TypedDict, total=False): - """This is a struct with only optional properties. + @property + def first_optional(self) -> typing.Optional[typing.List[str]]: + """ + stability + :stability: deprecated + """ + return self._values.get('first_optional') - Stability: - deprecated - """ - optional1: str - """The first optional! + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values - Stability: - deprecated - """ + def __ne__(self, rhs) -> bool: + return not (rhs == self) - optional2: jsii.Number - """ - Stability: - deprecated - """ + def __repr__(self) -> str: + return 'MyFirstStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + + +@jsii.data_type(jsii_type="@scope/jsii-calc-lib.StructWithOnlyOptionals", jsii_struct_bases=[], name_mapping={'optional1': 'optional1', 'optional2': 'optional2', 'optional3': 'optional3'}) +class StructWithOnlyOptionals(): + def __init__(self, *, optional1: typing.Optional[str]=None, optional2: typing.Optional[jsii.Number]=None, optional3: typing.Optional[bool]=None): + """This is a struct with only optional properties. + + :param optional1: The first optional! + :param optional2: + :param optional3: + + stability + :stability: deprecated + """ + self._values = { + } + if optional1 is not None: self._values["optional1"] = optional1 + if optional2 is not None: self._values["optional2"] = optional2 + if optional3 is not None: self._values["optional3"] = optional3 + + @property + def optional1(self) -> typing.Optional[str]: + """The first optional! + + stability + :stability: deprecated + """ + return self._values.get('optional1') + + @property + def optional2(self) -> typing.Optional[jsii.Number]: + """ + stability + :stability: deprecated + """ + return self._values.get('optional2') + + @property + def optional3(self) -> typing.Optional[bool]: + """ + stability + :stability: deprecated + """ + return self._values.get('optional3') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'StructWithOnlyOptionals(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - optional3: bool - """ - Stability: - deprecated - """ class Value(scope.jsii_calc_base.Base, metaclass=jsii.JSIIAbstractClass, jsii_type="@scope/jsii-calc-lib.Value"): """Abstract class which represents a numeric value. - Stability: - deprecated + stability + :stability: deprecated """ @staticmethod def __jsii_proxy_class__(): @@ -225,8 +277,8 @@ def __init__(self) -> None: def to_string(self) -> str: """String representation of the value. - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "toString", []) @@ -236,8 +288,8 @@ def to_string(self) -> str: def value(self) -> jsii.Number: """The value. - Stability: - deprecated + stability + :stability: deprecated """ ... @@ -248,8 +300,8 @@ class _ValueProxy(Value, jsii.proxy_for(scope.jsii_calc_base.Base)): def value(self) -> jsii.Number: """The value. - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "value") @@ -258,17 +310,16 @@ def value(self) -> jsii.Number: class Number(Value, metaclass=jsii.JSIIMeta, jsii_type="@scope/jsii-calc-lib.Number"): """Represents a concrete number. - Stability: - deprecated + stability + :stability: deprecated """ def __init__(self, value: jsii.Number) -> None: """Creates a Number object. - Arguments: - value: The number. + :param value: The number. - Stability: - deprecated + stability + :stability: deprecated """ jsii.create(Number, self, [value]) @@ -277,8 +328,8 @@ def __init__(self, value: jsii.Number) -> None: def double_value(self) -> jsii.Number: """The number multiplied by 2. - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "doubleValue") @@ -287,8 +338,8 @@ def double_value(self) -> jsii.Number: def value(self) -> jsii.Number: """The number. - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "value") @@ -296,8 +347,8 @@ def value(self) -> jsii.Number: class Operation(Value, metaclass=jsii.JSIIAbstractClass, jsii_type="@scope/jsii-calc-lib.Operation"): """Represents an operation on values. - Stability: - deprecated + stability + :stability: deprecated """ @staticmethod def __jsii_proxy_class__(): @@ -311,8 +362,8 @@ def __init__(self) -> None: def to_string(self) -> str: """String representation of the value. - Stability: - deprecated + stability + :stability: deprecated """ ... @@ -322,8 +373,8 @@ class _OperationProxy(Operation, jsii.proxy_for(Value)): def to_string(self) -> str: """String representation of the value. - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "toString", []) diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 96b9dfec33..c0c5d5d7be 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -7150,6 +7150,55 @@ ], "name": "RuntimeTypeChecking" }, + "jsii-calc.SecondLevelStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.SecondLevelStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1762 + }, + "name": "SecondLevelStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "It's long and required." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1766 + }, + "name": "deeperRequiredProp", + "type": { + "primitive": "string" + } + }, + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "It's long, but you'll almost never pass it." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1771 + }, + "name": "deeperOptionalProp", + "optional": true, + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.SingleInstanceTwoTypes": { "assembly": "jsii-calc", "docs": { @@ -7756,6 +7805,87 @@ } ] }, + "jsii-calc.StructPassing": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.StructPassing", + "initializer": {}, + "kind": "class", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1774 + }, + "methods": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1783 + }, + "name": "howManyVarArgsDidIPass", + "parameters": [ + { + "name": "_positional", + "type": { + "primitive": "number" + } + }, + { + "name": "inputs", + "type": { + "collection": { + "elementtype": { + "fqn": "jsii-calc.TopLevelStruct" + }, + "kind": "array" + } + } + } + ], + "returns": { + "type": { + "primitive": "number" + } + }, + "static": true + }, + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1775 + }, + "name": "roundTrip", + "parameters": [ + { + "name": "_positional", + "type": { + "primitive": "number" + } + }, + { + "name": "input", + "type": { + "fqn": "jsii-calc.TopLevelStruct" + } + } + ], + "returns": { + "type": { + "fqn": "jsii-calc.TopLevelStruct" + } + }, + "static": true + } + ], + "name": "StructPassing" + }, "jsii-calc.Sum": { "assembly": "jsii-calc", "base": "jsii-calc.composition.CompositeOperation", @@ -8104,6 +8234,80 @@ ], "name": "Thrower" }, + "jsii-calc.TopLevelStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.TopLevelStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1745 + }, + "name": "TopLevelStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "This is a required field." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1749 + }, + "name": "required", + "type": { + "primitive": "string" + } + }, + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "A union to really stress test our serialization." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1759 + }, + "name": "secondLevel", + "type": { + "union": { + "types": [ + { + "primitive": "number" + }, + { + "fqn": "jsii-calc.SecondLevelStruct" + } + ] + } + } + }, + { + "abstract": true, + "docs": { + "stability": "experimental", + "summary": "You don't have to pass this." + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 1754 + }, + "name": "optional", + "optional": true, + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.UnaryOperation": { "abstract": true, "assembly": "jsii-calc", @@ -8851,5 +9055,5 @@ } }, "version": "0.13.4", - "fingerprint": "T+Xf0Qtu6HVsykkz6vGH8OhMtRQbt7Jzq4O7Rsv5SeM=" + "fingerprint": "7VlL0zBte+Qeew8qdhvaeS0ZtQtbbT8m3wjT7mDtAoE=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ISecondLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ISecondLevelStruct.cs new file mode 100644 index 0000000000..87a2cf3158 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ISecondLevelStruct.cs @@ -0,0 +1,25 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiInterface(nativeType: typeof(ISecondLevelStruct), fullyQualifiedName: "jsii-calc.SecondLevelStruct")] + public interface ISecondLevelStruct + { + /// It's long and required. + /// stability: Experimental + [JsiiProperty(name: "deeperRequiredProp", typeJson: "{\"primitive\":\"string\"}")] + string DeeperRequiredProp + { + get; + } + + /// It's long, but you'll almost never pass it. + /// stability: Experimental + [JsiiProperty(name: "deeperOptionalProp", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] + string DeeperOptionalProp + { + get; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ITopLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ITopLevelStruct.cs new file mode 100644 index 0000000000..9ef1e315b0 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ITopLevelStruct.cs @@ -0,0 +1,33 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiInterface(nativeType: typeof(ITopLevelStruct), fullyQualifiedName: "jsii-calc.TopLevelStruct")] + public interface ITopLevelStruct + { + /// This is a required field. + /// stability: Experimental + [JsiiProperty(name: "required", typeJson: "{\"primitive\":\"string\"}")] + string Required + { + get; + } + + /// A union to really stress test our serialization. + /// stability: Experimental + [JsiiProperty(name: "secondLevel", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.SecondLevelStruct\"}]}}")] + object SecondLevel + { + get; + } + + /// You don't have to pass this. + /// stability: Experimental + [JsiiProperty(name: "optional", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] + string Optional + { + get; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStruct.cs new file mode 100644 index 0000000000..04298c0e1c --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStruct.cs @@ -0,0 +1,27 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiByValue] + public class SecondLevelStruct : ISecondLevelStruct + { + /// It's long and required. + /// stability: Experimental + [JsiiProperty(name: "deeperRequiredProp", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] + public string DeeperRequiredProp + { + get; + set; + } + + /// It's long, but you'll almost never pass it. + /// stability: Experimental + [JsiiProperty(name: "deeperOptionalProp", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] + public string DeeperOptionalProp + { + get; + set; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStructProxy.cs new file mode 100644 index 0000000000..e46f1b903f --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStructProxy.cs @@ -0,0 +1,29 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiTypeProxy(nativeType: typeof(ISecondLevelStruct), fullyQualifiedName: "jsii-calc.SecondLevelStruct")] + internal sealed class SecondLevelStructProxy : DeputyBase, ISecondLevelStruct + { + private SecondLevelStructProxy(ByRefValue reference): base(reference) + { + } + + /// It's long and required. + /// stability: Experimental + [JsiiProperty(name: "deeperRequiredProp", typeJson: "{\"primitive\":\"string\"}")] + public string DeeperRequiredProp + { + get => GetInstanceProperty(); + } + + /// It's long, but you'll almost never pass it. + /// stability: Experimental + [JsiiProperty(name: "deeperOptionalProp", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] + public string DeeperOptionalProp + { + get => GetInstanceProperty(); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructPassing.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructPassing.cs new file mode 100644 index 0000000000..60917572b0 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructPassing.cs @@ -0,0 +1,35 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiClass(nativeType: typeof(StructPassing), fullyQualifiedName: "jsii-calc.StructPassing")] + public class StructPassing : DeputyBase + { + public StructPassing(): base(new DeputyProps(new object[]{})) + { + } + + protected StructPassing(ByRefValue reference): base(reference) + { + } + + protected StructPassing(DeputyProps props): base(props) + { + } + + /// stability: Experimental + [JsiiMethod(name: "howManyVarArgsDidIPass", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"_positional\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"inputs\",\"type\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"jsii-calc.TopLevelStruct\"}}}}]")] + public static double HowManyVarArgsDidIPass(double _positional, ITopLevelStruct[] inputs) + { + return InvokeStaticMethod(typeof(StructPassing), new object[]{_positional, inputs}); + } + + /// stability: Experimental + [JsiiMethod(name: "roundTrip", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.TopLevelStruct\"}}", parametersJson: "[{\"name\":\"_positional\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"input\",\"type\":{\"fqn\":\"jsii-calc.TopLevelStruct\"}}]")] + public static ITopLevelStruct RoundTrip(double _positional, ITopLevelStruct input) + { + return InvokeStaticMethod(typeof(StructPassing), new object[]{_positional, input}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStruct.cs new file mode 100644 index 0000000000..fc8ba1d6cb --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStruct.cs @@ -0,0 +1,36 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiByValue] + public class TopLevelStruct : ITopLevelStruct + { + /// This is a required field. + /// stability: Experimental + [JsiiProperty(name: "required", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] + public string Required + { + get; + set; + } + + /// A union to really stress test our serialization. + /// stability: Experimental + [JsiiProperty(name: "secondLevel", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.SecondLevelStruct\"}]}}", isOverride: true)] + public object SecondLevel + { + get; + set; + } + + /// You don't have to pass this. + /// stability: Experimental + [JsiiProperty(name: "optional", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] + public string Optional + { + get; + set; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStructProxy.cs new file mode 100644 index 0000000000..ca13b0ee25 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStructProxy.cs @@ -0,0 +1,37 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiTypeProxy(nativeType: typeof(ITopLevelStruct), fullyQualifiedName: "jsii-calc.TopLevelStruct")] + internal sealed class TopLevelStructProxy : DeputyBase, ITopLevelStruct + { + private TopLevelStructProxy(ByRefValue reference): base(reference) + { + } + + /// This is a required field. + /// stability: Experimental + [JsiiProperty(name: "required", typeJson: "{\"primitive\":\"string\"}")] + public string Required + { + get => GetInstanceProperty(); + } + + /// A union to really stress test our serialization. + /// stability: Experimental + [JsiiProperty(name: "secondLevel", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.SecondLevelStruct\"}]}}")] + public object SecondLevel + { + get => GetInstanceProperty(); + } + + /// You don't have to pass this. + /// stability: Experimental + [JsiiProperty(name: "optional", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] + public string Optional + { + get => GetInstanceProperty(); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java index e9667124a3..f6dba455c2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java @@ -126,6 +126,7 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.ReferenceEnumFromScopedPackage": return software.amazon.jsii.tests.calculator.ReferenceEnumFromScopedPackage.class; case "jsii-calc.ReturnsPrivateImplementationOfInterface": return software.amazon.jsii.tests.calculator.ReturnsPrivateImplementationOfInterface.class; case "jsii-calc.RuntimeTypeChecking": return software.amazon.jsii.tests.calculator.RuntimeTypeChecking.class; + case "jsii-calc.SecondLevelStruct": return software.amazon.jsii.tests.calculator.SecondLevelStruct.class; case "jsii-calc.SingleInstanceTwoTypes": return software.amazon.jsii.tests.calculator.SingleInstanceTwoTypes.class; case "jsii-calc.SingletonInt": return software.amazon.jsii.tests.calculator.SingletonInt.class; case "jsii-calc.SingletonIntEnum": return software.amazon.jsii.tests.calculator.SingletonIntEnum.class; @@ -138,9 +139,11 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.Statics": return software.amazon.jsii.tests.calculator.Statics.class; case "jsii-calc.StringEnum": return software.amazon.jsii.tests.calculator.StringEnum.class; case "jsii-calc.StripInternal": return software.amazon.jsii.tests.calculator.StripInternal.class; + case "jsii-calc.StructPassing": return software.amazon.jsii.tests.calculator.StructPassing.class; case "jsii-calc.Sum": return software.amazon.jsii.tests.calculator.Sum.class; case "jsii-calc.SyncVirtualMethods": return software.amazon.jsii.tests.calculator.SyncVirtualMethods.class; case "jsii-calc.Thrower": return software.amazon.jsii.tests.calculator.Thrower.class; + case "jsii-calc.TopLevelStruct": return software.amazon.jsii.tests.calculator.TopLevelStruct.class; case "jsii-calc.UnaryOperation": return software.amazon.jsii.tests.calculator.UnaryOperation.class; case "jsii-calc.UnionProperties": return software.amazon.jsii.tests.calculator.UnionProperties.class; case "jsii-calc.UseBundledDependency": return software.amazon.jsii.tests.calculator.UseBundledDependency.class; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SecondLevelStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SecondLevelStruct.java new file mode 100644 index 0000000000..8539511a3c --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SecondLevelStruct.java @@ -0,0 +1,129 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +public interface SecondLevelStruct extends software.amazon.jsii.JsiiSerializable { + /** + * It's long and required. + * + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.String getDeeperRequiredProp(); + /** + * It's long, but you'll almost never pass it. + * + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.String getDeeperOptionalProp(); + + /** + * @return a {@link Builder} of {@link SecondLevelStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + static Builder builder() { + return new Builder(); + } + + /** + * A builder for {@link SecondLevelStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + final class Builder { + private java.lang.String _deeperRequiredProp; + @javax.annotation.Nullable + private java.lang.String _deeperOptionalProp; + + /** + * Sets the value of DeeperRequiredProp + * @param value It's long and required. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withDeeperRequiredProp(final java.lang.String value) { + this._deeperRequiredProp = java.util.Objects.requireNonNull(value, "deeperRequiredProp is required"); + return this; + } + /** + * Sets the value of DeeperOptionalProp + * @param value It's long, but you'll almost never pass it. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withDeeperOptionalProp(@javax.annotation.Nullable final java.lang.String value) { + this._deeperOptionalProp = value; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link SecondLevelStruct} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public SecondLevelStruct build() { + return new SecondLevelStruct() { + private final java.lang.String $deeperRequiredProp = java.util.Objects.requireNonNull(_deeperRequiredProp, "deeperRequiredProp is required"); + @javax.annotation.Nullable + private final java.lang.String $deeperOptionalProp = _deeperOptionalProp; + + @Override + public java.lang.String getDeeperRequiredProp() { + return this.$deeperRequiredProp; + } + + @Override + public java.lang.String getDeeperOptionalProp() { + return this.$deeperOptionalProp; + } + + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("deeperRequiredProp", om.valueToTree(this.getDeeperRequiredProp())); + if (this.getDeeperOptionalProp() != null) { + obj.set("deeperOptionalProp", om.valueToTree(this.getDeeperOptionalProp())); + } + return obj; + } + + }; + } + } + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.SecondLevelStruct { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + * It's long and required. + * + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public java.lang.String getDeeperRequiredProp() { + return this.jsiiGet("deeperRequiredProp", java.lang.String.class); + } + + /** + * It's long, but you'll almost never pass it. + * + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + @javax.annotation.Nullable + public java.lang.String getDeeperOptionalProp() { + return this.jsiiGet("deeperOptionalProp", java.lang.String.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StructPassing.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StructPassing.java new file mode 100644 index 0000000000..f2fdfe3193 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StructPassing.java @@ -0,0 +1,33 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.StructPassing") +public class StructPassing extends software.amazon.jsii.JsiiObject { + protected StructPassing(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + public StructPassing() { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public static java.lang.Number howManyVarArgsDidIPass(final java.lang.Number _positional, final java.util.List inputs) { + return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.jsii.tests.calculator.StructPassing.class, "howManyVarArgsDidIPass", java.lang.Number.class, new Object[] { java.util.Objects.requireNonNull(_positional, "_positional is required"), java.util.Objects.requireNonNull(inputs, "inputs is required") }); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public static software.amazon.jsii.tests.calculator.TopLevelStruct roundTrip(final java.lang.Number _positional, final software.amazon.jsii.tests.calculator.TopLevelStruct input) { + return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.jsii.tests.calculator.StructPassing.class, "roundTrip", software.amazon.jsii.tests.calculator.TopLevelStruct.class, new Object[] { java.util.Objects.requireNonNull(_positional, "_positional is required"), java.util.Objects.requireNonNull(input, "input is required") }); + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/TopLevelStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/TopLevelStruct.java new file mode 100644 index 0000000000..3294d387fa --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/TopLevelStruct.java @@ -0,0 +1,175 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +public interface TopLevelStruct extends software.amazon.jsii.JsiiSerializable { + /** + * This is a required field. + * + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.String getRequired(); + /** + * A union to really stress test our serialization. + * + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.Object getSecondLevel(); + /** + * You don't have to pass this. + * + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.String getOptional(); + + /** + * @return a {@link Builder} of {@link TopLevelStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + static Builder builder() { + return new Builder(); + } + + /** + * A builder for {@link TopLevelStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + final class Builder { + private java.lang.String _required; + private java.lang.Object _secondLevel; + @javax.annotation.Nullable + private java.lang.String _optional; + + /** + * Sets the value of Required + * @param value This is a required field. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withRequired(final java.lang.String value) { + this._required = java.util.Objects.requireNonNull(value, "required is required"); + return this; + } + /** + * Sets the value of SecondLevel + * @param value A union to really stress test our serialization. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withSecondLevel(final java.lang.Number value) { + this._secondLevel = java.util.Objects.requireNonNull(value, "secondLevel is required"); + return this; + } + /** + * Sets the value of SecondLevel + * @param value A union to really stress test our serialization. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withSecondLevel(final software.amazon.jsii.tests.calculator.SecondLevelStruct value) { + this._secondLevel = java.util.Objects.requireNonNull(value, "secondLevel is required"); + return this; + } + /** + * Sets the value of Optional + * @param value You don't have to pass this. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withOptional(@javax.annotation.Nullable final java.lang.String value) { + this._optional = value; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link TopLevelStruct} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public TopLevelStruct build() { + return new TopLevelStruct() { + private final java.lang.String $required = java.util.Objects.requireNonNull(_required, "required is required"); + private final java.lang.Object $secondLevel = java.util.Objects.requireNonNull(_secondLevel, "secondLevel is required"); + @javax.annotation.Nullable + private final java.lang.String $optional = _optional; + + @Override + public java.lang.String getRequired() { + return this.$required; + } + + @Override + public java.lang.Object getSecondLevel() { + return this.$secondLevel; + } + + @Override + public java.lang.String getOptional() { + return this.$optional; + } + + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("required", om.valueToTree(this.getRequired())); + obj.set("secondLevel", om.valueToTree(this.getSecondLevel())); + if (this.getOptional() != null) { + obj.set("optional", om.valueToTree(this.getOptional())); + } + return obj; + } + + }; + } + } + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.TopLevelStruct { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + * This is a required field. + * + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public java.lang.String getRequired() { + return this.jsiiGet("required", java.lang.String.class); + } + + /** + * A union to really stress test our serialization. + * + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public java.lang.Object getSecondLevel() { + return this.jsiiGet("secondLevel", java.lang.Object.class); + } + + /** + * You don't have to pass this. + * + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + @javax.annotation.Nullable + public java.lang.String getOptional() { + return this.jsiiGet("optional", java.lang.String.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py index 972b686561..3d46b5a351 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py @@ -15,8 +15,8 @@ __jsii_assembly__ = jsii.JSIIAssembly.load("jsii-calc", "0.13.4", __name__, "jsii-calc@0.13.4.jsii.tgz") class AbstractClassBase(metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.AbstractClassBase"): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -30,8 +30,8 @@ def __init__(self) -> None: @abc.abstractmethod def abstract_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -41,16 +41,16 @@ class _AbstractClassBaseProxy(AbstractClassBase): @jsii.member(jsii_name="abstractProperty") def abstract_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "abstractProperty") class AbstractClassReturner(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AbstractClassReturner"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(AbstractClassReturner, self, []) @@ -58,16 +58,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="giveMeAbstract") def give_me_abstract(self) -> "AbstractClass": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "giveMeAbstract", []) @jsii.member(jsii_name="giveMeInterface") def give_me_interface(self) -> "IInterfaceImplementedByAbstractClass": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "giveMeInterface", []) @@ -75,8 +75,8 @@ def give_me_interface(self) -> "IInterfaceImplementedByAbstractClass": @jsii.member(jsii_name="returnAbstractFromProperty") def return_abstract_from_property(self) -> "AbstractClassBase": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "returnAbstractFromProperty") @@ -87,8 +87,8 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): The setters will validate that the value set is of the expected type and throw otherwise. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(AllTypes, self, []) @@ -96,30 +96,28 @@ def __init__(self) -> None: @jsii.member(jsii_name="anyIn") def any_in(self, inp: typing.Any) -> None: """ - Arguments: - inp: - + :param inp: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "anyIn", [inp]) @jsii.member(jsii_name="anyOut") def any_out(self) -> typing.Any: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "anyOut", []) @jsii.member(jsii_name="enumMethod") def enum_method(self, value: "StringEnum") -> "StringEnum": """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "enumMethod", [value]) @@ -127,8 +125,8 @@ def enum_method(self, value: "StringEnum") -> "StringEnum": @jsii.member(jsii_name="enumPropertyValue") def enum_property_value(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "enumPropertyValue") @@ -136,8 +134,8 @@ def enum_property_value(self) -> jsii.Number: @jsii.member(jsii_name="anyArrayProperty") def any_array_property(self) -> typing.List[typing.Any]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "anyArrayProperty") @@ -149,8 +147,8 @@ def any_array_property(self, value: typing.List[typing.Any]): @jsii.member(jsii_name="anyMapProperty") def any_map_property(self) -> typing.Mapping[str,typing.Any]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "anyMapProperty") @@ -162,8 +160,8 @@ def any_map_property(self, value: typing.Mapping[str,typing.Any]): @jsii.member(jsii_name="anyProperty") def any_property(self) -> typing.Any: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "anyProperty") @@ -175,8 +173,8 @@ def any_property(self, value: typing.Any): @jsii.member(jsii_name="arrayProperty") def array_property(self) -> typing.List[str]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arrayProperty") @@ -188,8 +186,8 @@ def array_property(self, value: typing.List[str]): @jsii.member(jsii_name="booleanProperty") def boolean_property(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "booleanProperty") @@ -201,8 +199,8 @@ def boolean_property(self, value: bool): @jsii.member(jsii_name="dateProperty") def date_property(self) -> datetime.datetime: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "dateProperty") @@ -214,8 +212,8 @@ def date_property(self, value: datetime.datetime): @jsii.member(jsii_name="enumProperty") def enum_property(self) -> "AllTypesEnum": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "enumProperty") @@ -227,8 +225,8 @@ def enum_property(self, value: "AllTypesEnum"): @jsii.member(jsii_name="jsonProperty") def json_property(self) -> typing.Mapping[typing.Any, typing.Any]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "jsonProperty") @@ -240,8 +238,8 @@ def json_property(self, value: typing.Mapping[typing.Any, typing.Any]): @jsii.member(jsii_name="mapProperty") def map_property(self) -> typing.Mapping[str,scope.jsii_calc_lib.Number]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "mapProperty") @@ -253,8 +251,8 @@ def map_property(self, value: typing.Mapping[str,scope.jsii_calc_lib.Number]): @jsii.member(jsii_name="numberProperty") def number_property(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "numberProperty") @@ -266,8 +264,8 @@ def number_property(self, value: jsii.Number): @jsii.member(jsii_name="stringProperty") def string_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "stringProperty") @@ -279,8 +277,8 @@ def string_property(self, value: str): @jsii.member(jsii_name="unionArrayProperty") def union_array_property(self) -> typing.List[typing.Union[jsii.Number, scope.jsii_calc_lib.Value]]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unionArrayProperty") @@ -292,8 +290,8 @@ def union_array_property(self, value: typing.List[typing.Union[jsii.Number, scop @jsii.member(jsii_name="unionMapProperty") def union_map_property(self) -> typing.Mapping[str,typing.Union[str, jsii.Number, scope.jsii_calc_lib.Number]]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unionMapProperty") @@ -305,8 +303,8 @@ def union_map_property(self, value: typing.Mapping[str,typing.Union[str, jsii.Nu @jsii.member(jsii_name="unionProperty") def union_property(self) -> typing.Union[str, jsii.Number, "Multiply", scope.jsii_calc_lib.Number]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unionProperty") @@ -318,8 +316,8 @@ def union_property(self, value: typing.Union[str, jsii.Number, "Multiply", scope @jsii.member(jsii_name="unknownArrayProperty") def unknown_array_property(self) -> typing.List[typing.Any]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unknownArrayProperty") @@ -331,8 +329,8 @@ def unknown_array_property(self, value: typing.List[typing.Any]): @jsii.member(jsii_name="unknownMapProperty") def unknown_map_property(self) -> typing.Mapping[str,typing.Any]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unknownMapProperty") @@ -344,8 +342,8 @@ def unknown_map_property(self, value: typing.Mapping[str,typing.Any]): @jsii.member(jsii_name="unknownProperty") def unknown_property(self) -> typing.Any: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unknownProperty") @@ -357,8 +355,8 @@ def unknown_property(self, value: typing.Any): @jsii.member(jsii_name="optionalEnumValue") def optional_enum_value(self) -> typing.Optional["StringEnum"]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "optionalEnumValue") @@ -370,29 +368,29 @@ def optional_enum_value(self, value: typing.Optional["StringEnum"]): @jsii.enum(jsii_type="jsii-calc.AllTypesEnum") class AllTypesEnum(enum.Enum): """ - Stability: - experimental + stability + :stability: experimental """ MY_ENUM_VALUE = "MY_ENUM_VALUE" """ - Stability: - experimental + stability + :stability: experimental """ YOUR_ENUM_VALUE = "YOUR_ENUM_VALUE" """ - Stability: - experimental + stability + :stability: experimental """ THIS_IS_GREAT = "THIS_IS_GREAT" """ - Stability: - experimental + stability + :stability: experimental """ class AllowedMethodNames(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllowedMethodNames"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(AllowedMethodNames, self, []) @@ -400,12 +398,11 @@ def __init__(self) -> None: @jsii.member(jsii_name="getBar") def get_bar(self, _p1: str, _p2: jsii.Number) -> None: """ - Arguments: - _p1: - - _p2: - + :param _p1: - + :param _p2: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "getBar", [_p1, _p2]) @@ -413,24 +410,22 @@ def get_bar(self, _p1: str, _p2: jsii.Number) -> None: def get_foo(self, with_param: str) -> str: """getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. - Arguments: - with_param: - + :param with_param: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "getFoo", [with_param]) @jsii.member(jsii_name="setBar") def set_bar(self, _x: str, _y: jsii.Number, _z: bool) -> None: """ - Arguments: - _x: - - _y: - - _z: - + :param _x: - + :param _y: - + :param _z: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "setBar", [_x, _y, _z]) @@ -438,20 +433,19 @@ def set_bar(self, _x: str, _y: jsii.Number, _z: bool) -> None: def set_foo(self, _x: str, _y: jsii.Number) -> None: """setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. - Arguments: - _x: - - _y: - + :param _x: - + :param _y: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "setFoo", [_x, _y]) class AsyncVirtualMethods(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AsyncVirtualMethods"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(AsyncVirtualMethods, self, []) @@ -459,8 +453,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="callMe") def call_me(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "callMe", []) @@ -468,8 +462,8 @@ def call_me(self) -> jsii.Number: def call_me2(self) -> jsii.Number: """Just calls "overrideMeToo". - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "callMe2", []) @@ -481,43 +475,42 @@ def call_me_double_promise(self) -> jsii.Number: means that callbacks are not going to be available immediate, but only after an "immediates" cycle. - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "callMeDoublePromise", []) @jsii.member(jsii_name="dontOverrideMe") def dont_override_me(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "dontOverrideMe", []) @jsii.member(jsii_name="overrideMe") def override_me(self, mult: jsii.Number) -> jsii.Number: """ - Arguments: - mult: - + :param mult: - - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "overrideMe", [mult]) @jsii.member(jsii_name="overrideMeToo") def override_me_too(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "overrideMeToo", []) class AugmentableClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AugmentableClass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(AugmentableClass, self, []) @@ -525,16 +518,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="methodOne") def method_one(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "methodOne", []) @jsii.member(jsii_name="methodTwo") def method_two(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "methodTwo", []) @@ -543,8 +536,8 @@ def method_two(self) -> None: class BinaryOperation(scope.jsii_calc_lib.Operation, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.BinaryOperation"): """Represents an operation with two operands. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -553,12 +546,11 @@ def __jsii_proxy_class__(): def __init__(self, lhs: scope.jsii_calc_lib.Value, rhs: scope.jsii_calc_lib.Value) -> None: """Creates a BinaryOperation. - Arguments: - lhs: Left-hand side operand. - rhs: Right-hand side operand. + :param lhs: Left-hand side operand. + :param rhs: Right-hand side operand. - Stability: - experimental + stability + :stability: experimental """ jsii.create(BinaryOperation, self, [lhs, rhs]) @@ -566,8 +558,8 @@ def __init__(self, lhs: scope.jsii_calc_lib.Value, rhs: scope.jsii_calc_lib.Valu def hello(self) -> str: """Say hello! - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hello", []) @@ -576,8 +568,8 @@ def hello(self) -> str: def lhs(self) -> scope.jsii_calc_lib.Value: """Left-hand side operand. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "lhs") @@ -586,8 +578,8 @@ def lhs(self) -> scope.jsii_calc_lib.Value: def rhs(self) -> scope.jsii_calc_lib.Value: """Right-hand side operand. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "rhs") @@ -598,18 +590,17 @@ class _BinaryOperationProxy(BinaryOperation, jsii.proxy_for(scope.jsii_calc_lib. class Add(BinaryOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Add"): """The "+" binary operation. - Stability: - experimental + stability + :stability: experimental """ def __init__(self, lhs: scope.jsii_calc_lib.Value, rhs: scope.jsii_calc_lib.Value) -> None: """Creates a BinaryOperation. - Arguments: - lhs: Left-hand side operand. - rhs: Right-hand side operand. + :param lhs: Left-hand side operand. + :param rhs: Right-hand side operand. - Stability: - experimental + stability + :stability: experimental """ jsii.create(Add, self, [lhs, rhs]) @@ -617,8 +608,8 @@ def __init__(self, lhs: scope.jsii_calc_lib.Value, rhs: scope.jsii_calc_lib.Valu def to_string(self) -> str: """String representation of the value. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "toString", []) @@ -627,42 +618,63 @@ def to_string(self) -> str: def value(self) -> jsii.Number: """The value. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") -@jsii.data_type(jsii_type="jsii-calc.CalculatorProps", jsii_struct_bases=[]) -class CalculatorProps(jsii.compat.TypedDict, total=False): - """Properties for Calculator. +@jsii.data_type(jsii_type="jsii-calc.CalculatorProps", jsii_struct_bases=[], name_mapping={'initial_value': 'initialValue', 'maximum_value': 'maximumValue'}) +class CalculatorProps(): + def __init__(self, *, initial_value: typing.Optional[jsii.Number]=None, maximum_value: typing.Optional[jsii.Number]=None): + """Properties for Calculator. - Stability: - experimental - """ - initialValue: jsii.Number - """ - Stability: - experimental - """ + :param initial_value: + :param maximum_value: + + stability + :stability: experimental + """ + self._values = { + } + if initial_value is not None: self._values["initial_value"] = initial_value + if maximum_value is not None: self._values["maximum_value"] = maximum_value + + @property + def initial_value(self) -> typing.Optional[jsii.Number]: + """ + stability + :stability: experimental + """ + return self._values.get('initial_value') + + @property + def maximum_value(self) -> typing.Optional[jsii.Number]: + """ + stability + :stability: experimental + """ + return self._values.get('maximum_value') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'CalculatorProps(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - maximumValue: jsii.Number - """ - Stability: - experimental - """ class ClassWithDocs(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassWithDocs"): """This class has docs. The docs are great. They're a bunch of tags. - See: - https://aws.amazon.com/ - Stability: - stable + see + :see: https://aws.amazon.com/ customAttribute: - hasAValue + :customAttribute:: hasAValue Example:: function anExample() { @@ -674,8 +686,8 @@ def __init__(self) -> None: class ClassWithMutableObjectLiteralProperty(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassWithMutableObjectLiteralProperty"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ClassWithMutableObjectLiteralProperty, self, []) @@ -684,8 +696,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="mutableObject") def mutable_object(self) -> "IMutableObjectLiteral": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "mutableObject") @@ -696,24 +708,23 @@ def mutable_object(self, value: "IMutableObjectLiteral"): class ConstructorPassesThisOut(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ConstructorPassesThisOut"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, consumer: "PartiallyInitializedThisConsumer") -> None: """ - Arguments: - consumer: - + :param consumer: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(ConstructorPassesThisOut, self, [consumer]) class Constructors(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Constructors"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(Constructors, self, []) @@ -722,8 +733,8 @@ def __init__(self) -> None: @classmethod def hidden_interface(cls) -> "IPublicInterface": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "hiddenInterface", []) @@ -731,8 +742,8 @@ def hidden_interface(cls) -> "IPublicInterface": @classmethod def hidden_interfaces(cls) -> typing.List["IPublicInterface"]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "hiddenInterfaces", []) @@ -740,8 +751,8 @@ def hidden_interfaces(cls) -> typing.List["IPublicInterface"]: @classmethod def hidden_sub_interfaces(cls) -> typing.List["IPublicInterface"]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "hiddenSubInterfaces", []) @@ -749,8 +760,8 @@ def hidden_sub_interfaces(cls) -> typing.List["IPublicInterface"]: @classmethod def make_class(cls) -> "PublicClass": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "makeClass", []) @@ -758,8 +769,8 @@ def make_class(cls) -> "PublicClass": @classmethod def make_interface(cls) -> "IPublicInterface": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "makeInterface", []) @@ -767,8 +778,8 @@ def make_interface(cls) -> "IPublicInterface": @classmethod def make_interface2(cls) -> "IPublicInterface2": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "makeInterface2", []) @@ -776,16 +787,16 @@ def make_interface2(cls) -> "IPublicInterface2": @classmethod def make_interfaces(cls) -> typing.List["IPublicInterface"]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "makeInterfaces", []) class ConsumersOfThisCrazyTypeSystem(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ConsumersOfThisCrazyTypeSystem"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ConsumersOfThisCrazyTypeSystem, self, []) @@ -793,22 +804,20 @@ def __init__(self) -> None: @jsii.member(jsii_name="consumeAnotherPublicInterface") def consume_another_public_interface(self, obj: "IAnotherPublicInterface") -> str: """ - Arguments: - obj: - + :param obj: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "consumeAnotherPublicInterface", [obj]) @jsii.member(jsii_name="consumeNonInternalInterface") def consume_non_internal_interface(self, obj: "INonInternalInterface") -> typing.Any: """ - Arguments: - obj: - + :param obj: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "consumeNonInternalInterface", [obj]) @@ -816,61 +825,55 @@ def consume_non_internal_interface(self, obj: "INonInternalInterface") -> typing class DataRenderer(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DataRenderer"): """Verifies proper type handling through dynamic overrides. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ jsii.create(DataRenderer, self, []) @jsii.member(jsii_name="render") def render(self, *, anumber: jsii.Number, astring: str, first_optional: typing.Optional[typing.List[str]]=None) -> str: """ - Arguments: - data: - - anumber: An awesome number value. - astring: A string value. - first_optional: + :param data: - + :param anumber: An awesome number value. + :param astring: A string value. + :param first_optional: - Stability: - experimental + stability + :stability: experimental """ - data: scope.jsii_calc_lib.MyFirstStruct = {"anumber": anumber, "astring": astring} - - if first_optional is not None: - data["firstOptional"] = first_optional + data = scope.jsii_calc_lib.MyFirstStruct(anumber=anumber, astring=astring, first_optional=first_optional) return jsii.invoke(self, "render", [data]) @jsii.member(jsii_name="renderMap") def render_map(self, map: typing.Mapping[str,typing.Any]) -> str: """ - Arguments: - map: - + :param map: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "renderMap", [map]) class DefaultedConstructorArgument(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DefaultedConstructorArgument"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, arg1: typing.Optional[jsii.Number]=None, arg2: typing.Optional[str]=None, arg3: typing.Optional[datetime.datetime]=None) -> None: """ - Arguments: - arg1: - - arg2: - - arg3: - + :param arg1: - + :param arg2: - + :param arg3: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(DefaultedConstructorArgument, self, [arg1, arg2, arg3]) @@ -878,8 +881,8 @@ def __init__(self, arg1: typing.Optional[jsii.Number]=None, arg2: typing.Optiona @jsii.member(jsii_name="arg1") def arg1(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arg1") @@ -887,8 +890,8 @@ def arg1(self) -> jsii.Number: @jsii.member(jsii_name="arg3") def arg3(self) -> datetime.datetime: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arg3") @@ -896,42 +899,41 @@ def arg3(self) -> datetime.datetime: @jsii.member(jsii_name="arg2") def arg2(self) -> typing.Optional[str]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arg2") class DeprecatedClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DeprecatedClass"): """ - Deprecated: - a pretty boring class + deprecated + :deprecated: a pretty boring class - Stability: - deprecated + stability + :stability: deprecated """ def __init__(self, readonly_string: str, mutable_number: typing.Optional[jsii.Number]=None) -> None: """ - Arguments: - readonly_string: - - mutable_number: - + :param readonly_string: - + :param mutable_number: - - Deprecated: - this constructor is "just" okay + deprecated + :deprecated: this constructor is "just" okay - Stability: - deprecated + stability + :stability: deprecated """ jsii.create(DeprecatedClass, self, [readonly_string, mutable_number]) @jsii.member(jsii_name="method") def method(self) -> None: """ - Deprecated: - it was a bad idea + deprecated + :deprecated: it was a bad idea - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "method", []) @@ -939,11 +941,11 @@ def method(self) -> None: @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> str: """ - Deprecated: - this is not always "wazoo", be ready to be disappointed + deprecated + :deprecated: this is not always "wazoo", be ready to be disappointed - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "readonlyProperty") @@ -951,11 +953,11 @@ def readonly_property(self) -> str: @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: """ - Deprecated: - shouldn't have been mutable + deprecated + :deprecated: shouldn't have been mutable - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "mutableProperty") @@ -967,52 +969,71 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.enum(jsii_type="jsii-calc.DeprecatedEnum") class DeprecatedEnum(enum.Enum): """ - Deprecated: - your deprecated selection of bad options + deprecated + :deprecated: your deprecated selection of bad options - Stability: - deprecated + stability + :stability: deprecated """ OPTION_A = "OPTION_A" """ - Deprecated: - option A is not great + deprecated + :deprecated: option A is not great - Stability: - deprecated + stability + :stability: deprecated """ OPTION_B = "OPTION_B" """ - Deprecated: - option B is kinda bad, too + deprecated + :deprecated: option B is kinda bad, too - Stability: - deprecated + stability + :stability: deprecated """ -@jsii.data_type(jsii_type="jsii-calc.DeprecatedStruct", jsii_struct_bases=[]) -class DeprecatedStruct(jsii.compat.TypedDict): - """ - Deprecated: - it just wraps a string +@jsii.data_type(jsii_type="jsii-calc.DeprecatedStruct", jsii_struct_bases=[], name_mapping={'readonly_property': 'readonlyProperty'}) +class DeprecatedStruct(): + def __init__(self, *, readonly_property: str): + """ + :param readonly_property: - Stability: deprecated - """ - readonlyProperty: str - """ - Deprecated: - well, yeah + :deprecated: it just wraps a string - Stability: + stability + :stability: deprecated + """ + self._values = { + 'readonly_property': readonly_property, + } + + @property + def readonly_property(self) -> str: + """ deprecated - """ + :deprecated: well, yeah + + stability + :stability: deprecated + """ + return self._values.get('readonly_property') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'DeprecatedStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class DerivedClassHasNoProperties: class Base(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DerivedClassHasNoProperties.Base"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(DerivedClassHasNoProperties.Base, self, []) @@ -1021,8 +1042,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="prop") def prop(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "prop") @@ -1033,63 +1054,134 @@ def prop(self, value: str): class Derived(Base, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DerivedClassHasNoProperties.Derived"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(DerivedClassHasNoProperties.Derived, self, []) -@jsii.data_type_optionals(jsii_struct_bases=[scope.jsii_calc_lib.MyFirstStruct]) -class _DerivedStruct(scope.jsii_calc_lib.MyFirstStruct, jsii.compat.TypedDict, total=False): - anotherOptional: typing.Mapping[str,scope.jsii_calc_lib.Value] - """This is optional. +@jsii.data_type(jsii_type="jsii-calc.DerivedStruct", jsii_struct_bases=[scope.jsii_calc_lib.MyFirstStruct], name_mapping={'anumber': 'anumber', 'astring': 'astring', 'first_optional': 'firstOptional', 'another_required': 'anotherRequired', 'bool': 'bool', 'non_primitive': 'nonPrimitive', 'another_optional': 'anotherOptional', 'optional_any': 'optionalAny', 'optional_array': 'optionalArray'}) +class DerivedStruct(scope.jsii_calc_lib.MyFirstStruct): + def __init__(self, *, anumber: jsii.Number, astring: str, first_optional: typing.Optional[typing.List[str]]=None, another_required: datetime.datetime, bool: bool, non_primitive: "DoubleTrouble", another_optional: typing.Optional[typing.Mapping[str,scope.jsii_calc_lib.Value]]=None, optional_any: typing.Any=None, optional_array: typing.Optional[typing.List[str]]=None): + """A struct which derives from another struct. - Stability: - experimental - """ - optionalAny: typing.Any - """ - Stability: - experimental - """ - optionalArray: typing.List[str] - """ - Stability: - experimental - """ + :param anumber: An awesome number value. + :param astring: A string value. + :param first_optional: + :param another_required: + :param bool: + :param non_primitive: An example of a non primitive property. + :param another_optional: This is optional. + :param optional_any: + :param optional_array: + + stability + :stability: experimental + """ + self._values = { + 'anumber': anumber, + 'astring': astring, + 'another_required': another_required, + 'bool': bool, + 'non_primitive': non_primitive, + } + if first_optional is not None: self._values["first_optional"] = first_optional + if another_optional is not None: self._values["another_optional"] = another_optional + if optional_any is not None: self._values["optional_any"] = optional_any + if optional_array is not None: self._values["optional_array"] = optional_array -@jsii.data_type(jsii_type="jsii-calc.DerivedStruct", jsii_struct_bases=[_DerivedStruct]) -class DerivedStruct(_DerivedStruct): - """A struct which derives from another struct. + @property + def anumber(self) -> jsii.Number: + """An awesome number value. - Stability: - experimental - """ - anotherRequired: datetime.datetime - """ - Stability: - experimental - """ + stability + :stability: deprecated + """ + return self._values.get('anumber') - bool: bool - """ - Stability: - experimental - """ + @property + def astring(self) -> str: + """A string value. - nonPrimitive: "DoubleTrouble" - """An example of a non primitive property. + stability + :stability: deprecated + """ + return self._values.get('astring') + + @property + def first_optional(self) -> typing.Optional[typing.List[str]]: + """ + stability + :stability: deprecated + """ + return self._values.get('first_optional') + + @property + def another_required(self) -> datetime.datetime: + """ + stability + :stability: experimental + """ + return self._values.get('another_required') + + @property + def bool(self) -> bool: + """ + stability + :stability: experimental + """ + return self._values.get('bool') + + @property + def non_primitive(self) -> "DoubleTrouble": + """An example of a non primitive property. + + stability + :stability: experimental + """ + return self._values.get('non_primitive') + + @property + def another_optional(self) -> typing.Optional[typing.Mapping[str,scope.jsii_calc_lib.Value]]: + """This is optional. + + stability + :stability: experimental + """ + return self._values.get('another_optional') + + @property + def optional_any(self) -> typing.Any: + """ + stability + :stability: experimental + """ + return self._values.get('optional_any') + + @property + def optional_array(self) -> typing.Optional[typing.List[str]]: + """ + stability + :stability: experimental + """ + return self._values.get('optional_array') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'DerivedStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - Stability: - experimental - """ class DoNotOverridePrivates(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DoNotOverridePrivates"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(DoNotOverridePrivates, self, []) @@ -1097,27 +1189,26 @@ def __init__(self) -> None: @jsii.member(jsii_name="changePrivatePropertyValue") def change_private_property_value(self, new_value: str) -> None: """ - Arguments: - new_value: - + :param new_value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "changePrivatePropertyValue", [new_value]) @jsii.member(jsii_name="privateMethodValue") def private_method_value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "privateMethodValue", []) @jsii.member(jsii_name="privatePropertyValue") def private_property_value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "privatePropertyValue", []) @@ -1125,8 +1216,8 @@ def private_property_value(self) -> str: class DoNotRecognizeAnyAsOptional(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DoNotRecognizeAnyAsOptional"): """jsii#284: do not recognize "any" as an optional argument. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(DoNotRecognizeAnyAsOptional, self, []) @@ -1134,13 +1225,12 @@ def __init__(self) -> None: @jsii.member(jsii_name="method") def method(self, _required_any: typing.Any, _optional_any: typing.Any=None, _optional_string: typing.Optional[str]=None) -> None: """ - Arguments: - _required_any: - - _optional_any: - - _optional_string: - + :param _required_any: - + :param _optional_any: - + :param _optional_string: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "method", [_required_any, _optional_any, _optional_string]) @@ -1152,9 +1242,6 @@ class DocumentedClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DocumentedCl multiple lines and multiple paragraphs. Multiple paragraphs are separated by an empty line. - - Stability: - stable """ def __init__(self) -> None: jsii.create(DocumentedClass, self, []) @@ -1166,20 +1253,13 @@ def greet(self, *, name: typing.Optional[str]=None) -> jsii.Number: This will print out a friendly greeting intended for the indicated person. - Arguments: - greetee: The person to be greeted. - name: The name of the greetee. Default: world + :param greetee: The person to be greeted. + :param name: The name of the greetee. Default: world - Returns: - A number that everyone knows very well - - Stability: - stable + return + :return: A number that everyone knows very well """ - greetee: Greetee = {} - - if name is not None: - greetee["name"] = name + greetee = Greetee(name=name) return jsii.invoke(self, "greet", [greetee]) @@ -1187,16 +1267,16 @@ def greet(self, *, name: typing.Optional[str]=None) -> jsii.Number: def hola(self) -> None: """Say ¡Hola! - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hola", []) class DontComplainAboutVariadicAfterOptional(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DontComplainAboutVariadicAfterOptional"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(DontComplainAboutVariadicAfterOptional, self, []) @@ -1204,20 +1284,19 @@ def __init__(self) -> None: @jsii.member(jsii_name="optionalAndVariadic") def optional_and_variadic(self, optional: typing.Optional[str]=None, *things: str) -> str: """ - Arguments: - optional: - - things: - + :param optional: - + :param things: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "optionalAndVariadic", [optional, *things]) class EraseUndefinedHashValues(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.EraseUndefinedHashValues"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(EraseUndefinedHashValues, self, []) @@ -1230,12 +1309,11 @@ def does_key_exist(cls, opts: "EraseUndefinedHashValuesOptions", key: str) -> bo Used to check that undefined/null hash values are being erased when sending values from native code to JS. - Arguments: - opts: - - key: - + :param opts: - + :param key: - - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "doesKeyExist", [opts, key]) @@ -1244,8 +1322,8 @@ def does_key_exist(cls, opts: "EraseUndefinedHashValuesOptions", key: str) -> bo def prop1_is_null(cls) -> typing.Any: """We expect "prop1" to be erased. - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "prop1IsNull", []) @@ -1254,51 +1332,73 @@ def prop1_is_null(cls) -> typing.Any: def prop2_is_undefined(cls) -> typing.Any: """We expect "prop2" to be erased. - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "prop2IsUndefined", []) -@jsii.data_type(jsii_type="jsii-calc.EraseUndefinedHashValuesOptions", jsii_struct_bases=[]) -class EraseUndefinedHashValuesOptions(jsii.compat.TypedDict, total=False): - """ - Stability: - experimental - """ - option1: str - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.EraseUndefinedHashValuesOptions", jsii_struct_bases=[], name_mapping={'option1': 'option1', 'option2': 'option2'}) +class EraseUndefinedHashValuesOptions(): + def __init__(self, *, option1: typing.Optional[str]=None, option2: typing.Optional[str]=None): + """ + :param option1: + :param option2: + + stability + :stability: experimental + """ + self._values = { + } + if option1 is not None: self._values["option1"] = option1 + if option2 is not None: self._values["option2"] = option2 + + @property + def option1(self) -> typing.Optional[str]: + """ + stability + :stability: experimental + """ + return self._values.get('option1') + + @property + def option2(self) -> typing.Optional[str]: + """ + stability + :stability: experimental + """ + return self._values.get('option2') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'EraseUndefinedHashValuesOptions(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - option2: str - """ - Stability: - experimental - """ class ExperimentalClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ExperimentalClass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, readonly_string: str, mutable_number: typing.Optional[jsii.Number]=None) -> None: """ - Arguments: - readonly_string: - - mutable_number: - + :param readonly_string: - + :param mutable_number: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(ExperimentalClass, self, [readonly_string, mutable_number]) @jsii.member(jsii_name="method") def method(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "method", []) @@ -1306,8 +1406,8 @@ def method(self) -> None: @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "readonlyProperty") @@ -1315,8 +1415,8 @@ def readonly_property(self) -> str: @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "mutableProperty") @@ -1328,44 +1428,62 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.enum(jsii_type="jsii-calc.ExperimentalEnum") class ExperimentalEnum(enum.Enum): """ - Stability: - experimental + stability + :stability: experimental """ OPTION_A = "OPTION_A" """ - Stability: - experimental + stability + :stability: experimental """ OPTION_B = "OPTION_B" """ - Stability: - experimental + stability + :stability: experimental """ -@jsii.data_type(jsii_type="jsii-calc.ExperimentalStruct", jsii_struct_bases=[]) -class ExperimentalStruct(jsii.compat.TypedDict): - """ - Stability: - experimental - """ - readonlyProperty: str - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.ExperimentalStruct", jsii_struct_bases=[], name_mapping={'readonly_property': 'readonlyProperty'}) +class ExperimentalStruct(): + def __init__(self, *, readonly_property: str): + """ + :param readonly_property: + + stability + :stability: experimental + """ + self._values = { + 'readonly_property': readonly_property, + } + + @property + def readonly_property(self) -> str: + """ + stability + :stability: experimental + """ + return self._values.get('readonly_property') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'ExperimentalStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class ExportedBaseClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ExportedBaseClass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, success: bool) -> None: """ - Arguments: - success: - + :param success: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(ExportedBaseClass, self, [success]) @@ -1373,34 +1491,57 @@ def __init__(self, success: bool) -> None: @jsii.member(jsii_name="success") def success(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "success") -@jsii.data_type(jsii_type="jsii-calc.ExtendsInternalInterface", jsii_struct_bases=[]) -class ExtendsInternalInterface(jsii.compat.TypedDict): - """ - Stability: - experimental - """ - boom: bool - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.ExtendsInternalInterface", jsii_struct_bases=[], name_mapping={'boom': 'boom', 'prop': 'prop'}) +class ExtendsInternalInterface(): + def __init__(self, *, boom: bool, prop: str): + """ + :param boom: + :param prop: + + stability + :stability: experimental + """ + self._values = { + 'boom': boom, + 'prop': prop, + } + + @property + def boom(self) -> bool: + """ + stability + :stability: experimental + """ + return self._values.get('boom') + + @property + def prop(self) -> str: + """ + stability + :stability: experimental + """ + return self._values.get('prop') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'ExtendsInternalInterface(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - prop: str - """ - Stability: - experimental - """ class GiveMeStructs(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.GiveMeStructs"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(GiveMeStructs, self, []) @@ -1409,34 +1550,21 @@ def __init__(self) -> None: def derived_to_first(self, *, another_required: datetime.datetime, bool: bool, non_primitive: "DoubleTrouble", another_optional: typing.Optional[typing.Mapping[str,scope.jsii_calc_lib.Value]]=None, optional_any: typing.Any=None, optional_array: typing.Optional[typing.List[str]]=None, anumber: jsii.Number, astring: str, first_optional: typing.Optional[typing.List[str]]=None) -> scope.jsii_calc_lib.MyFirstStruct: """Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. - Arguments: - derived: - - another_required: - bool: - non_primitive: An example of a non primitive property. - another_optional: This is optional. - optional_any: - optional_array: - anumber: An awesome number value. - astring: A string value. - first_optional: + :param derived: - + :param another_required: + :param bool: + :param non_primitive: An example of a non primitive property. + :param another_optional: This is optional. + :param optional_any: + :param optional_array: + :param anumber: An awesome number value. + :param astring: A string value. + :param first_optional: - Stability: - experimental + stability + :stability: experimental """ - derived: DerivedStruct = {"anotherRequired": another_required, "bool": bool, "nonPrimitive": non_primitive, "anumber": anumber, "astring": astring} - - if another_optional is not None: - derived["anotherOptional"] = another_optional - - if optional_any is not None: - derived["optionalAny"] = optional_any - - if optional_array is not None: - derived["optionalArray"] = optional_array - - if first_optional is not None: - derived["firstOptional"] = first_optional + derived = DerivedStruct(another_required=another_required, bool=bool, non_primitive=non_primitive, another_optional=another_optional, optional_any=optional_any, optional_array=optional_array, anumber=anumber, astring=astring, first_optional=first_optional) return jsii.invoke(self, "derivedToFirst", [derived]) @@ -1444,34 +1572,21 @@ def derived_to_first(self, *, another_required: datetime.datetime, bool: bool, n def read_derived_non_primitive(self, *, another_required: datetime.datetime, bool: bool, non_primitive: "DoubleTrouble", another_optional: typing.Optional[typing.Mapping[str,scope.jsii_calc_lib.Value]]=None, optional_any: typing.Any=None, optional_array: typing.Optional[typing.List[str]]=None, anumber: jsii.Number, astring: str, first_optional: typing.Optional[typing.List[str]]=None) -> "DoubleTrouble": """Returns the boolean from a DerivedStruct struct. - Arguments: - derived: - - another_required: - bool: - non_primitive: An example of a non primitive property. - another_optional: This is optional. - optional_any: - optional_array: - anumber: An awesome number value. - astring: A string value. - first_optional: + :param derived: - + :param another_required: + :param bool: + :param non_primitive: An example of a non primitive property. + :param another_optional: This is optional. + :param optional_any: + :param optional_array: + :param anumber: An awesome number value. + :param astring: A string value. + :param first_optional: - Stability: - experimental + stability + :stability: experimental """ - derived: DerivedStruct = {"anotherRequired": another_required, "bool": bool, "nonPrimitive": non_primitive, "anumber": anumber, "astring": astring} - - if another_optional is not None: - derived["anotherOptional"] = another_optional - - if optional_any is not None: - derived["optionalAny"] = optional_any - - if optional_array is not None: - derived["optionalArray"] = optional_array - - if first_optional is not None: - derived["firstOptional"] = first_optional + derived = DerivedStruct(another_required=another_required, bool=bool, non_primitive=non_primitive, another_optional=another_optional, optional_any=optional_any, optional_array=optional_array, anumber=anumber, astring=astring, first_optional=first_optional) return jsii.invoke(self, "readDerivedNonPrimitive", [derived]) @@ -1479,19 +1594,15 @@ def read_derived_non_primitive(self, *, another_required: datetime.datetime, boo def read_first_number(self, *, anumber: jsii.Number, astring: str, first_optional: typing.Optional[typing.List[str]]=None) -> jsii.Number: """Returns the "anumber" from a MyFirstStruct struct; - Arguments: - first: - - anumber: An awesome number value. - astring: A string value. - first_optional: + :param first: - + :param anumber: An awesome number value. + :param astring: A string value. + :param first_optional: - Stability: - experimental + stability + :stability: experimental """ - first: scope.jsii_calc_lib.MyFirstStruct = {"anumber": anumber, "astring": astring} - - if first_optional is not None: - first["firstOptional"] = first_optional + first = scope.jsii_calc_lib.MyFirstStruct(anumber=anumber, astring=astring, first_optional=first_optional) return jsii.invoke(self, "readFirstNumber", [first]) @@ -1499,33 +1610,52 @@ def read_first_number(self, *, anumber: jsii.Number, astring: str, first_optiona @jsii.member(jsii_name="structLiteral") def struct_literal(self) -> scope.jsii_calc_lib.StructWithOnlyOptionals: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "structLiteral") -@jsii.data_type(jsii_type="jsii-calc.Greetee", jsii_struct_bases=[]) -class Greetee(jsii.compat.TypedDict, total=False): - """These are some arguments you can pass to a method. +@jsii.data_type(jsii_type="jsii-calc.Greetee", jsii_struct_bases=[], name_mapping={'name': 'name'}) +class Greetee(): + def __init__(self, *, name: typing.Optional[str]=None): + """These are some arguments you can pass to a method. - Stability: - experimental - """ - name: str - """The name of the greetee. + :param name: The name of the greetee. Default: world + + stability + :stability: experimental + """ + self._values = { + } + if name is not None: self._values["name"] = name + + @property + def name(self) -> typing.Optional[str]: + """The name of the greetee. - Default: - world + default + :default: world + + stability + :stability: experimental + """ + return self._values.get('name') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'Greetee(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - Stability: - experimental - """ class GreetingAugmenter(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.GreetingAugmenter"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(GreetingAugmenter, self, []) @@ -1533,11 +1663,10 @@ def __init__(self) -> None: @jsii.member(jsii_name="betterGreeting") def better_greeting(self, friendly: scope.jsii_calc_lib.IFriendly) -> str: """ - Arguments: - friendly: - + :param friendly: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "betterGreeting", [friendly]) @@ -1545,8 +1674,8 @@ def better_greeting(self, friendly: scope.jsii_calc_lib.IFriendly) -> str: @jsii.interface(jsii_type="jsii-calc.IAnotherPublicInterface") class IAnotherPublicInterface(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1556,8 +1685,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="a") def a(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -1568,16 +1697,16 @@ def a(self, value: str): class _IAnotherPublicInterfaceProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IAnotherPublicInterface" @property @jsii.member(jsii_name="a") def a(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "a") @@ -1589,11 +1718,11 @@ def a(self, value: str): @jsii.interface(jsii_type="jsii-calc.IDeprecatedInterface") class IDeprecatedInterface(jsii.compat.Protocol): """ - Deprecated: - useless interface + deprecated + :deprecated: useless interface - Stability: - deprecated + stability + :stability: deprecated """ @staticmethod def __jsii_proxy_class__(): @@ -1603,11 +1732,11 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: """ - Deprecated: - could be better + deprecated + :deprecated: could be better - Stability: - deprecated + stability + :stability: deprecated """ ... @@ -1618,33 +1747,33 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.member(jsii_name="method") def method(self) -> None: """ - Deprecated: - services no purpose + deprecated + :deprecated: services no purpose - Stability: - deprecated + stability + :stability: deprecated """ ... class _IDeprecatedInterfaceProxy(): """ - Deprecated: - useless interface + deprecated + :deprecated: useless interface - Stability: - deprecated + stability + :stability: deprecated """ __jsii_type__ = "jsii-calc.IDeprecatedInterface" @property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: """ - Deprecated: - could be better + deprecated + :deprecated: could be better - Stability: - deprecated + stability + :stability: deprecated """ return jsii.get(self, "mutableProperty") @@ -1655,11 +1784,11 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.member(jsii_name="method") def method(self) -> None: """ - Deprecated: - services no purpose + deprecated + :deprecated: services no purpose - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "method", []) @@ -1667,8 +1796,8 @@ def method(self) -> None: @jsii.interface(jsii_type="jsii-calc.IExperimentalInterface") class IExperimentalInterface(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1678,8 +1807,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -1690,24 +1819,24 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.member(jsii_name="method") def method(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IExperimentalInterfaceProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IExperimentalInterface" @property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "mutableProperty") @@ -1718,8 +1847,8 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.member(jsii_name="method") def method(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "method", []) @@ -1727,8 +1856,8 @@ def method(self) -> None: @jsii.interface(jsii_type="jsii-calc.IExtendsPrivateInterface") class IExtendsPrivateInterface(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1738,8 +1867,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="moreThings") def more_things(self) -> typing.List[str]: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -1747,8 +1876,8 @@ def more_things(self) -> typing.List[str]: @jsii.member(jsii_name="private") def private(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -1759,16 +1888,16 @@ def private(self, value: str): class _IExtendsPrivateInterfaceProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IExtendsPrivateInterface" @property @jsii.member(jsii_name="moreThings") def more_things(self) -> typing.List[str]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "moreThings") @@ -1776,8 +1905,8 @@ def more_things(self) -> typing.List[str]: @jsii.member(jsii_name="private") def private(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "private") @@ -1790,8 +1919,8 @@ def private(self, value: str): class IFriendlier(scope.jsii_calc_lib.IFriendly, jsii.compat.Protocol): """Even friendlier classes can implement this interface. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1801,8 +1930,8 @@ def __jsii_proxy_class__(): def farewell(self) -> str: """Say farewell. - Stability: - experimental + stability + :stability: experimental """ ... @@ -1810,11 +1939,11 @@ def farewell(self) -> str: def goodbye(self) -> str: """Say goodbye. - Returns: - A goodbye blessing. + return + :return: A goodbye blessing. - Stability: - experimental + stability + :stability: experimental """ ... @@ -1822,16 +1951,16 @@ def goodbye(self) -> str: class _IFriendlierProxy(jsii.proxy_for(scope.jsii_calc_lib.IFriendly)): """Even friendlier classes can implement this interface. - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IFriendlier" @jsii.member(jsii_name="farewell") def farewell(self) -> str: """Say farewell. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "farewell", []) @@ -1839,11 +1968,11 @@ def farewell(self) -> str: def goodbye(self) -> str: """Say goodbye. - Returns: - A goodbye blessing. + return + :return: A goodbye blessing. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "goodbye", []) @@ -1852,8 +1981,8 @@ def goodbye(self) -> str: class IInterfaceImplementedByAbstractClass(jsii.compat.Protocol): """awslabs/jsii#220 Abstract return type. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1863,8 +1992,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="propFromInterface") def prop_from_interface(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -1872,16 +2001,16 @@ def prop_from_interface(self) -> str: class _IInterfaceImplementedByAbstractClassProxy(): """awslabs/jsii#220 Abstract return type. - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceImplementedByAbstractClass" @property @jsii.member(jsii_name="propFromInterface") def prop_from_interface(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "propFromInterface") @@ -1889,8 +2018,8 @@ def prop_from_interface(self) -> str: @jsii.implements(IInterfaceImplementedByAbstractClass) class AbstractClass(AbstractClassBase, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.AbstractClass"): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1903,19 +2032,18 @@ def __init__(self) -> None: @abc.abstractmethod def abstract_method(self, name: str) -> str: """ - Arguments: - name: - + :param name: - - Stability: - experimental + stability + :stability: experimental """ ... @jsii.member(jsii_name="nonAbstractMethod") def non_abstract_method(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "nonAbstractMethod", []) @@ -1923,8 +2051,8 @@ def non_abstract_method(self) -> jsii.Number: @jsii.member(jsii_name="propFromInterface") def prop_from_interface(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "propFromInterface") @@ -1933,11 +2061,10 @@ class _AbstractClassProxy(AbstractClass, jsii.proxy_for(AbstractClassBase)): @jsii.member(jsii_name="abstractMethod") def abstract_method(self, name: str) -> str: """ - Arguments: - name: - + :param name: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "abstractMethod", [name]) @@ -1945,8 +2072,8 @@ def abstract_method(self, name: str) -> str: @jsii.interface(jsii_type="jsii-calc.IInterfaceWithInternal") class IInterfaceWithInternal(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1955,23 +2082,23 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="visible") def visible(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IInterfaceWithInternalProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceWithInternal" @jsii.member(jsii_name="visible") def visible(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "visible", []) @@ -1979,8 +2106,8 @@ def visible(self) -> None: @jsii.interface(jsii_type="jsii-calc.IInterfaceWithMethods") class IInterfaceWithMethods(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -1990,40 +2117,40 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="value") def value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @jsii.member(jsii_name="doThings") def do_things(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IInterfaceWithMethodsProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceWithMethods" @property @jsii.member(jsii_name="value") def value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") @jsii.member(jsii_name="doThings") def do_things(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "doThings", []) @@ -2032,8 +2159,8 @@ def do_things(self) -> None: class IInterfaceThatShouldNotBeADataType(IInterfaceWithMethods, jsii.compat.Protocol): """Even though this interface has only properties, it is disqualified from being a datatype because it inherits from an interface that is not a datatype. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2043,8 +2170,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="otherValue") def other_value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2052,16 +2179,16 @@ def other_value(self) -> str: class _IInterfaceThatShouldNotBeADataTypeProxy(jsii.proxy_for(IInterfaceWithMethods)): """Even though this interface has only properties, it is disqualified from being a datatype because it inherits from an interface that is not a datatype. - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceThatShouldNotBeADataType" @property @jsii.member(jsii_name="otherValue") def other_value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "otherValue") @@ -2070,8 +2197,8 @@ def other_value(self) -> str: class IInterfaceWithOptionalMethodArguments(jsii.compat.Protocol): """awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2080,12 +2207,11 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="hello") def hello(self, arg1: str, arg2: typing.Optional[jsii.Number]=None) -> None: """ - Arguments: - arg1: - - arg2: - + :param arg1: - + :param arg2: - - Stability: - experimental + stability + :stability: experimental """ ... @@ -2093,19 +2219,18 @@ def hello(self, arg1: str, arg2: typing.Optional[jsii.Number]=None) -> None: class _IInterfaceWithOptionalMethodArgumentsProxy(): """awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods. - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceWithOptionalMethodArguments" @jsii.member(jsii_name="hello") def hello(self, arg1: str, arg2: typing.Optional[jsii.Number]=None) -> None: """ - Arguments: - arg1: - - arg2: - + :param arg1: - + :param arg2: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hello", [arg1, arg2]) @@ -2113,8 +2238,8 @@ def hello(self, arg1: str, arg2: typing.Optional[jsii.Number]=None) -> None: @jsii.interface(jsii_type="jsii-calc.IInterfaceWithProperties") class IInterfaceWithProperties(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2124,8 +2249,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="readOnlyString") def read_only_string(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2133,8 +2258,8 @@ def read_only_string(self) -> str: @jsii.member(jsii_name="readWriteString") def read_write_string(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2145,16 +2270,16 @@ def read_write_string(self, value: str): class _IInterfaceWithPropertiesProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceWithProperties" @property @jsii.member(jsii_name="readOnlyString") def read_only_string(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "readOnlyString") @@ -2162,8 +2287,8 @@ def read_only_string(self) -> str: @jsii.member(jsii_name="readWriteString") def read_write_string(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "readWriteString") @@ -2176,19 +2301,18 @@ def read_write_string(self, value: str): class ClassWithPrivateConstructorAndAutomaticProperties(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties"): """Class that implements interface properties automatically, but using a private constructor. - Stability: - experimental + stability + :stability: experimental """ @jsii.member(jsii_name="create") @classmethod def create(cls, read_only_string: str, read_write_string: str) -> "ClassWithPrivateConstructorAndAutomaticProperties": """ - Arguments: - read_only_string: - - read_write_string: - + :param read_only_string: - + :param read_write_string: - - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "create", [read_only_string, read_write_string]) @@ -2196,8 +2320,8 @@ def create(cls, read_only_string: str, read_write_string: str) -> "ClassWithPriv @jsii.member(jsii_name="readOnlyString") def read_only_string(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "readOnlyString") @@ -2205,8 +2329,8 @@ def read_only_string(self) -> str: @jsii.member(jsii_name="readWriteString") def read_write_string(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "readWriteString") @@ -2218,8 +2342,8 @@ def read_write_string(self, value: str): @jsii.interface(jsii_type="jsii-calc.IInterfaceWithPropertiesExtension") class IInterfaceWithPropertiesExtension(IInterfaceWithProperties, jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2229,8 +2353,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="foo") def foo(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2241,16 +2365,16 @@ def foo(self, value: jsii.Number): class _IInterfaceWithPropertiesExtensionProxy(jsii.proxy_for(IInterfaceWithProperties)): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IInterfaceWithPropertiesExtension" @property @jsii.member(jsii_name="foo") def foo(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "foo") @@ -2262,8 +2386,8 @@ def foo(self, value: jsii.Number): @jsii.interface(jsii_type="jsii-calc.IJSII417PublicBaseOfBase") class IJSII417PublicBaseOfBase(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2273,40 +2397,40 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="hasRoot") def has_root(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ ... @jsii.member(jsii_name="foo") def foo(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IJSII417PublicBaseOfBaseProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IJSII417PublicBaseOfBase" @property @jsii.member(jsii_name="hasRoot") def has_root(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "hasRoot") @jsii.member(jsii_name="foo") def foo(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "foo", []) @@ -2314,8 +2438,8 @@ def foo(self) -> None: @jsii.interface(jsii_type="jsii-calc.IJSII417Derived") class IJSII417Derived(IJSII417PublicBaseOfBase, jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2325,56 +2449,56 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="property") def property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @jsii.member(jsii_name="bar") def bar(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... @jsii.member(jsii_name="baz") def baz(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IJSII417DerivedProxy(jsii.proxy_for(IJSII417PublicBaseOfBase)): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IJSII417Derived" @property @jsii.member(jsii_name="property") def property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "property") @jsii.member(jsii_name="bar") def bar(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "bar", []) @jsii.member(jsii_name="baz") def baz(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "baz", []) @@ -2382,8 +2506,8 @@ def baz(self) -> None: @jsii.interface(jsii_type="jsii-calc.IJsii487External") class IJsii487External(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2393,8 +2517,8 @@ def __jsii_proxy_class__(): class _IJsii487ExternalProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IJsii487External" pass @@ -2402,8 +2526,8 @@ class _IJsii487ExternalProxy(): @jsii.interface(jsii_type="jsii-calc.IJsii487External2") class IJsii487External2(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2413,8 +2537,8 @@ def __jsii_proxy_class__(): class _IJsii487External2Proxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IJsii487External2" pass @@ -2422,8 +2546,8 @@ class _IJsii487External2Proxy(): @jsii.interface(jsii_type="jsii-calc.IJsii496") class IJsii496(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2433,8 +2557,8 @@ def __jsii_proxy_class__(): class _IJsii496Proxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IJsii496" pass @@ -2442,8 +2566,8 @@ class _IJsii496Proxy(): @jsii.interface(jsii_type="jsii-calc.IMutableObjectLiteral") class IMutableObjectLiteral(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2453,8 +2577,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="value") def value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2465,16 +2589,16 @@ def value(self, value: str): class _IMutableObjectLiteralProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IMutableObjectLiteral" @property @jsii.member(jsii_name="value") def value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") @@ -2486,8 +2610,8 @@ def value(self, value: str): @jsii.interface(jsii_type="jsii-calc.INonInternalInterface") class INonInternalInterface(IAnotherPublicInterface, jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2497,8 +2621,8 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="b") def b(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2510,8 +2634,8 @@ def b(self, value: str): @jsii.member(jsii_name="c") def c(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -2522,16 +2646,16 @@ def c(self, value: str): class _INonInternalInterfaceProxy(jsii.proxy_for(IAnotherPublicInterface)): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.INonInternalInterface" @property @jsii.member(jsii_name="b") def b(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "b") @@ -2543,8 +2667,8 @@ def b(self, value: str): @jsii.member(jsii_name="c") def c(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "c") @@ -2556,8 +2680,8 @@ def c(self, value: str): @jsii.implements(INonInternalInterface) class ClassThatImplementsTheInternalInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassThatImplementsTheInternalInterface"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ClassThatImplementsTheInternalInterface, self, []) @@ -2566,8 +2690,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="a") def a(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "a") @@ -2579,8 +2703,8 @@ def a(self, value: str): @jsii.member(jsii_name="b") def b(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "b") @@ -2592,8 +2716,8 @@ def b(self, value: str): @jsii.member(jsii_name="c") def c(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "c") @@ -2605,8 +2729,8 @@ def c(self, value: str): @jsii.member(jsii_name="d") def d(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "d") @@ -2618,8 +2742,8 @@ def d(self, value: str): @jsii.implements(INonInternalInterface) class ClassThatImplementsThePrivateInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassThatImplementsThePrivateInterface"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ClassThatImplementsThePrivateInterface, self, []) @@ -2628,8 +2752,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="a") def a(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "a") @@ -2641,8 +2765,8 @@ def a(self, value: str): @jsii.member(jsii_name="b") def b(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "b") @@ -2654,8 +2778,8 @@ def b(self, value: str): @jsii.member(jsii_name="c") def c(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "c") @@ -2667,8 +2791,8 @@ def c(self, value: str): @jsii.member(jsii_name="e") def e(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "e") @@ -2680,8 +2804,8 @@ def e(self, value: str): @jsii.interface(jsii_type="jsii-calc.IPrivatelyImplemented") class IPrivatelyImplemented(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2691,24 +2815,24 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="success") def success(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IPrivatelyImplementedProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IPrivatelyImplemented" @property @jsii.member(jsii_name="success") def success(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "success") @@ -2716,8 +2840,8 @@ def success(self) -> bool: @jsii.interface(jsii_type="jsii-calc.IPublicInterface") class IPublicInterface(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2726,23 +2850,23 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="bye") def bye(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IPublicInterfaceProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IPublicInterface" @jsii.member(jsii_name="bye") def bye(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "bye", []) @@ -2750,8 +2874,8 @@ def bye(self) -> str: @jsii.interface(jsii_type="jsii-calc.IPublicInterface2") class IPublicInterface2(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2760,23 +2884,23 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="ciao") def ciao(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IPublicInterface2Proxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IPublicInterface2" @jsii.member(jsii_name="ciao") def ciao(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "ciao", []) @@ -2785,8 +2909,8 @@ def ciao(self) -> str: class IRandomNumberGenerator(jsii.compat.Protocol): """Generates random numbers. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2796,11 +2920,11 @@ def __jsii_proxy_class__(): def next(self) -> jsii.Number: """Returns another random number. - Returns: - A random number. + return + :return: A random number. - Stability: - experimental + stability + :stability: experimental """ ... @@ -2808,19 +2932,19 @@ def next(self) -> jsii.Number: class _IRandomNumberGeneratorProxy(): """Generates random numbers. - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IRandomNumberGenerator" @jsii.member(jsii_name="next") def next(self) -> jsii.Number: """Returns another random number. - Returns: - A random number. + return + :return: A random number. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "next", []) @@ -2828,8 +2952,8 @@ def next(self) -> jsii.Number: @jsii.interface(jsii_type="jsii-calc.IFriendlyRandomGenerator") class IFriendlyRandomGenerator(IRandomNumberGenerator, scope.jsii_calc_lib.IFriendly, jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2839,8 +2963,8 @@ def __jsii_proxy_class__(): class _IFriendlyRandomGeneratorProxy(jsii.proxy_for(IRandomNumberGenerator), jsii.proxy_for(scope.jsii_calc_lib.IFriendly)): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IFriendlyRandomGenerator" pass @@ -2848,8 +2972,8 @@ class _IFriendlyRandomGeneratorProxy(jsii.proxy_for(IRandomNumberGenerator), jsi @jsii.implements(IFriendlyRandomGenerator) class DoubleTrouble(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DoubleTrouble"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(DoubleTrouble, self, []) @@ -2858,8 +2982,8 @@ def __init__(self) -> None: def hello(self) -> str: """Say hello! - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hello", []) @@ -2867,8 +2991,8 @@ def hello(self) -> str: def next(self) -> jsii.Number: """Returns another random number. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "next", []) @@ -2876,8 +3000,8 @@ def next(self) -> jsii.Number: @jsii.interface(jsii_type="jsii-calc.IReturnsNumber") class IReturnsNumber(jsii.compat.Protocol): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -2887,50 +3011,46 @@ def __jsii_proxy_class__(): @jsii.member(jsii_name="numberProp") def number_prop(self) -> scope.jsii_calc_lib.Number: """ - Stability: - experimental + stability + :stability: experimental """ ... @jsii.member(jsii_name="obtainNumber") def obtain_number(self) -> scope.jsii_calc_lib.IDoublable: """ - Stability: - experimental + stability + :stability: experimental """ ... class _IReturnsNumberProxy(): """ - Stability: - experimental + stability + :stability: experimental """ __jsii_type__ = "jsii-calc.IReturnsNumber" @property @jsii.member(jsii_name="numberProp") def number_prop(self) -> scope.jsii_calc_lib.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "numberProp") @jsii.member(jsii_name="obtainNumber") def obtain_number(self) -> scope.jsii_calc_lib.IDoublable: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "obtainNumber", []) @jsii.interface(jsii_type="jsii-calc.IStableInterface") class IStableInterface(jsii.compat.Protocol): - """ - Stability: - stable - """ @staticmethod def __jsii_proxy_class__(): return _IStableInterfaceProxy @@ -2938,10 +3058,6 @@ def __jsii_proxy_class__(): @property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: - """ - Stability: - stable - """ ... @mutable_property.setter @@ -2950,26 +3066,14 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.member(jsii_name="method") def method(self) -> None: - """ - Stability: - stable - """ ... class _IStableInterfaceProxy(): - """ - Stability: - stable - """ __jsii_type__ = "jsii-calc.IStableInterface" @property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: - """ - Stability: - stable - """ return jsii.get(self, "mutableProperty") @mutable_property.setter @@ -2978,17 +3082,13 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.member(jsii_name="method") def method(self) -> None: - """ - Stability: - stable - """ return jsii.invoke(self, "method", []) class ImplementInternalInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ImplementInternalInterface"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ImplementInternalInterface, self, []) @@ -2997,8 +3097,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="prop") def prop(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "prop") @@ -3010,8 +3110,8 @@ def prop(self, value: str): @jsii.implements(IInterfaceWithInternal) class ImplementsInterfaceWithInternal(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ImplementsInterfaceWithInternal"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ImplementsInterfaceWithInternal, self, []) @@ -3019,16 +3119,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="visible") def visible(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "visible", []) class ImplementsInterfaceWithInternalSubclass(ImplementsInterfaceWithInternal, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ImplementsInterfaceWithInternalSubclass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ImplementsInterfaceWithInternalSubclass, self, []) @@ -3036,8 +3136,8 @@ def __init__(self) -> None: class ImplementsPrivateInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ImplementsPrivateInterface"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ImplementsPrivateInterface, self, []) @@ -3046,8 +3146,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="private") def private(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "private") @@ -3056,23 +3156,54 @@ def private(self, value: str): return jsii.set(self, "private", value) -@jsii.data_type(jsii_type="jsii-calc.ImplictBaseOfBase", jsii_struct_bases=[scope.jsii_calc_base.BaseProps]) -class ImplictBaseOfBase(scope.jsii_calc_base.BaseProps, jsii.compat.TypedDict): - """ - Stability: - experimental - """ - goo: datetime.datetime - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.ImplictBaseOfBase", jsii_struct_bases=[scope.jsii_calc_base.BaseProps], name_mapping={'foo': 'foo', 'bar': 'bar', 'goo': 'goo'}) +class ImplictBaseOfBase(scope.jsii_calc_base.BaseProps): + def __init__(self, *, foo: scope.jsii_calc_base_of_base.Very, bar: str, goo: datetime.datetime): + """ + :param foo: - + :param bar: - + :param goo: + + stability + :stability: experimental + """ + self._values = { + 'foo': foo, + 'bar': bar, + 'goo': goo, + } + + @property + def foo(self) -> scope.jsii_calc_base_of_base.Very: + return self._values.get('foo') + + @property + def bar(self) -> str: + return self._values.get('bar') + + @property + def goo(self) -> datetime.datetime: + """ + stability + :stability: experimental + """ + return self._values.get('goo') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'ImplictBaseOfBase(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class InterfaceInNamespaceIncludesClasses: class Foo(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.InterfaceInNamespaceIncludesClasses.Foo"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(InterfaceInNamespaceIncludesClasses.Foo, self, []) @@ -3081,8 +3212,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="bar") def bar(self) -> typing.Optional[str]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "bar") @@ -3091,37 +3222,75 @@ def bar(self, value: typing.Optional[str]): return jsii.set(self, "bar", value) - @jsii.data_type(jsii_type="jsii-calc.InterfaceInNamespaceIncludesClasses.Hello", jsii_struct_bases=[]) - class Hello(jsii.compat.TypedDict): - """ - Stability: - experimental - """ - foo: jsii.Number - """ - Stability: - experimental - """ + @jsii.data_type(jsii_type="jsii-calc.InterfaceInNamespaceIncludesClasses.Hello", jsii_struct_bases=[], name_mapping={'foo': 'foo'}) + class Hello(): + def __init__(self, *, foo: jsii.Number): + """ + :param foo: + + stability + :stability: experimental + """ + self._values = { + 'foo': foo, + } + + @property + def foo(self) -> jsii.Number: + """ + stability + :stability: experimental + """ + return self._values.get('foo') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'Hello(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class InterfaceInNamespaceOnlyInterface: - @jsii.data_type(jsii_type="jsii-calc.InterfaceInNamespaceOnlyInterface.Hello", jsii_struct_bases=[]) - class Hello(jsii.compat.TypedDict): - """ - Stability: - experimental - """ - foo: jsii.Number - """ - Stability: - experimental - """ + @jsii.data_type(jsii_type="jsii-calc.InterfaceInNamespaceOnlyInterface.Hello", jsii_struct_bases=[], name_mapping={'foo': 'foo'}) + class Hello(): + def __init__(self, *, foo: jsii.Number): + """ + :param foo: + + stability + :stability: experimental + """ + self._values = { + 'foo': foo, + } + + @property + def foo(self) -> jsii.Number: + """ + stability + :stability: experimental + """ + return self._values.get('foo') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'Hello(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class JSII417PublicBaseOfBase(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JSII417PublicBaseOfBase"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(JSII417PublicBaseOfBase, self, []) @@ -3130,16 +3299,16 @@ def __init__(self) -> None: @classmethod def make_instance(cls) -> "JSII417PublicBaseOfBase": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "makeInstance", []) @jsii.member(jsii_name="foo") def foo(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "foo", []) @@ -3147,40 +3316,39 @@ def foo(self) -> None: @jsii.member(jsii_name="hasRoot") def has_root(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "hasRoot") class JSII417Derived(JSII417PublicBaseOfBase, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JSII417Derived"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, property: str) -> None: """ - Arguments: - property: - + :param property: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(JSII417Derived, self, [property]) @jsii.member(jsii_name="bar") def bar(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "bar", []) @jsii.member(jsii_name="baz") def baz(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "baz", []) @@ -3188,16 +3356,16 @@ def baz(self) -> None: @jsii.member(jsii_name="property") def _property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "property") class JSObjectLiteralForInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JSObjectLiteralForInterface"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(JSObjectLiteralForInterface, self, []) @@ -3205,24 +3373,24 @@ def __init__(self) -> None: @jsii.member(jsii_name="giveMeFriendly") def give_me_friendly(self) -> scope.jsii_calc_lib.IFriendly: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "giveMeFriendly", []) @jsii.member(jsii_name="giveMeFriendlyGenerator") def give_me_friendly_generator(self) -> "IFriendlyRandomGenerator": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "giveMeFriendlyGenerator", []) class JSObjectLiteralToNative(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JSObjectLiteralToNative"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(JSObjectLiteralToNative, self, []) @@ -3230,16 +3398,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="returnLiteral") def return_literal(self) -> "JSObjectLiteralToNativeClass": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "returnLiteral", []) class JSObjectLiteralToNativeClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JSObjectLiteralToNativeClass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(JSObjectLiteralToNativeClass, self, []) @@ -3248,8 +3416,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="propA") def prop_a(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "propA") @@ -3261,8 +3429,8 @@ def prop_a(self, value: str): @jsii.member(jsii_name="propB") def prop_b(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "propB") @@ -3273,8 +3441,8 @@ def prop_b(self, value: jsii.Number): class JavaReservedWords(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JavaReservedWords"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(JavaReservedWords, self, []) @@ -3282,416 +3450,416 @@ def __init__(self) -> None: @jsii.member(jsii_name="abstract") def abstract(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "abstract", []) @jsii.member(jsii_name="assert") def assert_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "assert", []) @jsii.member(jsii_name="boolean") def boolean(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "boolean", []) @jsii.member(jsii_name="break") def break_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "break", []) @jsii.member(jsii_name="byte") def byte(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "byte", []) @jsii.member(jsii_name="case") def case(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "case", []) @jsii.member(jsii_name="catch") def catch(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "catch", []) @jsii.member(jsii_name="char") def char(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "char", []) @jsii.member(jsii_name="class") def class_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "class", []) @jsii.member(jsii_name="const") def const(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "const", []) @jsii.member(jsii_name="continue") def continue_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "continue", []) @jsii.member(jsii_name="default") def default(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "default", []) @jsii.member(jsii_name="do") def do(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "do", []) @jsii.member(jsii_name="double") def double(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "double", []) @jsii.member(jsii_name="else") def else_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "else", []) @jsii.member(jsii_name="enum") def enum(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "enum", []) @jsii.member(jsii_name="extends") def extends(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "extends", []) @jsii.member(jsii_name="false") def false(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "false", []) @jsii.member(jsii_name="final") def final(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "final", []) @jsii.member(jsii_name="finally") def finally_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "finally", []) @jsii.member(jsii_name="float") def float(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "float", []) @jsii.member(jsii_name="for") def for_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "for", []) @jsii.member(jsii_name="goto") def goto(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "goto", []) @jsii.member(jsii_name="if") def if_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "if", []) @jsii.member(jsii_name="implements") def implements(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "implements", []) @jsii.member(jsii_name="import") def import_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "import", []) @jsii.member(jsii_name="instanceof") def instanceof(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "instanceof", []) @jsii.member(jsii_name="int") def int(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "int", []) @jsii.member(jsii_name="interface") def interface(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "interface", []) @jsii.member(jsii_name="long") def long(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "long", []) @jsii.member(jsii_name="native") def native(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "native", []) @jsii.member(jsii_name="new") def new(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "new", []) @jsii.member(jsii_name="null") def null(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "null", []) @jsii.member(jsii_name="package") def package(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "package", []) @jsii.member(jsii_name="private") def private(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "private", []) @jsii.member(jsii_name="protected") def protected(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "protected", []) @jsii.member(jsii_name="public") def public(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "public", []) @jsii.member(jsii_name="return") def return_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "return", []) @jsii.member(jsii_name="short") def short(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "short", []) @jsii.member(jsii_name="static") def static(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "static", []) @jsii.member(jsii_name="strictfp") def strictfp(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "strictfp", []) @jsii.member(jsii_name="super") def super(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "super", []) @jsii.member(jsii_name="switch") def switch(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "switch", []) @jsii.member(jsii_name="synchronized") def synchronized(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "synchronized", []) @jsii.member(jsii_name="this") def this(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "this", []) @jsii.member(jsii_name="throw") def throw(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "throw", []) @jsii.member(jsii_name="throws") def throws(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "throws", []) @jsii.member(jsii_name="transient") def transient(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "transient", []) @jsii.member(jsii_name="true") def true(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "true", []) @jsii.member(jsii_name="try") def try_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "try", []) @jsii.member(jsii_name="void") def void(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "void", []) @jsii.member(jsii_name="volatile") def volatile(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "volatile", []) @@ -3699,8 +3867,8 @@ def volatile(self) -> None: @jsii.member(jsii_name="while") def while_(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "while") @@ -3712,8 +3880,8 @@ def while_(self, value: str): @jsii.implements(IJsii487External2, IJsii487External) class Jsii487Derived(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Jsii487Derived"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(Jsii487Derived, self, []) @@ -3722,8 +3890,8 @@ def __init__(self) -> None: @jsii.implements(IJsii496) class Jsii496Derived(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Jsii496Derived"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(Jsii496Derived, self, []) @@ -3732,8 +3900,8 @@ def __init__(self) -> None: class JsiiAgent(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JsiiAgent"): """Host runtime version should be set via JSII_AGENT. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(JsiiAgent, self, []) @@ -3743,104 +3911,138 @@ def __init__(self) -> None: def jsii_agent(cls) -> typing.Optional[str]: """Returns the value of the JSII_AGENT environment variable. - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "jsiiAgent") -@jsii.data_type(jsii_type="jsii-calc.LoadBalancedFargateServiceProps", jsii_struct_bases=[]) -class LoadBalancedFargateServiceProps(jsii.compat.TypedDict, total=False): - """jsii#298: show default values in sphinx documentation, and respect newlines. +@jsii.data_type(jsii_type="jsii-calc.LoadBalancedFargateServiceProps", jsii_struct_bases=[], name_mapping={'container_port': 'containerPort', 'cpu': 'cpu', 'memory_mib': 'memoryMiB', 'public_load_balancer': 'publicLoadBalancer', 'public_tasks': 'publicTasks'}) +class LoadBalancedFargateServiceProps(): + def __init__(self, *, container_port: typing.Optional[jsii.Number]=None, cpu: typing.Optional[str]=None, memory_mib: typing.Optional[str]=None, public_load_balancer: typing.Optional[bool]=None, public_tasks: typing.Optional[bool]=None): + """jsii#298: show default values in sphinx documentation, and respect newlines. - Stability: - experimental - """ - containerPort: jsii.Number - """The container port of the application load balancer attached to your Fargate service. + :param container_port: The container port of the application load balancer attached to your Fargate service. Corresponds to container port mapping. Default: 80 + :param cpu: The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. This default is set in the underlying FargateTaskDefinition construct. Default: 256 + :param memory_mib: The amount (in MiB) of memory used by the task. This field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter: 0.5GB, 1GB, 2GB - Available cpu values: 256 (.25 vCPU) 1GB, 2GB, 3GB, 4GB - Available cpu values: 512 (.5 vCPU) 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB - Available cpu values: 1024 (1 vCPU) Between 4GB and 16GB in 1GB increments - Available cpu values: 2048 (2 vCPU) Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) This default is set in the underlying FargateTaskDefinition construct. Default: 512 + :param public_load_balancer: Determines whether the Application Load Balancer will be internet-facing. Default: true + :param public_tasks: Determines whether your Fargate Service will be assigned a public IP address. Default: false - Corresponds to container port mapping. + stability + :stability: experimental + """ + self._values = { + } + if container_port is not None: self._values["container_port"] = container_port + if cpu is not None: self._values["cpu"] = cpu + if memory_mib is not None: self._values["memory_mib"] = memory_mib + if public_load_balancer is not None: self._values["public_load_balancer"] = public_load_balancer + if public_tasks is not None: self._values["public_tasks"] = public_tasks - Default: - 80 + @property + def container_port(self) -> typing.Optional[jsii.Number]: + """The container port of the application load balancer attached to your Fargate service. - Stability: - experimental - """ + Corresponds to container port mapping. - cpu: str - """The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. + default + :default: 80 - This default is set in the underlying FargateTaskDefinition construct. + stability + :stability: experimental + """ + return self._values.get('container_port') - Default: - 256 + @property + def cpu(self) -> typing.Optional[str]: + """The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. - Stability: - experimental - """ + This default is set in the underlying FargateTaskDefinition construct. - memoryMiB: str - """The amount (in MiB) of memory used by the task. + default + :default: 256 - This field is required and you must use one of the following values, which determines your range of valid values - for the cpu parameter: + stability + :stability: experimental + """ + return self._values.get('cpu') - 0.5GB, 1GB, 2GB - Available cpu values: 256 (.25 vCPU) + @property + def memory_mib(self) -> typing.Optional[str]: + """The amount (in MiB) of memory used by the task. - 1GB, 2GB, 3GB, 4GB - Available cpu values: 512 (.5 vCPU) + This field is required and you must use one of the following values, which determines your range of valid values + for the cpu parameter: - 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB - Available cpu values: 1024 (1 vCPU) + 0.5GB, 1GB, 2GB - Available cpu values: 256 (.25 vCPU) - Between 4GB and 16GB in 1GB increments - Available cpu values: 2048 (2 vCPU) + 1GB, 2GB, 3GB, 4GB - Available cpu values: 512 (.5 vCPU) - Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) + 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB - Available cpu values: 1024 (1 vCPU) - This default is set in the underlying FargateTaskDefinition construct. + Between 4GB and 16GB in 1GB increments - Available cpu values: 2048 (2 vCPU) - Default: - 512 + Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) - Stability: - experimental - """ + This default is set in the underlying FargateTaskDefinition construct. - publicLoadBalancer: bool - """Determines whether the Application Load Balancer will be internet-facing. + default + :default: 512 - Default: - true + stability + :stability: experimental + """ + return self._values.get('memory_mib') - Stability: - experimental - """ + @property + def public_load_balancer(self) -> typing.Optional[bool]: + """Determines whether the Application Load Balancer will be internet-facing. - publicTasks: bool - """Determines whether your Fargate Service will be assigned a public IP address. + default + :default: true - Default: - false + stability + :stability: experimental + """ + return self._values.get('public_load_balancer') + + @property + def public_tasks(self) -> typing.Optional[bool]: + """Determines whether your Fargate Service will be assigned a public IP address. + + default + :default: false + + stability + :stability: experimental + """ + return self._values.get('public_tasks') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'LoadBalancedFargateServiceProps(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) - Stability: - experimental - """ @jsii.implements(IFriendlier, IRandomNumberGenerator) class Multiply(BinaryOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Multiply"): """The "*" binary operation. - Stability: - experimental + stability + :stability: experimental """ def __init__(self, lhs: scope.jsii_calc_lib.Value, rhs: scope.jsii_calc_lib.Value) -> None: """Creates a BinaryOperation. - Arguments: - lhs: Left-hand side operand. - rhs: Right-hand side operand. + :param lhs: Left-hand side operand. + :param rhs: Right-hand side operand. - Stability: - experimental + stability + :stability: experimental """ jsii.create(Multiply, self, [lhs, rhs]) @@ -3848,8 +4050,8 @@ def __init__(self, lhs: scope.jsii_calc_lib.Value, rhs: scope.jsii_calc_lib.Valu def farewell(self) -> str: """Say farewell. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "farewell", []) @@ -3857,8 +4059,8 @@ def farewell(self) -> str: def goodbye(self) -> str: """Say goodbye. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "goodbye", []) @@ -3866,8 +4068,8 @@ def goodbye(self) -> str: def next(self) -> jsii.Number: """Returns another random number. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "next", []) @@ -3875,8 +4077,8 @@ def next(self) -> jsii.Number: def to_string(self) -> str: """String representation of the value. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "toString", []) @@ -3885,8 +4087,8 @@ def to_string(self) -> str: def value(self) -> jsii.Number: """The value. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") @@ -3894,8 +4096,8 @@ def value(self) -> jsii.Number: class NodeStandardLibrary(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.NodeStandardLibrary"): """Test fixture to verify that jsii modules can use the node standard library. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(NodeStandardLibrary, self, []) @@ -3904,11 +4106,11 @@ def __init__(self) -> None: def crypto_sha256(self) -> str: """Uses node.js "crypto" module to calculate sha256 of a string. - Returns: - "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" + return + :return: "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "cryptoSha256", []) @@ -3916,11 +4118,11 @@ def crypto_sha256(self) -> str: def fs_read_file(self) -> str: """Reads a local resource file (resource.txt) asynchronously. - Returns: - "Hello, resource!" + return + :return: "Hello, resource!" - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "fsReadFile", []) @@ -3928,11 +4130,11 @@ def fs_read_file(self) -> str: def fs_read_file_sync(self) -> str: """Sync version of fsReadFile. - Returns: - "Hello, resource! SYNC!" + return + :return: "Hello, resource! SYNC!" - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "fsReadFileSync", []) @@ -3941,8 +4143,8 @@ def fs_read_file_sync(self) -> str: def os_platform(self) -> str: """Returns the current os.platform() from the "os" node module. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "osPlatform") @@ -3950,54 +4152,48 @@ def os_platform(self) -> str: class NullShouldBeTreatedAsUndefined(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.NullShouldBeTreatedAsUndefined"): """jsii#282, aws-cdk#157: null should be treated as "undefined". - Stability: - experimental + stability + :stability: experimental """ def __init__(self, _param1: str, optional: typing.Any=None) -> None: """ - Arguments: - _param1: - - optional: - + :param _param1: - + :param optional: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(NullShouldBeTreatedAsUndefined, self, [_param1, optional]) @jsii.member(jsii_name="giveMeUndefined") def give_me_undefined(self, value: typing.Any=None) -> None: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "giveMeUndefined", [value]) @jsii.member(jsii_name="giveMeUndefinedInsideAnObject") def give_me_undefined_inside_an_object(self, *, array_with_three_elements_and_undefined_as_second_argument: typing.List[typing.Any], this_should_be_undefined: typing.Any=None) -> None: """ - Arguments: - input: - - array_with_three_elements_and_undefined_as_second_argument: - this_should_be_undefined: + :param input: - + :param array_with_three_elements_and_undefined_as_second_argument: + :param this_should_be_undefined: - Stability: - experimental + stability + :stability: experimental """ - input: NullShouldBeTreatedAsUndefinedData = {"arrayWithThreeElementsAndUndefinedAsSecondArgument": array_with_three_elements_and_undefined_as_second_argument} - - if this_should_be_undefined is not None: - input["thisShouldBeUndefined"] = this_should_be_undefined + input = NullShouldBeTreatedAsUndefinedData(array_with_three_elements_and_undefined_as_second_argument=array_with_three_elements_and_undefined_as_second_argument, this_should_be_undefined=this_should_be_undefined) return jsii.invoke(self, "giveMeUndefinedInsideAnObject", [input]) @jsii.member(jsii_name="verifyPropertyIsUndefined") def verify_property_is_undefined(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "verifyPropertyIsUndefined", []) @@ -4005,8 +4201,8 @@ def verify_property_is_undefined(self) -> None: @jsii.member(jsii_name="changeMeToUndefined") def change_me_to_undefined(self) -> typing.Optional[str]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "changeMeToUndefined") @@ -4015,58 +4211,77 @@ def change_me_to_undefined(self, value: typing.Optional[str]): return jsii.set(self, "changeMeToUndefined", value) -@jsii.data_type_optionals(jsii_struct_bases=[]) -class _NullShouldBeTreatedAsUndefinedData(jsii.compat.TypedDict, total=False): - thisShouldBeUndefined: typing.Any - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.NullShouldBeTreatedAsUndefinedData", jsii_struct_bases=[], name_mapping={'array_with_three_elements_and_undefined_as_second_argument': 'arrayWithThreeElementsAndUndefinedAsSecondArgument', 'this_should_be_undefined': 'thisShouldBeUndefined'}) +class NullShouldBeTreatedAsUndefinedData(): + def __init__(self, *, array_with_three_elements_and_undefined_as_second_argument: typing.List[typing.Any], this_should_be_undefined: typing.Any=None): + """ + :param array_with_three_elements_and_undefined_as_second_argument: + :param this_should_be_undefined: + + stability + :stability: experimental + """ + self._values = { + 'array_with_three_elements_and_undefined_as_second_argument': array_with_three_elements_and_undefined_as_second_argument, + } + if this_should_be_undefined is not None: self._values["this_should_be_undefined"] = this_should_be_undefined + + @property + def array_with_three_elements_and_undefined_as_second_argument(self) -> typing.List[typing.Any]: + """ + stability + :stability: experimental + """ + return self._values.get('array_with_three_elements_and_undefined_as_second_argument') + + @property + def this_should_be_undefined(self) -> typing.Any: + """ + stability + :stability: experimental + """ + return self._values.get('this_should_be_undefined') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'NullShouldBeTreatedAsUndefinedData(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) -@jsii.data_type(jsii_type="jsii-calc.NullShouldBeTreatedAsUndefinedData", jsii_struct_bases=[_NullShouldBeTreatedAsUndefinedData]) -class NullShouldBeTreatedAsUndefinedData(_NullShouldBeTreatedAsUndefinedData): - """ - Stability: - experimental - """ - arrayWithThreeElementsAndUndefinedAsSecondArgument: typing.List[typing.Any] - """ - Stability: - experimental - """ class NumberGenerator(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.NumberGenerator"): """This allows us to test that a reference can be stored for objects that implement interfaces. - Stability: - experimental + stability + :stability: experimental """ def __init__(self, generator: "IRandomNumberGenerator") -> None: """ - Arguments: - generator: - + :param generator: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(NumberGenerator, self, [generator]) @jsii.member(jsii_name="isSameGenerator") def is_same_generator(self, gen: "IRandomNumberGenerator") -> bool: """ - Arguments: - gen: - + :param gen: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "isSameGenerator", [gen]) @jsii.member(jsii_name="nextTimes100") def next_times100(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "nextTimes100", []) @@ -4074,8 +4289,8 @@ def next_times100(self) -> jsii.Number: @jsii.member(jsii_name="generator") def generator(self) -> "IRandomNumberGenerator": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "generator") @@ -4087,8 +4302,8 @@ def generator(self, value: "IRandomNumberGenerator"): class ObjectRefsInCollections(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ObjectRefsInCollections"): """Verify that object references can be passed inside collections. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ObjectRefsInCollections, self, []) @@ -4097,11 +4312,10 @@ def __init__(self) -> None: def sum_from_array(self, values: typing.List[scope.jsii_calc_lib.Value]) -> jsii.Number: """Returns the sum of all values. - Arguments: - values: - + :param values: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "sumFromArray", [values]) @@ -4109,11 +4323,10 @@ def sum_from_array(self, values: typing.List[scope.jsii_calc_lib.Value]) -> jsii def sum_from_map(self, values: typing.Mapping[str,scope.jsii_calc_lib.Value]) -> jsii.Number: """Returns the sum of all values in a map. - Arguments: - values: - + :param values: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "sumFromMap", [values]) @@ -4121,11 +4334,11 @@ def sum_from_map(self, values: typing.Mapping[str,scope.jsii_calc_lib.Value]) -> class Old(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Old"): """Old class. - Deprecated: - Use the new class + deprecated + :deprecated: Use the new class - Stability: - deprecated + stability + :stability: deprecated """ def __init__(self) -> None: jsii.create(Old, self, []) @@ -4134,26 +4347,25 @@ def __init__(self) -> None: def do_a_thing(self) -> None: """Doo wop that thing. - Stability: - deprecated + stability + :stability: deprecated """ return jsii.invoke(self, "doAThing", []) class OptionalConstructorArgument(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.OptionalConstructorArgument"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, arg1: jsii.Number, arg2: str, arg3: typing.Optional[datetime.datetime]=None) -> None: """ - Arguments: - arg1: - - arg2: - - arg3: - + :param arg1: - + :param arg2: - + :param arg3: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(OptionalConstructorArgument, self, [arg1, arg2, arg3]) @@ -4161,8 +4373,8 @@ def __init__(self, arg1: jsii.Number, arg2: str, arg3: typing.Optional[datetime. @jsii.member(jsii_name="arg1") def arg1(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arg1") @@ -4170,8 +4382,8 @@ def arg1(self) -> jsii.Number: @jsii.member(jsii_name="arg2") def arg2(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arg2") @@ -4179,42 +4391,57 @@ def arg2(self) -> str: @jsii.member(jsii_name="arg3") def arg3(self) -> typing.Optional[datetime.datetime]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "arg3") -@jsii.data_type(jsii_type="jsii-calc.OptionalStruct", jsii_struct_bases=[]) -class OptionalStruct(jsii.compat.TypedDict, total=False): - """ - Stability: - experimental - """ - field: str - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.OptionalStruct", jsii_struct_bases=[], name_mapping={'field': 'field'}) +class OptionalStruct(): + def __init__(self, *, field: typing.Optional[str]=None): + """ + :param field: + + stability + :stability: experimental + """ + self._values = { + } + if field is not None: self._values["field"] = field + + @property + def field(self) -> typing.Optional[str]: + """ + stability + :stability: experimental + """ + return self._values.get('field') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'OptionalStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class OptionalStructConsumer(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.OptionalStructConsumer"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, *, field: typing.Optional[str]=None) -> None: """ - Arguments: - optional_struct: - - field: + :param optional_struct: - + :param field: - Stability: - experimental + stability + :stability: experimental """ - optional_struct: OptionalStruct = {} - - if field is not None: - optional_struct["field"] = field + optional_struct = OptionalStruct(field=field) jsii.create(OptionalStructConsumer, self, [optional_struct]) @@ -4222,8 +4449,8 @@ def __init__(self, *, field: typing.Optional[str]=None) -> None: @jsii.member(jsii_name="parameterWasUndefined") def parameter_was_undefined(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "parameterWasUndefined") @@ -4231,16 +4458,16 @@ def parameter_was_undefined(self) -> bool: @jsii.member(jsii_name="fieldValue") def field_value(self) -> typing.Optional[str]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "fieldValue") class OverrideReturnsObject(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.OverrideReturnsObject"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(OverrideReturnsObject, self, []) @@ -4248,19 +4475,18 @@ def __init__(self) -> None: @jsii.member(jsii_name="test") def test(self, obj: "IReturnsNumber") -> jsii.Number: """ - Arguments: - obj: - + :param obj: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "test", [obj]) class PartiallyInitializedThisConsumer(metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.PartiallyInitializedThisConsumer"): """ - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -4273,13 +4499,12 @@ def __init__(self) -> None: @abc.abstractmethod def consume_partially_initialized_this(self, obj: "ConstructorPassesThisOut", dt: datetime.datetime, ev: "AllTypesEnum") -> str: """ - Arguments: - obj: - - dt: - - ev: - + :param obj: - + :param dt: - + :param ev: - - Stability: - experimental + stability + :stability: experimental """ ... @@ -4288,21 +4513,20 @@ class _PartiallyInitializedThisConsumerProxy(PartiallyInitializedThisConsumer): @jsii.member(jsii_name="consumePartiallyInitializedThis") def consume_partially_initialized_this(self, obj: "ConstructorPassesThisOut", dt: datetime.datetime, ev: "AllTypesEnum") -> str: """ - Arguments: - obj: - - dt: - - ev: - + :param obj: - + :param dt: - + :param ev: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "consumePartiallyInitializedThis", [obj, dt, ev]) class Polymorphism(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Polymorphism"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(Polymorphism, self, []) @@ -4310,19 +4534,18 @@ def __init__(self) -> None: @jsii.member(jsii_name="sayHello") def say_hello(self, friendly: scope.jsii_calc_lib.IFriendly) -> str: """ - Arguments: - friendly: - + :param friendly: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "sayHello", [friendly]) class PublicClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.PublicClass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(PublicClass, self, []) @@ -4330,8 +4553,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="hello") def hello(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hello", []) @@ -4339,8 +4562,8 @@ def hello(self) -> None: @jsii.implements(IPublicInterface2) class InbetweenClass(PublicClass, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.InbetweenClass"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(InbetweenClass, self, []) @@ -4348,16 +4571,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="ciao") def ciao(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "ciao", []) class PythonReservedWords(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.PythonReservedWords"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(PythonReservedWords, self, []) @@ -4365,256 +4588,256 @@ def __init__(self) -> None: @jsii.member(jsii_name="and") def and_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "and", []) @jsii.member(jsii_name="as") def as_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "as", []) @jsii.member(jsii_name="assert") def assert_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "assert", []) @jsii.member(jsii_name="async") def async_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "async", []) @jsii.member(jsii_name="await") def await_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "await", []) @jsii.member(jsii_name="break") def break_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "break", []) @jsii.member(jsii_name="class") def class_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "class", []) @jsii.member(jsii_name="continue") def continue_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "continue", []) @jsii.member(jsii_name="def") def def_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "def", []) @jsii.member(jsii_name="del") def del_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "del", []) @jsii.member(jsii_name="elif") def elif_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "elif", []) @jsii.member(jsii_name="else") def else_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "else", []) @jsii.member(jsii_name="except") def except_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "except", []) @jsii.member(jsii_name="finally") def finally_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "finally", []) @jsii.member(jsii_name="for") def for_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "for", []) @jsii.member(jsii_name="from") def from_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "from", []) @jsii.member(jsii_name="global") def global_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "global", []) @jsii.member(jsii_name="if") def if_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "if", []) @jsii.member(jsii_name="import") def import_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "import", []) @jsii.member(jsii_name="in") def in_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "in", []) @jsii.member(jsii_name="is") def is_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "is", []) @jsii.member(jsii_name="lambda") def lambda_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "lambda", []) @jsii.member(jsii_name="nonlocal") def nonlocal_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "nonlocal", []) @jsii.member(jsii_name="not") def not_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "not", []) @jsii.member(jsii_name="or") def or_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "or", []) @jsii.member(jsii_name="pass") def pass_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "pass", []) @jsii.member(jsii_name="raise") def raise_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "raise", []) @jsii.member(jsii_name="return") def return_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "return", []) @jsii.member(jsii_name="try") def try_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "try", []) @jsii.member(jsii_name="while") def while_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "while", []) @jsii.member(jsii_name="with") def with_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "with", []) @jsii.member(jsii_name="yield") def yield_(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "yield", []) @@ -4622,8 +4845,8 @@ def yield_(self) -> None: class ReferenceEnumFromScopedPackage(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ReferenceEnumFromScopedPackage"): """See awslabs/jsii#138. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ReferenceEnumFromScopedPackage, self, []) @@ -4631,19 +4854,18 @@ def __init__(self) -> None: @jsii.member(jsii_name="loadFoo") def load_foo(self) -> typing.Optional[scope.jsii_calc_lib.EnumFromScopedModule]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "loadFoo", []) @jsii.member(jsii_name="saveFoo") def save_foo(self, value: scope.jsii_calc_lib.EnumFromScopedModule) -> None: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "saveFoo", [value]) @@ -4651,8 +4873,8 @@ def save_foo(self, value: scope.jsii_calc_lib.EnumFromScopedModule) -> None: @jsii.member(jsii_name="foo") def foo(self) -> typing.Optional[scope.jsii_calc_lib.EnumFromScopedModule]: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "foo") @@ -4664,13 +4886,13 @@ def foo(self, value: typing.Optional[scope.jsii_calc_lib.EnumFromScopedModule]): class ReturnsPrivateImplementationOfInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ReturnsPrivateImplementationOfInterface"): """Helps ensure the JSII kernel & runtime cooperate correctly when an un-exported instance of a class is returned with a declared type that is an exported interface, and the instance inherits from an exported class. - Returns: - an instance of an un-exported class that extends ``ExportedBaseClass``, declared as ``IPrivatelyImplemented``. + return + :return: an instance of an un-exported class that extends ``ExportedBaseClass``, declared as ``IPrivatelyImplemented``. - See: - https://github.com/awslabs/jsii/issues/320 - Stability: - experimental + see + :see: https://github.com/awslabs/jsii/issues/320 + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(ReturnsPrivateImplementationOfInterface, self, []) @@ -4679,16 +4901,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="privateImplementation") def private_implementation(self) -> "IPrivatelyImplemented": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "privateImplementation") class RuntimeTypeChecking(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.RuntimeTypeChecking"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(RuntimeTypeChecking, self, []) @@ -4696,24 +4918,22 @@ def __init__(self) -> None: @jsii.member(jsii_name="methodWithDefaultedArguments") def method_with_defaulted_arguments(self, arg1: typing.Optional[jsii.Number]=None, arg2: typing.Optional[str]=None, arg3: typing.Optional[datetime.datetime]=None) -> None: """ - Arguments: - arg1: - - arg2: - - arg3: - + :param arg1: - + :param arg2: - + :param arg3: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "methodWithDefaultedArguments", [arg1, arg2, arg3]) @jsii.member(jsii_name="methodWithOptionalAnyArgument") def method_with_optional_any_argument(self, arg: typing.Any=None) -> None: """ - Arguments: - arg: - + :param arg: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "methodWithOptionalAnyArgument", [arg]) @@ -4721,17 +4941,59 @@ def method_with_optional_any_argument(self, arg: typing.Any=None) -> None: def method_with_optional_arguments(self, arg1: jsii.Number, arg2: str, arg3: typing.Optional[datetime.datetime]=None) -> None: """Used to verify verification of number of method arguments. - Arguments: - arg1: - - arg2: - - arg3: - + :param arg1: - + :param arg2: - + :param arg3: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "methodWithOptionalArguments", [arg1, arg2, arg3]) +@jsii.data_type(jsii_type="jsii-calc.SecondLevelStruct", jsii_struct_bases=[], name_mapping={'deeper_required_prop': 'deeperRequiredProp', 'deeper_optional_prop': 'deeperOptionalProp'}) +class SecondLevelStruct(): + def __init__(self, *, deeper_required_prop: str, deeper_optional_prop: typing.Optional[str]=None): + """ + :param deeper_required_prop: It's long and required. + :param deeper_optional_prop: It's long, but you'll almost never pass it. + + stability + :stability: experimental + """ + self._values = { + 'deeper_required_prop': deeper_required_prop, + } + if deeper_optional_prop is not None: self._values["deeper_optional_prop"] = deeper_optional_prop + + @property + def deeper_required_prop(self) -> str: + """It's long and required. + + stability + :stability: experimental + """ + return self._values.get('deeper_required_prop') + + @property + def deeper_optional_prop(self) -> typing.Optional[str]: + """It's long, but you'll almost never pass it. + + stability + :stability: experimental + """ + return self._values.get('deeper_optional_prop') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'SecondLevelStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + + class SingleInstanceTwoTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.SingleInstanceTwoTypes"): """Test that a single instance can be returned under two different FQNs. @@ -4739,8 +5001,8 @@ class SingleInstanceTwoTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Singl object. Unfortunately, this will break object equality, but if we didn't do this it would break runtime type checks in the JVM or CLR. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(SingleInstanceTwoTypes, self, []) @@ -4748,16 +5010,16 @@ def __init__(self) -> None: @jsii.member(jsii_name="interface1") def interface1(self) -> "InbetweenClass": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "interface1", []) @jsii.member(jsii_name="interface2") def interface2(self) -> "IPublicInterface": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "interface2", []) @@ -4767,17 +5029,16 @@ class SingletonInt(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.SingletonInt"): https://github.com/awslabs/jsii/issues/231 - Stability: - experimental + stability + :stability: experimental """ @jsii.member(jsii_name="isSingletonInt") def is_singleton_int(self, value: jsii.Number) -> bool: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "isSingletonInt", [value]) @@ -4786,14 +5047,14 @@ def is_singleton_int(self, value: jsii.Number) -> bool: class SingletonIntEnum(enum.Enum): """A singleton integer. - Stability: - experimental + stability + :stability: experimental """ SINGLETON_INT = "SINGLETON_INT" """Elite! - Stability: - experimental + stability + :stability: experimental """ class SingletonString(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.SingletonString"): @@ -4801,17 +5062,16 @@ class SingletonString(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.SingletonStr https://github.com/awslabs/jsii/issues/231 - Stability: - experimental + stability + :stability: experimental """ @jsii.member(jsii_name="isSingletonString") def is_singleton_string(self, value: str) -> bool: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "isSingletonString", [value]) @@ -4820,56 +5080,36 @@ def is_singleton_string(self, value: str) -> bool: class SingletonStringEnum(enum.Enum): """A singleton string. - Stability: - experimental + stability + :stability: experimental """ SINGLETON_STRING = "SINGLETON_STRING" """1337. - Stability: - experimental + stability + :stability: experimental """ class StableClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StableClass"): - """ - Stability: - stable - """ def __init__(self, readonly_string: str, mutable_number: typing.Optional[jsii.Number]=None) -> None: """ - Arguments: - readonly_string: - - mutable_number: - - - Stability: - stable + :param readonly_string: - + :param mutable_number: - """ jsii.create(StableClass, self, [readonly_string, mutable_number]) @jsii.member(jsii_name="method") def method(self) -> None: - """ - Stability: - stable - """ return jsii.invoke(self, "method", []) @property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> str: - """ - Stability: - stable - """ return jsii.get(self, "readonlyProperty") @property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: - """ - Stability: - stable - """ return jsii.get(self, "mutableProperty") @mutable_property.setter @@ -4879,47 +5119,47 @@ def mutable_property(self, value: typing.Optional[jsii.Number]): @jsii.enum(jsii_type="jsii-calc.StableEnum") class StableEnum(enum.Enum): - """ - Stability: - stable - """ OPTION_A = "OPTION_A" - """ - Stability: - stable - """ OPTION_B = "OPTION_B" - """ - Stability: - stable - """ -@jsii.data_type(jsii_type="jsii-calc.StableStruct", jsii_struct_bases=[]) -class StableStruct(jsii.compat.TypedDict): - """ - Stability: - stable - """ - readonlyProperty: str - """ - Stability: - stable - """ +@jsii.data_type(jsii_type="jsii-calc.StableStruct", jsii_struct_bases=[], name_mapping={'readonly_property': 'readonlyProperty'}) +class StableStruct(): + def __init__(self, *, readonly_property: str): + """ + :param readonly_property: + """ + self._values = { + 'readonly_property': readonly_property, + } + + @property + def readonly_property(self) -> str: + return self._values.get('readonly_property') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'StableStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + class StaticContext(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StaticContext"): """This is used to validate the ability to use ``this`` from within a static context. https://github.com/awslabs/aws-cdk/issues/2304 - Stability: - experimental + stability + :stability: experimental """ @jsii.member(jsii_name="canAccessStaticContext") @classmethod def can_access_static_context(cls) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "canAccessStaticContext", []) @@ -4927,8 +5167,8 @@ def can_access_static_context(cls) -> bool: @jsii.member(jsii_name="staticVariable") def static_variable(cls) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "staticVariable") @@ -4939,16 +5179,15 @@ def static_variable(cls, value: bool): class Statics(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Statics"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, value: str) -> None: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(Statics, self, [value]) @@ -4957,19 +5196,18 @@ def __init__(self, value: str) -> None: def static_method(cls, name: str) -> str: """Jsdocs for static method. - Arguments: - name: The name of the person to say hello to. + :param name: The name of the person to say hello to. - Stability: - experimental + stability + :stability: experimental """ return jsii.sinvoke(cls, "staticMethod", [name]) @jsii.member(jsii_name="justMethod") def just_method(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "justMethod", []) @@ -4978,8 +5216,8 @@ def just_method(self) -> str: def BAR(cls) -> jsii.Number: """Constants may also use all-caps. - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "BAR") @@ -4987,8 +5225,8 @@ def BAR(cls) -> jsii.Number: @jsii.member(jsii_name="ConstObj") def CONST_OBJ(cls) -> "DoubleTrouble": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "ConstObj") @@ -4997,8 +5235,8 @@ def CONST_OBJ(cls) -> "DoubleTrouble": def FOO(cls) -> str: """Jsdocs for static property. - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "Foo") @@ -5007,8 +5245,8 @@ def FOO(cls) -> str: def ZOO_BAR(cls) -> typing.Mapping[str,str]: """Constants can also use camelCase. - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "zooBar") @@ -5017,8 +5255,8 @@ def ZOO_BAR(cls) -> typing.Mapping[str,str]: def instance(cls) -> "Statics": """Jsdocs for static getter. Jsdocs for static setter. - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "instance") @@ -5030,8 +5268,8 @@ def instance(cls, value: "Statics"): @jsii.member(jsii_name="nonConstStatic") def non_const_static(cls) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.sget(cls, "nonConstStatic") @@ -5043,8 +5281,8 @@ def non_const_static(cls, value: jsii.Number): @jsii.member(jsii_name="value") def value(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") @@ -5052,29 +5290,29 @@ def value(self) -> str: @jsii.enum(jsii_type="jsii-calc.StringEnum") class StringEnum(enum.Enum): """ - Stability: - experimental + stability + :stability: experimental """ A = "A" """ - Stability: - experimental + stability + :stability: experimental """ B = "B" """ - Stability: - experimental + stability + :stability: experimental """ C = "C" """ - Stability: - experimental + stability + :stability: experimental """ class StripInternal(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StripInternal"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(StripInternal, self, []) @@ -5083,8 +5321,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="youSeeMe") def you_see_me(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "youSeeMe") @@ -5093,10 +5331,48 @@ def you_see_me(self, value: str): return jsii.set(self, "youSeeMe", value) +class StructPassing(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StructPassing"): + """ + stability + :stability: experimental + """ + def __init__(self) -> None: + jsii.create(StructPassing, self, []) + + @jsii.member(jsii_name="howManyVarArgsDidIPass") + @classmethod + def how_many_var_args_did_i_pass(cls, _positional: jsii.Number, inputs: typing.List["TopLevelStruct"]) -> jsii.Number: + """ + :param _positional: - + :param inputs: - + + stability + :stability: experimental + """ + return jsii.sinvoke(cls, "howManyVarArgsDidIPass", [_positional, inputs]) + + @jsii.member(jsii_name="roundTrip") + @classmethod + def round_trip(cls, _positional: jsii.Number, *, required: str, second_level: typing.Union[jsii.Number, "SecondLevelStruct"], optional: typing.Optional[str]=None) -> "TopLevelStruct": + """ + :param _positional: - + :param input: - + :param required: This is a required field. + :param second_level: A union to really stress test our serialization. + :param optional: You don't have to pass this. + + stability + :stability: experimental + """ + input = TopLevelStruct(required=required, second_level=second_level, optional=optional) + + return jsii.sinvoke(cls, "roundTrip", [_positional, input]) + + class SyncVirtualMethods(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.SyncVirtualMethods"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(SyncVirtualMethods, self, []) @@ -5104,92 +5380,88 @@ def __init__(self) -> None: @jsii.member(jsii_name="callerIsAsync") def caller_is_async(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "callerIsAsync", []) @jsii.member(jsii_name="callerIsMethod") def caller_is_method(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "callerIsMethod", []) @jsii.member(jsii_name="modifyOtherProperty") def modify_other_property(self, value: str) -> None: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "modifyOtherProperty", [value]) @jsii.member(jsii_name="modifyValueOfTheProperty") def modify_value_of_the_property(self, value: str) -> None: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "modifyValueOfTheProperty", [value]) @jsii.member(jsii_name="readA") def read_a(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "readA", []) @jsii.member(jsii_name="retrieveOtherProperty") def retrieve_other_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "retrieveOtherProperty", []) @jsii.member(jsii_name="retrieveReadOnlyProperty") def retrieve_read_only_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "retrieveReadOnlyProperty", []) @jsii.member(jsii_name="retrieveValueOfTheProperty") def retrieve_value_of_the_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "retrieveValueOfTheProperty", []) @jsii.member(jsii_name="virtualMethod") def virtual_method(self, n: jsii.Number) -> jsii.Number: """ - Arguments: - n: - + :param n: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "virtualMethod", [n]) @jsii.member(jsii_name="writeA") def write_a(self, value: jsii.Number) -> None: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "writeA", [value]) @@ -5197,8 +5469,8 @@ def write_a(self, value: jsii.Number) -> None: @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "readonlyProperty") @@ -5206,8 +5478,8 @@ def readonly_property(self) -> str: @jsii.member(jsii_name="a") def a(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "a") @@ -5219,8 +5491,8 @@ def a(self, value: jsii.Number): @jsii.member(jsii_name="callerIsProperty") def caller_is_property(self) -> jsii.Number: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "callerIsProperty") @@ -5232,8 +5504,8 @@ def caller_is_property(self, value: jsii.Number): @jsii.member(jsii_name="otherProperty") def other_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "otherProperty") @@ -5245,8 +5517,8 @@ def other_property(self, value: str): @jsii.member(jsii_name="theProperty") def the_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "theProperty") @@ -5258,8 +5530,8 @@ def the_property(self, value: str): @jsii.member(jsii_name="valueOfOtherProperty") def value_of_other_property(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "valueOfOtherProperty") @@ -5270,8 +5542,8 @@ def value_of_other_property(self, value: str): class Thrower(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Thrower"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(Thrower, self, []) @@ -5279,17 +5551,71 @@ def __init__(self) -> None: @jsii.member(jsii_name="throwError") def throw_error(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "throwError", []) +@jsii.data_type(jsii_type="jsii-calc.TopLevelStruct", jsii_struct_bases=[], name_mapping={'required': 'required', 'second_level': 'secondLevel', 'optional': 'optional'}) +class TopLevelStruct(): + def __init__(self, *, required: str, second_level: typing.Union[jsii.Number, "SecondLevelStruct"], optional: typing.Optional[str]=None): + """ + :param required: This is a required field. + :param second_level: A union to really stress test our serialization. + :param optional: You don't have to pass this. + + stability + :stability: experimental + """ + self._values = { + 'required': required, + 'second_level': second_level, + } + if optional is not None: self._values["optional"] = optional + + @property + def required(self) -> str: + """This is a required field. + + stability + :stability: experimental + """ + return self._values.get('required') + + @property + def second_level(self) -> typing.Union[jsii.Number, "SecondLevelStruct"]: + """A union to really stress test our serialization. + + stability + :stability: experimental + """ + return self._values.get('second_level') + + @property + def optional(self) -> typing.Optional[str]: + """You don't have to pass this. + + stability + :stability: experimental + """ + return self._values.get('optional') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'TopLevelStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + + class UnaryOperation(scope.jsii_calc_lib.Operation, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.UnaryOperation"): """An operation on a single operand. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -5297,11 +5623,10 @@ def __jsii_proxy_class__(): def __init__(self, operand: scope.jsii_calc_lib.Value) -> None: """ - Arguments: - operand: - + :param operand: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(UnaryOperation, self, [operand]) @@ -5309,8 +5634,8 @@ def __init__(self, operand: scope.jsii_calc_lib.Value) -> None: @jsii.member(jsii_name="operand") def operand(self) -> scope.jsii_calc_lib.Value: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "operand") @@ -5322,16 +5647,15 @@ class _UnaryOperationProxy(UnaryOperation, jsii.proxy_for(scope.jsii_calc_lib.Op class Negate(UnaryOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Negate"): """The negation operation ("-value"). - Stability: - experimental + stability + :stability: experimental """ def __init__(self, operand: scope.jsii_calc_lib.Value) -> None: """ - Arguments: - operand: - + :param operand: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(Negate, self, [operand]) @@ -5339,8 +5663,8 @@ def __init__(self, operand: scope.jsii_calc_lib.Value) -> None: def farewell(self) -> str: """Say farewell. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "farewell", []) @@ -5348,8 +5672,8 @@ def farewell(self) -> str: def goodbye(self) -> str: """Say goodbye. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "goodbye", []) @@ -5357,8 +5681,8 @@ def goodbye(self) -> str: def hello(self) -> str: """Say hello! - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hello", []) @@ -5366,8 +5690,8 @@ def hello(self) -> str: def to_string(self) -> str: """String representation of the value. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "toString", []) @@ -5376,36 +5700,57 @@ def to_string(self) -> str: def value(self) -> jsii.Number: """The value. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") -@jsii.data_type_optionals(jsii_struct_bases=[]) -class _UnionProperties(jsii.compat.TypedDict, total=False): - foo: typing.Union[str, jsii.Number] - """ - Stability: - experimental - """ +@jsii.data_type(jsii_type="jsii-calc.UnionProperties", jsii_struct_bases=[], name_mapping={'bar': 'bar', 'foo': 'foo'}) +class UnionProperties(): + def __init__(self, *, bar: typing.Union[str, jsii.Number, "AllTypes"], foo: typing.Optional[typing.Union[typing.Optional[str], typing.Optional[jsii.Number]]]=None): + """ + :param bar: + :param foo: + + stability + :stability: experimental + """ + self._values = { + 'bar': bar, + } + if foo is not None: self._values["foo"] = foo + + @property + def bar(self) -> typing.Union[str, jsii.Number, "AllTypes"]: + """ + stability + :stability: experimental + """ + return self._values.get('bar') + + @property + def foo(self) -> typing.Optional[typing.Union[typing.Optional[str], typing.Optional[jsii.Number]]]: + """ + stability + :stability: experimental + """ + return self._values.get('foo') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'UnionProperties(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) -@jsii.data_type(jsii_type="jsii-calc.UnionProperties", jsii_struct_bases=[_UnionProperties]) -class UnionProperties(_UnionProperties): - """ - Stability: - experimental - """ - bar: typing.Union[str, jsii.Number, "AllTypes"] - """ - Stability: - experimental - """ class UseBundledDependency(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.UseBundledDependency"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(UseBundledDependency, self, []) @@ -5413,8 +5758,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="value") def value(self) -> typing.Any: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "value", []) @@ -5422,8 +5767,8 @@ def value(self) -> typing.Any: class UseCalcBase(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.UseCalcBase"): """Depend on a type from jsii-calc-base as a test for awslabs/jsii#128. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(UseCalcBase, self, []) @@ -5431,54 +5776,51 @@ def __init__(self) -> None: @jsii.member(jsii_name="hello") def hello(self) -> scope.jsii_calc_base.Base: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "hello", []) class UsesInterfaceWithProperties(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.UsesInterfaceWithProperties"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, obj: "IInterfaceWithProperties") -> None: """ - Arguments: - obj: - + :param obj: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(UsesInterfaceWithProperties, self, [obj]) @jsii.member(jsii_name="justRead") def just_read(self) -> str: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "justRead", []) @jsii.member(jsii_name="readStringAndNumber") def read_string_and_number(self, ext: "IInterfaceWithPropertiesExtension") -> str: """ - Arguments: - ext: - + :param ext: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "readStringAndNumber", [ext]) @jsii.member(jsii_name="writeAndRead") def write_and_read(self, value: str) -> str: """ - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "writeAndRead", [value]) @@ -5486,44 +5828,42 @@ def write_and_read(self, value: str) -> str: @jsii.member(jsii_name="obj") def obj(self) -> "IInterfaceWithProperties": """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "obj") class VariadicMethod(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.VariadicMethod"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self, *prefix: jsii.Number) -> None: """ - Arguments: - prefix: a prefix that will be use for all values returned by ``#asArray``. + :param prefix: a prefix that will be use for all values returned by ``#asArray``. - Stability: - experimental + stability + :stability: experimental """ jsii.create(VariadicMethod, self, [*prefix]) @jsii.member(jsii_name="asArray") def as_array(self, first: jsii.Number, *others: jsii.Number) -> typing.List[jsii.Number]: """ - Arguments: - first: the first element of the array to be returned (after the ``prefix`` provided at construction time). - others: other elements to be included in the array. + :param first: the first element of the array to be returned (after the ``prefix`` provided at construction time). + :param others: other elements to be included in the array. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "asArray", [first, *others]) class VirtualMethodPlayground(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.VirtualMethodPlayground"): """ - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: jsii.create(VirtualMethodPlayground, self, []) @@ -5531,55 +5871,50 @@ def __init__(self) -> None: @jsii.member(jsii_name="overrideMeAsync") def override_me_async(self, index: jsii.Number) -> jsii.Number: """ - Arguments: - index: - + :param index: - - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "overrideMeAsync", [index]) @jsii.member(jsii_name="overrideMeSync") def override_me_sync(self, index: jsii.Number) -> jsii.Number: """ - Arguments: - index: - + :param index: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "overrideMeSync", [index]) @jsii.member(jsii_name="parallelSumAsync") def parallel_sum_async(self, count: jsii.Number) -> jsii.Number: """ - Arguments: - count: - + :param count: - - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "parallelSumAsync", [count]) @jsii.member(jsii_name="serialSumAsync") def serial_sum_async(self, count: jsii.Number) -> jsii.Number: """ - Arguments: - count: - + :param count: - - Stability: - experimental + stability + :stability: experimental """ return jsii.ainvoke(self, "serialSumAsync", [count]) @jsii.member(jsii_name="sumSync") def sum_sync(self, count: jsii.Number) -> jsii.Number: """ - Arguments: - count: - + :param count: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "sumSync", [count]) @@ -5591,8 +5926,8 @@ class VoidCallback(metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.VoidCa - Invoke ``callMe`` - Verify that ``methodWasCalled`` is ``true``. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -5604,8 +5939,8 @@ def __init__(self) -> None: @jsii.member(jsii_name="callMe") def call_me(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "callMe", []) @@ -5613,8 +5948,8 @@ def call_me(self) -> None: @abc.abstractmethod def _override_me(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ ... @@ -5622,8 +5957,8 @@ def _override_me(self) -> None: @jsii.member(jsii_name="methodWasCalled") def method_was_called(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "methodWasCalled") @@ -5632,8 +5967,8 @@ class _VoidCallbackProxy(VoidCallback): @jsii.member(jsii_name="overrideMe") def _override_me(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "overrideMe", []) @@ -5641,16 +5976,15 @@ def _override_me(self) -> None: class WithPrivatePropertyInConstructor(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.WithPrivatePropertyInConstructor"): """Verifies that private property declarations in constructor arguments are hidden. - Stability: - experimental + stability + :stability: experimental """ def __init__(self, private_field: typing.Optional[str]=None) -> None: """ - Arguments: - private_field: - + :param private_field: - - Stability: - experimental + stability + :stability: experimental """ jsii.create(WithPrivatePropertyInConstructor, self, [private_field]) @@ -5658,8 +5992,8 @@ def __init__(self, private_field: typing.Optional[str]=None) -> None: @jsii.member(jsii_name="success") def success(self) -> bool: """ - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "success") @@ -5668,8 +6002,8 @@ class composition: class CompositeOperation(scope.jsii_calc_lib.Operation, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.composition.CompositeOperation"): """Abstract operation composed from an expression of other operations. - Stability: - experimental + stability + :stability: experimental """ @staticmethod def __jsii_proxy_class__(): @@ -5682,8 +6016,8 @@ def __init__(self) -> None: def to_string(self) -> str: """String representation of the value. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "toString", []) @@ -5693,8 +6027,8 @@ def to_string(self) -> str: def expression(self) -> scope.jsii_calc_lib.Value: """The expression that this operation consists of. Must be implemented by derived classes. - Stability: - experimental + stability + :stability: experimental """ ... @@ -5703,8 +6037,8 @@ def expression(self) -> scope.jsii_calc_lib.Value: def value(self) -> jsii.Number: """The value. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "value") @@ -5713,8 +6047,8 @@ def value(self) -> jsii.Number: def decoration_postfixes(self) -> typing.List[str]: """A set of postfixes to include in a decorated .toString(). - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "decorationPostfixes") @@ -5727,8 +6061,8 @@ def decoration_postfixes(self, value: typing.List[str]): def decoration_prefixes(self) -> typing.List[str]: """A set of prefixes to include in a decorated .toString(). - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "decorationPrefixes") @@ -5741,8 +6075,8 @@ def decoration_prefixes(self, value: typing.List[str]): def string_style(self) -> "CompositionStringStyle": """The .toString() style. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "stringStyle") @@ -5754,20 +6088,20 @@ def string_style(self, value: "CompositionStringStyle"): class CompositionStringStyle(enum.Enum): """Style of .toString() output for CompositeOperation. - Stability: - experimental + stability + :stability: experimental """ NORMAL = "NORMAL" """Normal string expression. - Stability: - experimental + stability + :stability: experimental """ DECORATED = "DECORATED" """Decorated string expression. - Stability: - experimental + stability + :stability: experimental """ @@ -5777,8 +6111,8 @@ class _CompositeOperationProxy(CompositeOperation, jsii.proxy_for(scope.jsii_cal def expression(self) -> scope.jsii_calc_lib.Value: """The expression that this operation consists of. Must be implemented by derived classes. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "expression") @@ -5787,27 +6121,20 @@ def expression(self) -> scope.jsii_calc_lib.Value: class Calculator(composition.CompositeOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Calculator"): """A calculator which maintains a current value and allows adding operations. - Stability: - experimental + stability + :stability: experimental """ def __init__(self, *, initial_value: typing.Optional[jsii.Number]=None, maximum_value: typing.Optional[jsii.Number]=None) -> None: """Creates a Calculator object. - Arguments: - props: Initialization properties. - initial_value: - maximum_value: + :param props: Initialization properties. + :param initial_value: + :param maximum_value: - Stability: - experimental + stability + :stability: experimental """ - props: CalculatorProps = {} - - if initial_value is not None: - props["initialValue"] = initial_value - - if maximum_value is not None: - props["maximumValue"] = maximum_value + props = CalculatorProps(initial_value=initial_value, maximum_value=maximum_value) jsii.create(Calculator, self, [props]) @@ -5815,11 +6142,10 @@ def __init__(self, *, initial_value: typing.Optional[jsii.Number]=None, maximum_ def add(self, value: jsii.Number) -> None: """Adds a number to the current value. - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "add", [value]) @@ -5827,11 +6153,10 @@ def add(self, value: jsii.Number) -> None: def mul(self, value: jsii.Number) -> None: """Multiplies the current value by a number. - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "mul", [value]) @@ -5839,8 +6164,8 @@ def mul(self, value: jsii.Number) -> None: def neg(self) -> None: """Negates the current value. - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "neg", []) @@ -5848,11 +6173,10 @@ def neg(self) -> None: def pow(self, value: jsii.Number) -> None: """Raises the current value by a power. - Arguments: - value: - + :param value: - - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "pow", [value]) @@ -5860,8 +6184,8 @@ def pow(self, value: jsii.Number) -> None: def read_union_value(self) -> jsii.Number: """Returns teh value of the union property (if defined). - Stability: - experimental + stability + :stability: experimental """ return jsii.invoke(self, "readUnionValue", []) @@ -5870,8 +6194,8 @@ def read_union_value(self) -> jsii.Number: def expression(self) -> scope.jsii_calc_lib.Value: """Returns the expression. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "expression") @@ -5880,8 +6204,8 @@ def expression(self) -> scope.jsii_calc_lib.Value: def operations_log(self) -> typing.List[scope.jsii_calc_lib.Value]: """A log of all operations. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "operationsLog") @@ -5890,8 +6214,8 @@ def operations_log(self) -> typing.List[scope.jsii_calc_lib.Value]: def operations_map(self) -> typing.Mapping[str,typing.List[scope.jsii_calc_lib.Value]]: """A map of per operation name of all operations performed. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "operationsMap") @@ -5900,8 +6224,8 @@ def operations_map(self) -> typing.Mapping[str,typing.List[scope.jsii_calc_lib.V def curr(self) -> scope.jsii_calc_lib.Value: """The current value. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "curr") @@ -5914,8 +6238,8 @@ def curr(self, value: scope.jsii_calc_lib.Value): def max_value(self) -> typing.Optional[jsii.Number]: """The maximum value allows in this calculator. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "maxValue") @@ -5928,8 +6252,8 @@ def max_value(self, value: typing.Optional[jsii.Number]): def union_property(self) -> typing.Optional[typing.Union[typing.Optional["Add"], typing.Optional["Multiply"], typing.Optional["Power"]]]: """Example of a property that accepts a union of types. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "unionProperty") @@ -5941,18 +6265,17 @@ def union_property(self, value: typing.Optional[typing.Union[typing.Optional["Ad class Power(composition.CompositeOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Power"): """The power operation. - Stability: - experimental + stability + :stability: experimental """ def __init__(self, base: scope.jsii_calc_lib.Value, pow: scope.jsii_calc_lib.Value) -> None: """Creates a Power operation. - Arguments: - base: The base of the power. - pow: The number of times to multiply. + :param base: The base of the power. + :param pow: The number of times to multiply. - Stability: - experimental + stability + :stability: experimental """ jsii.create(Power, self, [base, pow]) @@ -5961,8 +6284,8 @@ def __init__(self, base: scope.jsii_calc_lib.Value, pow: scope.jsii_calc_lib.Val def base(self) -> scope.jsii_calc_lib.Value: """The base of the power. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "base") @@ -5971,8 +6294,8 @@ def base(self) -> scope.jsii_calc_lib.Value: def expression(self) -> scope.jsii_calc_lib.Value: """The expression that this operation consists of. Must be implemented by derived classes. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "expression") @@ -5981,8 +6304,8 @@ def expression(self) -> scope.jsii_calc_lib.Value: def pow(self) -> scope.jsii_calc_lib.Value: """The number of times to multiply. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "pow") @@ -5990,13 +6313,13 @@ def pow(self) -> scope.jsii_calc_lib.Value: class Sum(composition.CompositeOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Sum"): """An operation that sums multiple values. - Stability: - experimental + stability + :stability: experimental """ def __init__(self) -> None: """ - Stability: - experimental + stability + :stability: experimental """ jsii.create(Sum, self, []) @@ -6005,8 +6328,8 @@ def __init__(self) -> None: def expression(self) -> scope.jsii_calc_lib.Value: """The expression that this operation consists of. Must be implemented by derived classes. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "expression") @@ -6015,8 +6338,8 @@ def expression(self) -> scope.jsii_calc_lib.Value: def parts(self) -> typing.List[scope.jsii_calc_lib.Value]: """The parts to sum. - Stability: - experimental + stability + :stability: experimental """ return jsii.get(self, "parts") @@ -6025,6 +6348,6 @@ def parts(self, value: typing.List[scope.jsii_calc_lib.Value]): return jsii.set(self, "parts", value) -__all__ = ["AbstractClass", "AbstractClassBase", "AbstractClassReturner", "Add", "AllTypes", "AllTypesEnum", "AllowedMethodNames", "AsyncVirtualMethods", "AugmentableClass", "BinaryOperation", "Calculator", "CalculatorProps", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", "ClassWithDocs", "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "ConstructorPassesThisOut", "Constructors", "ConsumersOfThisCrazyTypeSystem", "DataRenderer", "DefaultedConstructorArgument", "DeprecatedClass", "DeprecatedEnum", "DeprecatedStruct", "DerivedClassHasNoProperties", "DerivedStruct", "DoNotOverridePrivates", "DoNotRecognizeAnyAsOptional", "DocumentedClass", "DontComplainAboutVariadicAfterOptional", "DoubleTrouble", "EraseUndefinedHashValues", "EraseUndefinedHashValuesOptions", "ExperimentalClass", "ExperimentalEnum", "ExperimentalStruct", "ExportedBaseClass", "ExtendsInternalInterface", "GiveMeStructs", "Greetee", "GreetingAugmenter", "IAnotherPublicInterface", "IDeprecatedInterface", "IExperimentalInterface", "IExtendsPrivateInterface", "IFriendlier", "IFriendlyRandomGenerator", "IInterfaceImplementedByAbstractClass", "IInterfaceThatShouldNotBeADataType", "IInterfaceWithInternal", "IInterfaceWithMethods", "IInterfaceWithOptionalMethodArguments", "IInterfaceWithProperties", "IInterfaceWithPropertiesExtension", "IJSII417Derived", "IJSII417PublicBaseOfBase", "IJsii487External", "IJsii487External2", "IJsii496", "IMutableObjectLiteral", "INonInternalInterface", "IPrivatelyImplemented", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", "IReturnsNumber", "IStableInterface", "ImplementInternalInterface", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", "ImplictBaseOfBase", "InbetweenClass", "InterfaceInNamespaceIncludesClasses", "InterfaceInNamespaceOnlyInterface", "JSII417Derived", "JSII417PublicBaseOfBase", "JSObjectLiteralForInterface", "JSObjectLiteralToNative", "JSObjectLiteralToNativeClass", "JavaReservedWords", "Jsii487Derived", "Jsii496Derived", "JsiiAgent", "LoadBalancedFargateServiceProps", "Multiply", "Negate", "NodeStandardLibrary", "NullShouldBeTreatedAsUndefined", "NullShouldBeTreatedAsUndefinedData", "NumberGenerator", "ObjectRefsInCollections", "Old", "OptionalConstructorArgument", "OptionalStruct", "OptionalStructConsumer", "OverrideReturnsObject", "PartiallyInitializedThisConsumer", "Polymorphism", "Power", "PublicClass", "PythonReservedWords", "ReferenceEnumFromScopedPackage", "ReturnsPrivateImplementationOfInterface", "RuntimeTypeChecking", "SingleInstanceTwoTypes", "SingletonInt", "SingletonIntEnum", "SingletonString", "SingletonStringEnum", "StableClass", "StableEnum", "StableStruct", "StaticContext", "Statics", "StringEnum", "StripInternal", "Sum", "SyncVirtualMethods", "Thrower", "UnaryOperation", "UnionProperties", "UseBundledDependency", "UseCalcBase", "UsesInterfaceWithProperties", "VariadicMethod", "VirtualMethodPlayground", "VoidCallback", "WithPrivatePropertyInConstructor", "__jsii_assembly__", "composition"] +__all__ = ["AbstractClass", "AbstractClassBase", "AbstractClassReturner", "Add", "AllTypes", "AllTypesEnum", "AllowedMethodNames", "AsyncVirtualMethods", "AugmentableClass", "BinaryOperation", "Calculator", "CalculatorProps", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", "ClassWithDocs", "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "ConstructorPassesThisOut", "Constructors", "ConsumersOfThisCrazyTypeSystem", "DataRenderer", "DefaultedConstructorArgument", "DeprecatedClass", "DeprecatedEnum", "DeprecatedStruct", "DerivedClassHasNoProperties", "DerivedStruct", "DoNotOverridePrivates", "DoNotRecognizeAnyAsOptional", "DocumentedClass", "DontComplainAboutVariadicAfterOptional", "DoubleTrouble", "EraseUndefinedHashValues", "EraseUndefinedHashValuesOptions", "ExperimentalClass", "ExperimentalEnum", "ExperimentalStruct", "ExportedBaseClass", "ExtendsInternalInterface", "GiveMeStructs", "Greetee", "GreetingAugmenter", "IAnotherPublicInterface", "IDeprecatedInterface", "IExperimentalInterface", "IExtendsPrivateInterface", "IFriendlier", "IFriendlyRandomGenerator", "IInterfaceImplementedByAbstractClass", "IInterfaceThatShouldNotBeADataType", "IInterfaceWithInternal", "IInterfaceWithMethods", "IInterfaceWithOptionalMethodArguments", "IInterfaceWithProperties", "IInterfaceWithPropertiesExtension", "IJSII417Derived", "IJSII417PublicBaseOfBase", "IJsii487External", "IJsii487External2", "IJsii496", "IMutableObjectLiteral", "INonInternalInterface", "IPrivatelyImplemented", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", "IReturnsNumber", "IStableInterface", "ImplementInternalInterface", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", "ImplictBaseOfBase", "InbetweenClass", "InterfaceInNamespaceIncludesClasses", "InterfaceInNamespaceOnlyInterface", "JSII417Derived", "JSII417PublicBaseOfBase", "JSObjectLiteralForInterface", "JSObjectLiteralToNative", "JSObjectLiteralToNativeClass", "JavaReservedWords", "Jsii487Derived", "Jsii496Derived", "JsiiAgent", "LoadBalancedFargateServiceProps", "Multiply", "Negate", "NodeStandardLibrary", "NullShouldBeTreatedAsUndefined", "NullShouldBeTreatedAsUndefinedData", "NumberGenerator", "ObjectRefsInCollections", "Old", "OptionalConstructorArgument", "OptionalStruct", "OptionalStructConsumer", "OverrideReturnsObject", "PartiallyInitializedThisConsumer", "Polymorphism", "Power", "PublicClass", "PythonReservedWords", "ReferenceEnumFromScopedPackage", "ReturnsPrivateImplementationOfInterface", "RuntimeTypeChecking", "SecondLevelStruct", "SingleInstanceTwoTypes", "SingletonInt", "SingletonIntEnum", "SingletonString", "SingletonStringEnum", "StableClass", "StableEnum", "StableStruct", "StaticContext", "Statics", "StringEnum", "StripInternal", "StructPassing", "Sum", "SyncVirtualMethods", "Thrower", "TopLevelStruct", "UnaryOperation", "UnionProperties", "UseBundledDependency", "UseCalcBase", "UsesInterfaceWithProperties", "VariadicMethod", "VirtualMethodPlayground", "VoidCallback", "WithPrivatePropertyInConstructor", "__jsii_assembly__", "composition"] publication.publish() diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst index 26f0c82824..f048596064 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst @@ -5827,6 +5827,53 @@ RuntimeTypeChecking :type arg3: date +SecondLevelStruct (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: SecondLevelStruct + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.SecondLevelStruct; + + .. code-tab:: javascript + + // SecondLevelStruct is an interface + + .. code-tab:: typescript + + import { SecondLevelStruct } from 'jsii-calc'; + + + + + + .. py:attribute:: deeperRequiredProp + + It's long and required. + + + + :type: string *(readonly)* + + + .. py:attribute:: deeperOptionalProp + + It's long, but you'll almost never pass it. + + + + :type: string *(optional)* *(readonly)* + + SingleInstanceTwoTypes ^^^^^^^^^^^^^^^^^^^^^^ @@ -6361,6 +6408,52 @@ StripInternal :type: string +StructPassing +^^^^^^^^^^^^^ + +.. py:class:: StructPassing() + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.StructPassing; + + .. code-tab:: javascript + + const { StructPassing } = require('jsii-calc'); + + .. code-tab:: typescript + + import { StructPassing } from 'jsii-calc'; + + + + + .. py:staticmethod:: howManyVarArgsDidIPass(_positional, inputs) -> number + + :param _positional: + :type _positional: number + :param inputs: + :type inputs: :py:class:`~jsii-calc.TopLevelStruct`\ [] + :rtype: number + + + .. py:staticmethod:: roundTrip(_positional, input) -> jsii-calc.TopLevelStruct + + :param _positional: + :type _positional: number + :param input: + :type input: :py:class:`~jsii-calc.TopLevelStruct`\ + :rtype: :py:class:`~jsii-calc.TopLevelStruct`\ + + Sum ^^^ @@ -6622,6 +6715,62 @@ Thrower +TopLevelStruct (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: TopLevelStruct + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.TopLevelStruct; + + .. code-tab:: javascript + + // TopLevelStruct is an interface + + .. code-tab:: typescript + + import { TopLevelStruct } from 'jsii-calc'; + + + + + + .. py:attribute:: required + + This is a required field. + + + + :type: string *(readonly)* + + + .. py:attribute:: secondLevel + + A union to really stress test our serialization. + + + + :type: number or :py:class:`~jsii-calc.SecondLevelStruct`\ *(readonly)* + + + .. py:attribute:: optional + + You don't have to pass this. + + + + :type: string *(optional)* *(readonly)* + + UnaryOperation ^^^^^^^^^^^^^^ diff --git a/packages/jsii-python-runtime/requirements.txt b/packages/jsii-python-runtime/requirements.txt index 69b20d4167..f5f6ecaa51 100644 --- a/packages/jsii-python-runtime/requirements.txt +++ b/packages/jsii-python-runtime/requirements.txt @@ -1,3 +1,2 @@ pytest pytest-mypy -mypy_extensions diff --git a/packages/jsii-python-runtime/setup.py b/packages/jsii-python-runtime/setup.py index 42b466961f..7f77c74e21 100644 --- a/packages/jsii-python-runtime/setup.py +++ b/packages/jsii-python-runtime/setup.py @@ -33,7 +33,6 @@ "importlib_resources ; python_version < '3.7'", "python-dateutil", "typing_extensions>=3.6.4", - "mypy_extensions>=0.4.0", ], python_requires=">=3.6", diff --git a/packages/jsii-python-runtime/src/jsii/__init__.py b/packages/jsii-python-runtime/src/jsii/__init__.py index 5e6c190ed4..108813ac3d 100644 --- a/packages/jsii-python-runtime/src/jsii/__init__.py +++ b/packages/jsii-python-runtime/src/jsii/__init__.py @@ -7,7 +7,6 @@ JSIIAbstractClass, enum, data_type, - data_type_optionals, implements, interface, member, @@ -45,7 +44,6 @@ "Number", "enum", "data_type", - "data_type_optionals", "implements", "interface", "member", diff --git a/packages/jsii-python-runtime/src/jsii/_kernel/__init__.py b/packages/jsii-python-runtime/src/jsii/_kernel/__init__.py index 3dcd0f5dea..7fd163cbd2 100644 --- a/packages/jsii-python-runtime/src/jsii/_kernel/__init__.py +++ b/packages/jsii-python-runtime/src/jsii/_kernel/__init__.py @@ -109,10 +109,19 @@ def wrapped(kernel, *args, **kwargs): # We need to recurse through our data structure and look for anything that the JSII # doesn't natively handle. These items will be created as "Object" types in the JSII. def _make_reference_for_native(kernel, d): + # Ugly delayed import here because I can't solve the cyclic + # package dependency right now :(. + from jsii._runtime import python_jsii_mapping + if isinstance(d, dict): return {k: _make_reference_for_native(kernel, v) for k, v in d.items()} elif isinstance(d, list): return [_make_reference_for_native(kernel, i) for i in d] + + mapping = python_jsii_mapping(d) + if mapping: + struct_data = {jsii_name: getattr(d, python_name) for python_name, jsii_name in mapping.items()} + return _make_reference_for_native(kernel, struct_data) elif hasattr(d, "__jsii_type__"): return d elif isinstance(d, (int, type(None), str, float, bool, datetime.datetime)): @@ -148,7 +157,7 @@ def _callback_till_result(kernel, response: Callback, response_type: Type[Kernel response = kernel.sync_complete(response.cbid, str(exc), None, response_type) else: response = kernel.sync_complete(response.cbid, None, result, response_type) - + if isinstance(response, InvokeResponse): return response.result elif isinstance(response, GetResponse): diff --git a/packages/jsii-python-runtime/src/jsii/_kernel/providers/process.py b/packages/jsii-python-runtime/src/jsii/_kernel/providers/process.py index bd8005c52b..092514a5dc 100644 --- a/packages/jsii-python-runtime/src/jsii/_kernel/providers/process.py +++ b/packages/jsii-python-runtime/src/jsii/_kernel/providers/process.py @@ -141,7 +141,7 @@ def jdefault(obj): return {"$jsii.date": obj.isoformat()} elif isinstance(obj, datetime.datetime): raise TypeError("Naive datetimes are not supported, please add a timzone.") - raise TypeError + raise TypeError("Don't know how to convert object to JSON: %r" % obj) class _NodeProcess: diff --git a/packages/jsii-python-runtime/src/jsii/_reference_map.py b/packages/jsii-python-runtime/src/jsii/_reference_map.py index 3020f71f85..e183cc8d49 100644 --- a/packages/jsii-python-runtime/src/jsii/_reference_map.py +++ b/packages/jsii-python-runtime/src/jsii/_reference_map.py @@ -70,17 +70,21 @@ def resolve(self, kernel, ref): inst = klass.__new__(klass) inst.__jsii_ref__ = ref elif class_fqn in _data_types: + # Data types have been serialized by-reference (see aws/jsii#400). + # We retrieve all of its properties right now and then construct a value + # object from it. This will be slow :(. + + # Ugly delayed import here because I can't solve the cyclic + # package dependency right now :(. + from ._runtime import python_jsii_mapping + data_type = _data_types[class_fqn] + remote_struct = _FakeReference(ref) - # A Data type is nothing more than a dictionary, however we need to iterate - # over all of it's properties, and ask the kernel for the values of each of - # then in order to constitute our dict - inst = {} + python_props = {python_name: kernel.get(remote_struct, jsii_name) + for python_name, jsii_name in python_jsii_mapping(data_type).items()} - for name in data_type.__annotations__.keys(): - # This is a hack, because our kernel expects an object that has a - # __jsii_ref__ attached to it, and we don't have one of those. - inst[name] = kernel.get(_FakeReference(ref), name) + return data_type(**python_props) elif class_fqn in _enums: inst = _enums[class_fqn] elif class_fqn in _interfaces: diff --git a/packages/jsii-python-runtime/src/jsii/_runtime.py b/packages/jsii-python-runtime/src/jsii/_runtime.py index bc2568eb80..70f24a6349 100644 --- a/packages/jsii-python-runtime/src/jsii/_runtime.py +++ b/packages/jsii-python-runtime/src/jsii/_runtime.py @@ -84,24 +84,17 @@ def deco(cls): return deco -def data_type(*, jsii_type, jsii_struct_bases): +def data_type(*, jsii_type, jsii_struct_bases, name_mapping): def deco(cls): cls.__jsii_type__ = jsii_type cls.__jsii_struct_bases__ = jsii_struct_bases + cls.__jsii_name_mapping__ = name_mapping _reference_map.register_data_type(cls) return cls return deco -def data_type_optionals(*, jsii_struct_bases): - def deco(cls): - cls.__jsii_struct_bases__ = jsii_struct_bases - return cls - - return deco - - def member(*, jsii_name): def deco(fn): fn.__jsii_name__ = jsii_name @@ -132,3 +125,7 @@ def proxy_for(abstract_class): raise TypeError(f"{abstract_class} is not a JSII Abstract class.") return abstract_class.__jsii_proxy_class__() + + +def python_jsii_mapping(cls): + return getattr(cls, '__jsii_name_mapping__', None) diff --git a/packages/jsii-python-runtime/src/jsii/compat.py b/packages/jsii-python-runtime/src/jsii/compat.py index ea8b6c8d87..1c1e037c51 100644 --- a/packages/jsii-python-runtime/src/jsii/compat.py +++ b/packages/jsii-python-runtime/src/jsii/compat.py @@ -1,7 +1,6 @@ # External Compatability Shims -from mypy_extensions import TypedDict from typing_extensions import Protocol -__all__ = ["Protocol", "TypedDict"] +__all__ = ["Protocol"] diff --git a/packages/jsii-python-runtime/tests/test_compliance.py b/packages/jsii-python-runtime/tests/test_compliance.py index dacb8f3cf0..b39dd2336b 100644 --- a/packages/jsii-python-runtime/tests/test_compliance.py +++ b/packages/jsii-python-runtime/tests/test_compliance.py @@ -44,6 +44,9 @@ composition, EraseUndefinedHashValues, VariadicMethod, + StructPassing, + TopLevelStruct, + SecondLevelStruct, ) from scope.jsii_calc_lib import IFriendly, EnumFromScopedModule, Number @@ -909,3 +912,43 @@ def render_map(self, map): return super().render_map(map) renderer = DataRendererSubclass() assert renderer.render(anumber = 42, astring = "bazinga!") == "{\n \"anumber\": 42,\n \"astring\": \"bazinga!\"\n}" + +def test_passNestedStruct(): + output = StructPassing.round_trip(123, + required='hello', + second_level=SecondLevelStruct(deeper_required_prop='exists')) + + assert output.required == 'hello' + assert output.optional is None + assert output.second_level.deeper_required_prop == 'exists' + + # Test stringification + # Dicts are ordered in Python 3.7+, so this is fine: https://mail.python.org/pipermail/python-dev/2017-December/151283.html + assert str(output) == "TopLevelStruct(required='hello', second_level=SecondLevelStruct(deeper_required_prop='exists'))" + +def test_passNestedScalar(): + output = StructPassing.round_trip(123, + required='hello', + second_level=5) + + assert output.required == 'hello' + assert output.optional is None + assert output.second_level == 5 + +def test_passStructsInVariadic(): + output = StructPassing.how_many_var_args_did_i_pass(123, [ + TopLevelStruct(required='hello', second_level=1), + TopLevelStruct(required='bye', second_level=SecondLevelStruct(deeper_required_prop='ciao')) + ]) + assert output == 2 + +def test_structEquality(): + a = TopLevelStruct(required='bye', second_level=SecondLevelStruct(deeper_required_prop='ciao')) + b = TopLevelStruct(required='hello', second_level=1), + c = TopLevelStruct(required='hello', second_level=1), + d = SecondLevelStruct(deeper_required_prop='exists') + + assert a != b + assert b == c + assert a != 5 + assert a != d diff --git a/packages/jsii-python-runtime/tests/test_python.py b/packages/jsii-python-runtime/tests/test_python.py index f14f2912bc..f81e9143e0 100644 --- a/packages/jsii-python-runtime/tests/test_python.py +++ b/packages/jsii-python-runtime/tests/test_python.py @@ -21,7 +21,7 @@ def test_inheritance_maintained(self): base_names = [b.__name__ for b in bases] - assert base_names == ['DerivedStruct', '_DerivedStruct', 'MyFirstStruct', '_MyFirstStruct'] + assert base_names == ['DerivedStruct', 'MyFirstStruct'] diff --git a/packages/jsii-reflect/test/classes.expected.txt b/packages/jsii-reflect/test/classes.expected.txt index 2dce67b20a..b6d7b576b0 100644 --- a/packages/jsii-reflect/test/classes.expected.txt +++ b/packages/jsii-reflect/test/classes.expected.txt @@ -75,6 +75,7 @@ StableClass StaticContext Statics StripInternal +StructPassing Sum SyncVirtualMethods Thrower diff --git a/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt index 7d3f505e2e..fb02cb9bca 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt @@ -1086,6 +1086,25 @@ assemblies │ │ ├── () initializer (experimental) │ │ └─┬ youSeeMe property (experimental) │ │ └── type: string + │ ├─┬ class StructPassing (experimental) + │ │ └─┬ members + │ │ ├── () initializer (experimental) + │ │ ├─┬ static howManyVarArgsDidIPass(_positional,inputs) method (experimental) + │ │ │ ├── static + │ │ │ ├─┬ parameters + │ │ │ │ ├─┬ _positional + │ │ │ │ │ └── type: number + │ │ │ │ └─┬ inputs + │ │ │ │ └── type: Array + │ │ │ └── returns: number + │ │ └─┬ static roundTrip(_positional,input) method (experimental) + │ │ ├── static + │ │ ├─┬ parameters + │ │ │ ├─┬ _positional + │ │ │ │ └── type: number + │ │ │ └─┬ input + │ │ │ └── type: jsii-calc.TopLevelStruct + │ │ └── returns: jsii-calc.TopLevelStruct │ ├─┬ class Sum (experimental) │ │ ├── base: CompositeOperation │ │ └─┬ members @@ -1589,12 +1608,36 @@ assemblies │ │ ├── abstract │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ interface SecondLevelStruct (experimental) + │ │ └─┬ members + │ │ ├─┬ deeperRequiredProp property (experimental) + │ │ │ ├── abstract + │ │ │ ├── immutable + │ │ │ └── type: string + │ │ └─┬ deeperOptionalProp property (experimental) + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: Optional │ ├─┬ interface StableStruct (stable) │ │ └─┬ members │ │ └─┬ readonlyProperty property (stable) │ │ ├── abstract │ │ ├── immutable │ │ └── type: string + │ ├─┬ interface TopLevelStruct (experimental) + │ │ └─┬ members + │ │ ├─┬ required property (experimental) + │ │ │ ├── abstract + │ │ │ ├── immutable + │ │ │ └── type: string + │ │ ├─┬ secondLevel property (experimental) + │ │ │ ├── abstract + │ │ │ ├── immutable + │ │ │ └── type: number | jsii-calc.SecondLevelStruct + │ │ └─┬ optional property (experimental) + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: Optional │ ├─┬ interface UnionProperties (experimental) │ │ └─┬ members │ │ ├─┬ bar property (experimental) diff --git a/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt index 5d1a34fa03..f0adf2f52f 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt @@ -97,6 +97,7 @@ assemblies │ ├── class StaticContext │ ├── class Statics │ ├── class StripInternal + │ ├── class StructPassing │ ├─┬ class Sum │ │ └── base: CompositeOperation │ ├── class SyncVirtualMethods @@ -168,7 +169,9 @@ assemblies │ ├── interface LoadBalancedFargateServiceProps │ ├── interface NullShouldBeTreatedAsUndefinedData │ ├── interface OptionalStruct + │ ├── interface SecondLevelStruct │ ├── interface StableStruct + │ ├── interface TopLevelStruct │ ├── interface UnionProperties │ ├── enum AllTypesEnum │ ├── enum DeprecatedEnum diff --git a/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt index 91ce110823..b31f9b0669 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt @@ -488,6 +488,11 @@ assemblies │ │ └─┬ members │ │ ├── () initializer │ │ └── youSeeMe property + │ ├─┬ class StructPassing + │ │ └─┬ members + │ │ ├── () initializer + │ │ ├── static howManyVarArgsDidIPass(_positional,inputs) method + │ │ └── static roundTrip(_positional,input) method │ ├─┬ class Sum │ │ └─┬ members │ │ ├── () initializer @@ -704,9 +709,18 @@ assemblies │ ├─┬ interface OptionalStruct │ │ └─┬ members │ │ └── field property + │ ├─┬ interface SecondLevelStruct + │ │ └─┬ members + │ │ ├── deeperRequiredProp property + │ │ └── deeperOptionalProp property │ ├─┬ interface StableStruct │ │ └─┬ members │ │ └── readonlyProperty property + │ ├─┬ interface TopLevelStruct + │ │ └─┬ members + │ │ ├── required property + │ │ ├── secondLevel property + │ │ └── optional property │ ├─┬ interface UnionProperties │ │ └─┬ members │ │ ├── bar property diff --git a/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt index 0c11d1dce0..9513ee09fa 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt @@ -74,6 +74,7 @@ assemblies │ ├── class StaticContext │ ├── class Statics │ ├── class StripInternal + │ ├── class StructPassing │ ├── class Sum │ ├── class SyncVirtualMethods │ ├── class Thrower @@ -125,7 +126,9 @@ assemblies │ ├── interface LoadBalancedFargateServiceProps │ ├── interface NullShouldBeTreatedAsUndefinedData │ ├── interface OptionalStruct + │ ├── interface SecondLevelStruct │ ├── interface StableStruct + │ ├── interface TopLevelStruct │ ├── interface UnionProperties │ ├── enum AllTypesEnum │ ├── enum DeprecatedEnum