diff --git a/gh-pages/content/user-guides/lib-user/language-specific/python.md b/gh-pages/content/user-guides/lib-user/language-specific/python.md index 059fd59478..5ab3bf39b3 100644 --- a/gh-pages/content/user-guides/lib-user/language-specific/python.md +++ b/gh-pages/content/user-guides/lib-user/language-specific/python.md @@ -16,38 +16,20 @@ Traditionally, **Python** developers expect to be able to either *implicitly* im required members, or *explicitly* implement interfaces by simply adding the interface to their class' or interface's inheritance chain (and implementing all required members): -!!! bug "Incorrect Use" - - ```py hl_lines="3" - from jsii_dependency import IJsiiInterface - - class MyNewClass(IJsiiInterface): - """ Traditional implementation of an interface in Python. - - This will not work with interfaces defined by jsii modules, as this will - likely cause a metaclass conflict that the user cannot solve. - """ - - # Member implementations... - - ... - ``` - The [jsii type system][jsii-type-system] however does not support *structural typing*, and interfaces must **always** be *explicitly* implemented. In order to correctly declare implementation of an interface from a *jsii module*, the following syntax is used: -```py hl_lines="1 4" -import jsii +```py hl_lines="3" from jsii_dependency import IJsiiInterface -@jsii.implements(IJsiiInterface) -class MyNewClass(): - """ A jsii-supported implementation of the `IJsiiInterface` interface +class MyNewClass(IJsiiInterface): + """ Traditional implementation of an interface in Python. - This will correctly register the explicit interface implementation on the - type's metadata, and ensure instances get correctly serialized to and from - the jsii kernel. + In multiple inheritance scenarios, you may encouter a metaclass conflict + if one of the ancestor interfaces is from a library generated with jsii-pacmak + releases <= 1.52.1. In this case, you may need to use the "Legacy Style" (see + below) declaration with the affected interfaces. """ # Member implementations... @@ -55,6 +37,29 @@ class MyNewClass(): ... ``` +!!! info Legacy Style + When using libraries generated by `jsii-pacmak` version `1.52.1` and earlier, using the inheritance chain style + above may result in metaclass conflicts when performing multiple inheritance. In such cases, the implementation can + be performed using the `@jsii.implements` decorator instead. + + ```py hl_lines="1 4" + import jsii + from jsii_dependency import IJsiiInterface + + @jsii.implements(IJsiiInterface) + class MyNewClass(): + """ A jsii-supported implementation of the `IJsiiInterface` interface + + This will correctly register the explicit interface implementation on the + type's metadata, and ensure instances get correctly serialized to and from + the jsii kernel. + """ + + # Member implementations... + + ... + ``` + [jsii-type-system]: ../../../specification/2-type-system.md ## Property Overrides diff --git a/packages/@jsii/python-runtime/build-tools/gen.ts b/packages/@jsii/python-runtime/build-tools/gen.ts index e375f61a0a..16ed023b2e 100644 --- a/packages/@jsii/python-runtime/build-tools/gen.ts +++ b/packages/@jsii/python-runtime/build-tools/gen.ts @@ -3,6 +3,10 @@ import { copyFileSync, readdirSync, statSync, writeFileSync } from 'fs'; import { resolve } from 'path'; +// Ensure we use a version number that is coherent with Python specifics. +import { TargetName } from 'jsii-pacmak/lib/targets'; +import { toReleaseVersion } from 'jsii-pacmak/lib/targets/version-utils'; + const EMBEDDED_SOURCE = resolve(__dirname, '..', '..', 'runtime', 'webpack'); const EMBEDDED_INFO = resolve(__dirname, '..', '..', 'runtime', 'package.json'); @@ -13,7 +17,7 @@ writeFileSync( resolve(__dirname, '..', 'src', 'jsii', '_metadata.json'), JSON.stringify( { - version: data.version, + version: toReleaseVersion(data.version, TargetName.PYTHON), description: data.description, license: data.license, author: data.author.name, diff --git a/packages/@jsii/python-runtime/mypy.ini b/packages/@jsii/python-runtime/mypy.ini index 976ba02946..7ff19570f6 100644 --- a/packages/@jsii/python-runtime/mypy.ini +++ b/packages/@jsii/python-runtime/mypy.ini @@ -1,2 +1,13 @@ [mypy] +disallow_untyped_decorators = True +pretty = True +python_version = 3.6 +warn_unused_configs = True +warn_unused_ignores = True +warn_unreachable = True + +[mypy-setuptools] +ignore_missing_imports = True + +[mypy-importlib_resources] ignore_missing_imports = True diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py index 95959e7f62..c47c066777 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py @@ -3,7 +3,7 @@ import itertools from types import FunctionType, MethodType, BuiltinFunctionType, LambdaType -from typing import Any, List, Optional, Type, Union +from typing import Any, Callable, List, Optional, Type import functools @@ -12,9 +12,7 @@ from ..errors import JSIIError from .. import _reference_map -from .._utils import Singleton from .providers import BaseProvider, ProcessProvider -from .types import Callback from .types import ( EnumRef, LoadRequest, @@ -63,7 +61,7 @@ def _get_overides(klass: Type, obj: Any) -> List[Override]: # We need to inspect each item in the MRO, until we get to our Type, at that # point we'll bail, because those methods are not the overriden methods, but the # "real" methods. - jsii_name = getattr(klass, "__jsii_type__", "Object") + jsii_name = getattr(klass, "__jsii_class__", None) or "Object" jsii_classes = [ next( ( @@ -124,7 +122,7 @@ def _get_overides(klass: Type, obj: Any) -> List[Override]: return overrides -def _recursize_dereference(kernel, d): +def _recursize_dereference(kernel: "Kernel", d): if isinstance(d, dict): return {k: _recursize_dereference(kernel, v) for k, v in d.items()} elif isinstance(d, list): @@ -137,7 +135,7 @@ def _recursize_dereference(kernel, d): return d -def _dereferenced(fn): +def _dereferenced(fn: Callable[..., Any]) -> Callable[..., Any]: @functools.wraps(fn) def wrapped(kernel, *args, **kwargs): return _recursize_dereference(kernel, fn(kernel, *args, **kwargs)) @@ -147,7 +145,7 @@ 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): +def _make_reference_for_native(kernel: "Kernel", d): if isinstance(d, dict): return { "$jsii.map": { @@ -181,6 +179,12 @@ def _make_reference_for_native(kernel, d): }, } } + + if not hasattr(d, "__jsii_ref__"): + # This is a user-defined interface implementation. It hasn't been registered with the JS kernel just yet, so + # we need to create a JS proxy for this value before we can send it across the wire. + kernel.create(d.__class__, d) + return d elif isinstance(d, (int, type(None), str, float, bool, datetime.datetime)): @@ -201,7 +205,7 @@ def _make_reference_for_native(kernel, d): return d -def _handle_callback(kernel, callback): +def _handle_callback(kernel: "Kernel", callback): # need to handle get, set requests here as well as invoke requests if callback.invoke: obj = _reference_map.resolve_id(callback.invoke.objref.ref) @@ -222,24 +226,23 @@ def _handle_callback(kernel, callback): def _callback_till_result( - kernel, response: Callback, response_type: Type[KernelResponse] + kernel: "Kernel", response: Callback, response_type: Type[KernelResponse] ) -> Any: - while isinstance(response, Callback): + current: Any = response + while isinstance(current, Callback): try: - result = _handle_callback(kernel, response) + result = _handle_callback(kernel, current) except Exception as exc: - response = kernel.sync_complete( - response.cbid, str(exc), None, response_type - ) + current = kernel.sync_complete(current.cbid, str(exc), None, response_type) else: - response = kernel.sync_complete(response.cbid, None, result, response_type) + current = kernel.sync_complete(current.cbid, None, result, response_type) - if isinstance(response, InvokeResponse): - return response.result - elif isinstance(response, GetResponse): - return response.value + if isinstance(current, InvokeResponse): + return current.result + elif isinstance(current, GetResponse): + return current.value else: - return response + return current @attr.s(auto_attribs=True, frozen=True, slots=True) @@ -289,7 +292,7 @@ def create(self, klass: Type, obj: Any, args: Optional[List[Any]] = None) -> Obj response = self.provider.create( CreateRequest( - fqn=klass.__jsii_type__ or "Object", + fqn=getattr(klass, "__jsii_class__", None) or "Object", args=_make_reference_for_native(self, args), overrides=_get_overides(klass, obj), interfaces=[ 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 37cde885b5..85c36b51c4 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/providers/process.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/providers/process.py @@ -13,10 +13,10 @@ import tempfile import threading -from typing import TYPE_CHECKING, Type, Union, Mapping, IO, Any, AnyStr, Optional +from typing import Type, Union, Mapping, IO, Any, AnyStr, Optional import attr -import cattr # type: ignore +import cattr import dateutil.parser import jsii._embedded.jsii diff --git a/packages/@jsii/python-runtime/src/jsii/_runtime.py b/packages/@jsii/python-runtime/src/jsii/_runtime.py index 3ebbf99df3..4aba11da11 100644 --- a/packages/@jsii/python-runtime/src/jsii/_runtime.py +++ b/packages/@jsii/python-runtime/src/jsii/_runtime.py @@ -1,15 +1,16 @@ import abc import os +import warnings import attr -from typing import cast, Any, Callable, ClassVar, List, Optional, Mapping, Type, TypeVar +from typing import cast, Any, Callable, List, Mapping, Optional, Type, TypeVar +from typing_extensions import Protocol from . import _reference_map from ._compat import importlib_resources from ._kernel import Kernel from .python import _ClassPropertyMeta -from ._kernel.types import ObjRef # Yea, a global here is kind of gross, however, there's not really a better way of @@ -67,7 +68,7 @@ def __new__( # Since their parent class will have the __jsii_type__ variable defined, they # will as well anyways. if jsii_type is not None: - attrs["__jsii_type__"] = jsii_type + attrs["__jsii_class__"] = attrs["__jsii_type__"] = jsii_type # The declared type should NOT be inherited by subclasses. This way we can identify whether # an MRO entry corresponds to a possible overrides contributor or not. attrs["__jsii_declared_type__"] = jsii_type @@ -82,14 +83,6 @@ def __new__( return cast("JSIIMeta", obj) - def __call__(cls: Type[Any], *args: Any, **kwargs) -> Any: - inst = super().__call__(*args, **kwargs) - - # Register this instance with our reference map. - _reference_map.register_reference(inst) - - return inst - class JSIIAbstractClass(abc.ABCMeta, JSIIMeta): pass @@ -133,7 +126,19 @@ def deco(fn): def implements(*interfaces: Type[Any]) -> Callable[[T], T]: - def deco(cls): + def deco(cls: T) -> T: + # In the past, interfaces were rendered as Protocols, so they could not + # be directly extended. The @jsii.implements annotation was created to + # register the nominal type relationship. Now, interfaces are rendered + # as fully abstract base classes, and they should simply be extended. We + # emit a warning when the legacy usage is detected. + for interface in interfaces: + if type(interface) is not type(Protocol): + warnings.warn( + f"{interface.__name__} is no longer a Protocol. Use of @jsii.implements with it is deprecated. Move this interface to the class' inhertiance list of {cls.__name__} instead!", + stacklevel=2, + ) + cls.__jsii_type__ = getattr(cls, "__jsii_type__", None) cls.__jsii_ifaces__ = getattr(cls, "__jsii_ifaces__", []) + list(interfaces) return cls @@ -143,14 +148,18 @@ def deco(cls): def interface(*, jsii_type: str) -> Callable[[T], T]: def deco(iface): + # Un-set __jsii_class__ as this is an interface, and not a class. + iface.__jsii_class__ = None iface.__jsii_type__ = jsii_type + # This interface "implements itself" - this is a trick to ease up implementation discovery. + iface.__jsii_ifaces__ = [iface] + getattr(iface, "__jsii_ifaces__", []) _reference_map.register_interface(iface) return iface return deco -def proxy_for(abstract_class: Type[Any]) -> Type[Any]: +def proxy_for(abstract_class: T) -> T: if not hasattr(abstract_class, "__jsii_proxy_class__"): raise TypeError(f"{abstract_class} is not a JSII Abstract class.") diff --git a/packages/@jsii/python-runtime/src/jsii/_utils.py b/packages/@jsii/python-runtime/src/jsii/_utils.py index 08e69ba035..1592cc988c 100644 --- a/packages/@jsii/python-runtime/src/jsii/_utils.py +++ b/packages/@jsii/python-runtime/src/jsii/_utils.py @@ -1,6 +1,6 @@ import functools -from typing import Any, Mapping, Type +from typing import Any, Callable, List, Mapping, Type, TypeVar class Singleton(type): @@ -14,8 +14,11 @@ def __call__(cls, *args, **kwargs): return cls._instances[cls] -def memoized_property(fgetter): - stored = [] +T = TypeVar("T", bound=Any) + + +def memoized_property(fgetter: Callable[[Any], T]) -> property: + stored: List[T] = [] @functools.wraps(fgetter) def wrapped(self): diff --git a/packages/@jsii/python-runtime/src/jsii/python.py b/packages/@jsii/python-runtime/src/jsii/python.py index 123a4daf54..183e5569f3 100644 --- a/packages/@jsii/python-runtime/src/jsii/python.py +++ b/packages/@jsii/python-runtime/src/jsii/python.py @@ -1,21 +1,32 @@ +from typing import Any + + class _ClassProperty: - def __init__(self, fget, fset=None): + def __init__( + self, + fget, + fset=None, + ) -> None: self.fget = fget - self.fset = fset + if fset is not None: + self.setter(fset) - def __get__(self, obj, klass=None): + def __get__(self, obj, klass=None) -> Any: if klass is None: klass = type(obj) return self.fget.__get__(obj, klass)(klass) - def __set__(self, obj, value): + def __set__(self, obj, value) -> None: if not self.fset: raise AttributeError("Can't set attribute.") klass = type(obj) return self.fset.__get__(obj, klass)(value) - def setter(self, func): + def setter( + self, + func, + ) -> "_ClassProperty": if not isinstance(func, (classmethod, staticmethod)): func = classmethod(func) @@ -24,12 +35,18 @@ def setter(self, func): return self -def classproperty(func): +# The name `class_property` with the underscore is used because this is what +# will be causing PyCharm to consider the annotated member as a property. +def class_property(func) -> _ClassProperty: return _ClassProperty(func) +# Aliased to maintain backwards compatibility with code generated with <=1.52.2 +classproperty = class_property + + class _ClassPropertyMeta(type): - def __setattr__(self, key, value): + def __setattr__(self, key, value) -> None: obj = getattr(self, key, None) if isinstance(obj, _ClassProperty): return obj.__set__(self, value) diff --git a/packages/@jsii/python-runtime/tests/test_compliance.py b/packages/@jsii/python-runtime/tests/test_compliance.py index df52bfbe58..b58575c99a 100644 --- a/packages/@jsii/python-runtime/tests/test_compliance.py +++ b/packages/@jsii/python-runtime/tests/test_compliance.py @@ -153,9 +153,7 @@ def the_property(self, value): self.another_the_property = value -@jsii.implements(IFriendly) -@jsii.implements(IRandomNumberGenerator) -class SubclassNativeFriendlyRandom(Number): +class SubclassNativeFriendlyRandom(Number, IFriendly, IRandomNumberGenerator): def __init__(self): super().__init__(908) self.next_number = 100 @@ -169,8 +167,23 @@ def next(self): return next_ -@jsii.implements(IFriendlyRandomGenerator) -class PureNativeFriendlyRandom: +class SubclassNativeFriendlyRandom_Inheritance( + Number, IFriendly, IRandomNumberGenerator +): + def __init__(self): + super().__init__(908) + self.next_number = 100 + + def hello(self): + return "SubclassNativeFriendlyRandom" + + def next(self): + next_ = self.next_number + self.next_number += 100 + return next_ + + +class PureNativeFriendlyRandom(IFriendlyRandomGenerator): """ In this case, the class does not derive from the JsiiObject hierarchy. It means that when we pass it along to javascript, we won't have an objref. This should @@ -638,8 +651,7 @@ def the_property(self, value): def test_propertyOverrides_interfaces(): - @jsii.implements(IInterfaceWithProperties) - class TInterfaceWithProperties: + class TInterfaceWithProperties(IInterfaceWithProperties): x = None @@ -663,8 +675,7 @@ def read_write_string(self, value): def test_interfaceBuilder(): - @jsii.implements(IInterfaceWithProperties) - class TInterfaceWithProperties: + class TInterfaceWithProperties(IInterfaceWithProperties): x = "READ_WRITE" @@ -753,6 +764,10 @@ def test_testInterfaces(): poly.say_hello(SubclassNativeFriendlyRandom()) == "oh, SubclassNativeFriendlyRandom" ) + assert ( + poly.say_hello(SubclassNativeFriendlyRandom_Inheritance()) + == "oh, SubclassNativeFriendlyRandom" + ) assert poly.say_hello(PureNativeFriendlyRandom()) == "oh, I am a native!" @@ -777,6 +792,20 @@ def test_testNativeObjectsWithInterfaces(): assert generator_bound_to_pure_native.next_times100() == 100_000 assert generator_bound_to_pure_native.next_times100() == 200_000 + ### + # One more time, but this time implementing the interface via "classic" inheritance. + ### + subclassed_native = SubclassNativeFriendlyRandom_Inheritance() + generator_bound_to_p_subclassed_object = NumberGenerator(subclassed_native) + + assert generator_bound_to_p_subclassed_object.generator is subclassed_native + generator_bound_to_p_subclassed_object.is_same_generator(subclassed_native) + assert generator_bound_to_p_subclassed_object.next_times100() == 10000 + + # When we invoke nextTimes100 again, it will use the objref and call into the same + # object. + assert generator_bound_to_p_subclassed_object.next_times100() == 20000 + def test_testLiteralInterface(): obj = JSObjectLiteralForInterface() @@ -1106,14 +1135,12 @@ def test_structs_can_be_downcasted_to_parent_type(): assert Demonstrate982.take_this_too() is not None -@jsii.implements(IBellRinger) -class PythonBellRinger: +class PythonBellRinger(IBellRinger): def your_turn(self, bell): bell.ring() -@jsii.implements(IConcreteBellRinger) -class PythonConcreteBellRinger: +class PythonConcreteBellRinger(IConcreteBellRinger): def your_turn(self, bell): bell.ring() @@ -1150,8 +1177,7 @@ def test_can_obtain_struct_reference_with_overloaded_setter(): def test_pure_interfaces_can_be_used_transparently(): expected = StructB(required_string="It's Britney b**ch!") - @jsii.implements(IStructReturningDelegate) - class StructReturningDelegate: + class StructReturningDelegate(IStructReturningDelegate): def return_struct(self): return expected @@ -1163,8 +1189,7 @@ def return_struct(self): def test_pure_interfaces_can_be_used_transparently_when_transitively_implementing(): expected = StructB(required_string="It's Britney b**ch!") - @jsii.implements(IStructReturningDelegate) - class ImplementsStructReturningDelegate: + class ImplementsStructReturningDelegate(IStructReturningDelegate): def return_struct(self): return expected @@ -1181,8 +1206,7 @@ class IndirectlyImplementsStructReturningDelegate( def test_pure_interfaces_can_be_used_transparently_when_added_to_jsii_type(): expected = StructB(required_string="It's Britney b**ch!") - @jsii.implements(IStructReturningDelegate) - class ImplementsAdditionalInterface(AllTypes): + class ImplementsAdditionalInterface(AllTypes, IStructReturningDelegate): def return_struct(self): return expected @@ -1272,8 +1296,7 @@ def test_kwargs_from_superinterface_are_working(): def test_iso8601_does_not_deserialize_to_date(): - @jsii.implements(IWallClock) - class WallClock: + class WallClock(IWallClock): def __init__(self, now: str): self.now = now @@ -1301,8 +1324,7 @@ def test_class_can_extend_and_implement_from_jsii(): See also https://github.com/aws/jsii/issues/2963 """ - @jsii.implements(IWallClock) - class WallClock(ClassWithSelf): + class WallClock(ClassWithSelf, IWallClock): def __init__(self, now: str): super().__init__(now) self.now = now diff --git a/packages/jsii-pacmak/lib/generator.ts b/packages/jsii-pacmak/lib/generator.ts index 0e7be32f55..ade01f824b 100644 --- a/packages/jsii-pacmak/lib/generator.ts +++ b/packages/jsii-pacmak/lib/generator.ts @@ -676,7 +676,14 @@ export abstract class Generator implements IGenerator { ); } + /** + * @deprecated use findReflectType instead. + */ protected findType(fqn: string): spec.Type { + return this.findReflectType(fqn).spec; + } + + protected findReflectType(fqn: string): reflect.Type { const ret = this.reflectAssembly.system.tryFindFqn(fqn); if (!ret) { throw new Error( @@ -684,6 +691,6 @@ export abstract class Generator implements IGenerator { ); } - return ret.spec; + return ret; } } diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index 6410ad8ed1..fc54be5e72 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -315,10 +315,12 @@ function isSortableType(arg: unknown): arg is ISortableType { interface PythonTypeOpts { bases?: spec.TypeReference[]; + interfaces?: readonly spec.NamedTypeReference[]; } abstract class BasePythonClassType implements PythonType, ISortableType { protected bases: spec.TypeReference[]; + protected interfaces: readonly spec.NamedTypeReference[]; protected members: PythonBase[]; protected readonly separateMembers: boolean = true; @@ -327,12 +329,11 @@ abstract class BasePythonClassType implements PythonType, ISortableType { public readonly pythonName: string, public readonly spec: spec.Type, public readonly fqn: string | undefined, - opts: PythonTypeOpts, + { bases = [], interfaces = [] }: PythonTypeOpts, public readonly docs: spec.Docs | undefined, ) { - const { bases = [] } = opts; - this.bases = bases; + this.interfaces = interfaces; this.members = []; } @@ -340,10 +341,12 @@ abstract class BasePythonClassType implements PythonType, ISortableType { const dependencies = new Array(); const parent = resolver.getParent(this.fqn!); - // We need to return any bases that are in the same module at the same level of - // nesting. + // We need to return any bases that are in the same module at the same level + // of nesting. For the purpose of this function, interfaces are also bases + // (those are python base classes, and we'll extend interfaces being + // implemented) const seen = new Set(); - for (const base of this.bases) { + for (const base of [...this.bases, ...this.interfaces]) { if (spec.isNamedTypeReference(base)) { if (resolver.isInModule(base)) { // Given a base, we need to locate the base's parent that is the same as @@ -371,7 +374,9 @@ abstract class BasePythonClassType implements PythonType, ISortableType { public requiredImports(context: EmitContext): PythonImports { return mergePythonImports( - ...this.bases.map((base) => toTypeName(base).requiredImports(context)), + ...[...this.bases, ...this.interfaces].map((base) => + toTypeName(base).requiredImports(context), + ), ...this.members.map((mem) => mem.requiredImports(context)), ); } @@ -508,10 +513,8 @@ abstract class BaseMethod implements PythonBase { public emit( code: CodeMaker, context: EmitContext, - opts?: BaseMethodEmitOpts, + { renderAbstract = true, forceEmitBody = false }: BaseMethodEmitOpts = {}, ) { - const { renderAbstract = true, forceEmitBody = false } = opts ?? {}; - const returnType: string = toTypeName(this.returns).pythonType(context); // We cannot (currently?) blindly use the names given to us by the JSII for @@ -623,7 +626,6 @@ abstract class BaseMethod implements PythonBase { const decorators = new Array(); if (this.jsName !== undefined) { - // "# type: ignore[misc]" needed because mypy does not know how to check decorated declarations decorators.push(`@jsii.member(jsii_name="${this.jsName}")`); } @@ -636,10 +638,7 @@ abstract class BaseMethod implements PythonBase { } if (decorators.length > 0) { - // "# type: ignore[misc]" needed because mypy does not know how to check decorated declarations - for (const decorator of decorators - .join(' # type: ignore[misc]\n') - .split('\n')) { + for (const decorator of decorators) { code.line(decorator); } } @@ -874,13 +873,11 @@ abstract class BaseProperty implements PythonBase { public emit( code: CodeMaker, context: EmitContext, - opts?: BasePropertyEmitOpts, + { renderAbstract = true, forceEmitBody = false }: BasePropertyEmitOpts = {}, ) { - const { renderAbstract = true, forceEmitBody = false } = opts ?? {}; const pythonType = toTypeName(this.type).pythonType(context); - // "# type: ignore[misc]" is needed because mypy cannot check decorated things - code.line(`@${this.decorator} # type: ignore[misc]`); + code.line(`@${this.decorator}`); code.line(`@jsii.member(jsii_name="${this.jsName}")`); if (renderAbstract && this.abstract) { code.line('@abc.abstractmethod'); @@ -942,10 +939,40 @@ abstract class BaseProperty implements PythonBase { } class Interface extends BasePythonClassType { + public constructor( + generator: PythonGenerator, + pythonName: string, + spec: spec.Type, + fqn: string | undefined, + opts: Omit & { readonly bases?: never }, + docs: spec.Docs | undefined, + ) { + super(generator, pythonName, spec, fqn, opts, docs); + } + public emit(code: CodeMaker, context: EmitContext) { context = nestedContext(context, this.fqn); emitList(code, '@jsii.interface(', [`jsii_type="${this.fqn}"`], ')'); + const interfaces = this.interfaces + // Only emit decorators for foreign interfaces (those could be Protocols, we don't know yet) + .filter((iface) => !context.resolver.isInModule(iface)) + // Turn all those interface types to type reference names... + .map((iface) => toTypeName(iface).pythonType(context)); + // If we have anything, emit an `@jsii.implements` declaration. + if (interfaces.length > 0) { + emitList( + code, + '@jsii.implements(', + interfaces.map( + (iface) => + // Only list the interface if it's a Protocol, as otherwise this will trigger a warning. + `*((${iface},) if type(${iface}) is type(typing_extensions.Protocol) else ())`, + ), + ')', + ); + } + // First we do our normal class logic for emitting our members. super.emit(code, context); @@ -953,13 +980,12 @@ class Interface extends BasePythonClassType { code.line(); // Then, we have to emit a Proxy class which implements our proxy interface. - const proxyBases: string[] = this.bases.map( - (b) => - // "# type: ignore[misc]" because MyPy cannot check dynamic base classes (naturally) - `jsii.proxy_for(${toTypeName(b).pythonType({ + const proxyBases: string[] = this.interfaces.map( + (iface) => + `jsii.proxy_for(${toTypeName(iface).pythonType({ ...context, typeAnnotation: false, - })}) # type: ignore[misc]`, + })})`, ); openSignature(code, 'class', this.proxyClassName, proxyBases); this.generator.emitDocString(code, this.apiLocation, this.docs, { @@ -973,7 +999,10 @@ class Interface extends BasePythonClassType { if (this.separateMembers) { code.line(); } - member.emit(code, context, { forceEmitBody: true }); + member.emit(code, context, { + forceEmitBody: true, + renderAbstract: false, + }); } } else { code.line('pass'); @@ -994,11 +1023,21 @@ class Interface extends BasePythonClassType { } protected getClassParams(context: EmitContext): string[] { - const params: string[] = this.bases.map((b) => - toTypeName(b).pythonType({ ...context, typeAnnotation: false }), - ); + const params: string[] = this.interfaces.map((iface) => { + const rawTypeName = toTypeName(iface).pythonType({ + ...context, + typeAnnotation: false, + }); + return context.resolver.isInModule(iface) + ? rawTypeName + : // If the interface is a protocol, we cannot "directly" extend it, as that would end up + // causing a metaclass conflict. Those will effectively be "duck typed" in, so that is okay. + // The "erasure" is achieved by splat-ing an empty tuple in case it's a Protocol. + `*(() if type(${rawTypeName}) is type(typing_extensions.Protocol) else (${rawTypeName},))`; + }); - params.push('typing_extensions.Protocol'); + // Interfaces are kind of like abstract classes. We type them the same way. + params.push('metaclass = jsii.JSIIAbstractClass'); return params; } @@ -1009,12 +1048,16 @@ class Interface extends BasePythonClassType { } class InterfaceMethod extends BaseMethod { + // Interface members are always abstract + public readonly abstract = true; protected readonly implicitParameter: string = 'self'; protected readonly jsiiMethod: string = 'invoke'; protected readonly shouldEmitBody: boolean = false; } class InterfaceProperty extends BaseProperty { + // Interface members are always abstract + public readonly abstract = true; protected readonly decorator: string = 'builtins.property'; protected readonly implicitParameter: string = 'self'; protected readonly jsiiGetMethod: string = 'get'; @@ -1283,7 +1326,6 @@ interface ClassOpts extends PythonTypeOpts { class Class extends BasePythonClassType implements ISortableType { private readonly abstract: boolean; private readonly abstractBases: spec.ClassType[]; - private readonly interfaces: spec.NamedTypeReference[]; public constructor( generator: PythonGenerator, @@ -1295,10 +1337,9 @@ class Class extends BasePythonClassType implements ISortableType { ) { super(generator, name, spec, fqn, opts, docs); - const { abstract = false, interfaces = [], abstractBases = [] } = opts; + const { abstract = false, abstractBases = [] } = opts; this.abstract = abstract; - this.interfaces = interfaces; this.abstractBases = abstractBases; } @@ -1333,24 +1374,7 @@ class Class extends BasePythonClassType implements ISortableType { return dependencies; } - public requiredImports(context: EmitContext): PythonImports { - return mergePythonImports( - super.requiredImports(context), // Takes care of base & members - ...this.interfaces.map((base) => - toTypeName(base).requiredImports(context), - ), - ); - } - public emit(code: CodeMaker, context: EmitContext) { - // First we emit our implments decorator - if (this.interfaces.length > 0) { - const interfaces: string[] = this.interfaces.map((b) => - toTypeName(b).pythonType({ ...context, typeAnnotation: false }), - ); - code.line(`@jsii.implements(${interfaces.join(', ')})`); - } - // Then we do our normal class logic for emitting our members. super.emit(code, context); @@ -1362,12 +1386,11 @@ class Class extends BasePythonClassType implements ISortableType { const proxyBases = [this.pythonName]; for (const base of this.abstractBases) { - // "# type: ignore[misc]" because MyPy cannot check dynamic base classes (naturally) proxyBases.push( `jsii.proxy_for(${toTypeName(base).pythonType({ ...context, typeAnnotation: false, - })}) # type: ignore[misc]`, + })})`, ); } @@ -1409,15 +1432,27 @@ class Class extends BasePythonClassType implements ISortableType { } protected getClassParams(context: EmitContext): string[] { - const params: string[] = this.bases.map((b) => - toTypeName(b).pythonType({ ...context, typeAnnotation: false }), - ); const metaclass: string = this.abstract ? 'JSIIAbstractClass' : 'JSIIMeta'; - params.push(`metaclass=jsii.${metaclass}`); - params.push(`jsii_type="${this.fqn}"`); - - return params; + return [ + ...this.bases.map((b) => + toTypeName(b).pythonType({ ...context, typeAnnotation: false }), + ), + ...this.interfaces.map((i) => { + const rawTypeName = toTypeName(i).pythonType({ + ...context, + typeAnnotation: false, + }); + // If the interface is a protocol, we cannot "directly" extend it, as that would end up + // causing a metaclass conflict. Those will effectively be "duck typed" in, so that is okay. + // The "erasure" is achieved by splat-ing an empty tuple in case it's a Protocol. + return context.resolver.isInModule(i) + ? rawTypeName + : `*(() if type(${rawTypeName}) is type(typing_extensions.Protocol) else (${rawTypeName},))`; + }), + `metaclass=jsii.${metaclass}`, + `jsii_type="${this.fqn}"`, + ]; } private get proxyClassName(): string { @@ -1449,7 +1484,7 @@ class AsyncMethod extends BaseMethod { } class StaticProperty extends BaseProperty { - protected readonly decorator: string = 'jsii.python.classproperty'; + protected readonly decorator: string = 'jsii.python.class_property'; protected readonly implicitParameter: string = 'cls'; protected readonly jsiiGetMethod: string = 'sget'; protected readonly jsiiSetMethod: string = 'sset'; @@ -2517,7 +2552,7 @@ class PythonGenerator extends Generator { { abstract, bases: cls.base ? [this.findType(cls.base)] : undefined, - interfaces: cls.interfaces?.map((base) => this.findType(base)), + interfaces: this.deduplicatedInterfaces(cls.interfaces, cls.base), abstractBases: abstract ? this.getAbstractBases(cls) : [], }, cls.docs, @@ -2666,7 +2701,7 @@ class PythonGenerator extends Generator { toPythonIdentifier(ifc.name), ifc, ifc.fqn, - { bases: ifc.interfaces?.map((base) => this.findType(base)) }, + { interfaces: this.deduplicatedInterfaces(ifc.interfaces) }, ifc.docs, ); } @@ -2756,6 +2791,52 @@ class PythonGenerator extends Generator { throw new Error('Unhandled Type: StaticMethodOverload'); } + /** + * De-duplicates a list of interfaces, removing those that are already transitively implemented. + * This is useful as Python will not manage to create a consistent MRO in case the same interface + * is both directly and transitively extended (as a consistent MRO would then require that + * interface to be at two different locations in the list). + * + * @param fqns a possibly empty set of interface FQNs to de-duplicate. + * @param baseFqns the list of base classes that may also implement interfaces + * + * @returns the de-duplicated list of interface types. + */ + private deduplicatedInterfaces( + fqns: readonly string[] | undefined, + baseFqn?: string, + ) { + if (fqns == null) { + return []; + } + + const result = new Array(); + + const interfaces = fqns + .map((fqn) => this.findReflectType(fqn) as reflect.InterfaceType) + .reverse(); + const base = + baseFqn == null + ? undefined + : (this.findReflectType(baseFqn) as reflect.ClassType); + while (interfaces.length > 0) { + const iface = interfaces.pop()!; + if ( + interfaces.some((other) => + other.getInterfaces(true).some(({ fqn }) => fqn === iface.fqn), + ) + ) { + continue; + } + if (base?.getInterfaces(true).some(({ fqn }) => fqn === iface.fqn)) { + continue; + } + result.push(iface.spec); + } + + return result; + } + private getAssemblyModuleName(assm: spec.Assembly): string { return `${assm.targets!.python!.module}._jsii`; } diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap index ba54e825bd..4c432f9dfb 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap @@ -1232,7 +1232,7 @@ from ._jsii import * class Consumer(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Consumer"): - @jsii.member(jsii_name="consumeBaz") # type: ignore[misc] + @jsii.member(jsii_name="consumeBaz") @builtins.classmethod def consume_baz( cls, @@ -2571,13 +2571,15 @@ class Namespace1(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Namespace1"): ) @jsii.interface(jsii_type="testpkg.Namespace1.IBar") - class IBar(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] + class IBar(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="bar") + @abc.abstractmethod def bar(self) -> builtins.str: ... @jsii.member(jsii_name="method") + @abc.abstractmethod def method(self) -> None: ... @@ -2585,7 +2587,7 @@ class Namespace1(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Namespace1"): class _IBarProxy: __jsii_type__: typing.ClassVar[str] = "testpkg.Namespace1.IBar" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="bar") def bar(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "bar")) @@ -2614,7 +2616,7 @@ class Namespace2(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Namespace2"): def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="done") def done(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "done")) diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap index 947dde8d37..9b1aaae822 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap @@ -397,17 +397,21 @@ class BaseProps(scope.jsii_calc_base_of_base.VeryBaseProps): @jsii.interface(jsii_type="@scope/jsii-calc-base.IBaseInterface") +@jsii.implements( + *((scope.jsii_calc_base_of_base.IVeryBaseInterface,) if type(scope.jsii_calc_base_of_base.IVeryBaseInterface) is type(typing_extensions.Protocol) else ()) +) class IBaseInterface( - scope.jsii_calc_base_of_base.IVeryBaseInterface, - typing_extensions.Protocol, + *(() if type(scope.jsii_calc_base_of_base.IVeryBaseInterface) is type(typing_extensions.Protocol) else (scope.jsii_calc_base_of_base.IVeryBaseInterface,)), + metaclass = jsii.JSIIAbstractClass, ): @jsii.member(jsii_name="bar") + @abc.abstractmethod def bar(self) -> None: ... class _IBaseInterfaceProxy( - jsii.proxy_for(scope.jsii_calc_base_of_base.IVeryBaseInterface), # type: ignore[misc] + jsii.proxy_for(scope.jsii_calc_base_of_base.IVeryBaseInterface), ): __jsii_type__: typing.ClassVar[str] = "@scope/jsii-calc-base.IBaseInterface" @@ -428,7 +432,7 @@ class StaticConsumer( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="consume") # type: ignore[misc] + @jsii.member(jsii_name="consume") @builtins.classmethod def consume(cls, *args: typing.Any) -> None: ''' @@ -808,8 +812,9 @@ from ._jsii import * @jsii.interface(jsii_type="@scope/jsii-calc-base-of-base.IVeryBaseInterface") -class IVeryBaseInterface(typing_extensions.Protocol): +class IVeryBaseInterface(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="foo") + @abc.abstractmethod def foo(self) -> None: ... @@ -829,7 +834,7 @@ class StaticConsumer( metaclass=jsii.JSIIMeta, jsii_type="@scope/jsii-calc-base-of-base.StaticConsumer", ): - @jsii.member(jsii_name="consume") # type: ignore[misc] + @jsii.member(jsii_name="consume") @builtins.classmethod def consume(cls, *_args: typing.Any) -> None: ''' @@ -1423,14 +1428,15 @@ class EnumFromScopedModule(enum.Enum): @jsii.interface(jsii_type="@scope/jsii-calc-lib.IDoublable") -class IDoublable(typing_extensions.Protocol): +class IDoublable(metaclass = jsii.JSIIAbstractClass): '''(deprecated) The general contract for a concrete number. :stability: deprecated ''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="doubleValue") + @abc.abstractmethod def double_value(self) -> jsii.Number: ''' :stability: deprecated @@ -1446,7 +1452,7 @@ class _IDoublableProxy: __jsii_type__: typing.ClassVar[str] = "@scope/jsii-calc-lib.IDoublable" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="doubleValue") def double_value(self) -> jsii.Number: ''' @@ -1459,7 +1465,7 @@ typing.cast(typing.Any, IDoublable).__jsii_proxy_class__ = lambda : _IDoublableP @jsii.interface(jsii_type="@scope/jsii-calc-lib.IFriendly") -class IFriendly(typing_extensions.Protocol): +class IFriendly(metaclass = jsii.JSIIAbstractClass): '''(deprecated) Applies to classes that are considered friendly. These classes can be greeted with @@ -1469,6 +1475,7 @@ class IFriendly(typing_extensions.Protocol): ''' @jsii.member(jsii_name="hello") + @abc.abstractmethod def hello(self) -> builtins.str: '''(deprecated) Say hello! @@ -1501,9 +1508,12 @@ typing.cast(typing.Any, IFriendly).__jsii_proxy_class__ = lambda : _IFriendlyPro @jsii.interface(jsii_type="@scope/jsii-calc-lib.IThreeLevelsInterface") +@jsii.implements( + *((scope.jsii_calc_base.IBaseInterface,) if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else ()) +) class IThreeLevelsInterface( - scope.jsii_calc_base.IBaseInterface, - typing_extensions.Protocol, + *(() if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else (scope.jsii_calc_base.IBaseInterface,)), + metaclass = jsii.JSIIAbstractClass, ): '''(deprecated) Interface that inherits from packages 2 levels up the tree. @@ -1514,6 +1524,7 @@ class IThreeLevelsInterface( ''' @jsii.member(jsii_name="baz") + @abc.abstractmethod def baz(self) -> None: ''' :stability: deprecated @@ -1521,9 +1532,7 @@ class IThreeLevelsInterface( ... -class _IThreeLevelsInterfaceProxy( - jsii.proxy_for(scope.jsii_calc_base.IBaseInterface) # type: ignore[misc] -): +class _IThreeLevelsInterfaceProxy(jsii.proxy_for(scope.jsii_calc_base.IBaseInterface)): '''(deprecated) Interface that inherits from packages 2 levels up the tree. Their presence validates that .NET/Java/jsii-reflect can track all fields @@ -1638,7 +1647,7 @@ class NumericValue( ''' return typing.cast(builtins.str, jsii.invoke(self, "toString", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") @abc.abstractmethod def value(self) -> jsii.Number: @@ -1649,10 +1658,8 @@ class NumericValue( ... -class _NumericValueProxy( - NumericValue, jsii.proxy_for(scope.jsii_calc_base.Base) # type: ignore[misc] -): - @builtins.property # type: ignore[misc] +class _NumericValueProxy(NumericValue, jsii.proxy_for(scope.jsii_calc_base.Base)): + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: '''(deprecated) The value. @@ -1678,7 +1685,7 @@ class Operation( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="toString") # type: ignore[misc] + @jsii.member(jsii_name="toString") @abc.abstractmethod def to_string(self) -> builtins.str: '''(deprecated) String representation of the value. @@ -1688,9 +1695,7 @@ class Operation( ... -class _OperationProxy( - Operation, jsii.proxy_for(NumericValue) # type: ignore[misc] -): +class _OperationProxy(Operation, jsii.proxy_for(NumericValue)): @jsii.member(jsii_name="toString") def to_string(self) -> builtins.str: '''(deprecated) String representation of the value. @@ -1773,9 +1778,9 @@ class StructWithOnlyOptionals: ) -@jsii.implements(IDoublable) class Number( NumericValue, + IDoublable, metaclass=jsii.JSIIMeta, jsii_type="@scope/jsii-calc-lib.Number", ): @@ -1793,7 +1798,7 @@ class Number( ''' jsii.create(self.__class__, self, [value]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="doubleValue") def double_value(self) -> jsii.Number: '''(deprecated) The number multiplied by 2. @@ -1802,7 +1807,7 @@ class Number( ''' return typing.cast(jsii.Number, jsii.get(self, "doubleValue")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: '''(deprecated) The number. @@ -1882,13 +1887,14 @@ from .._jsii import * @jsii.interface(jsii_type="@scope/jsii-calc-lib.submodule.IReflectable") -class IReflectable(typing_extensions.Protocol): +class IReflectable(metaclass = jsii.JSIIAbstractClass): ''' :stability: deprecated ''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="entries") + @abc.abstractmethod def entries(self) -> typing.List["ReflectableEntry"]: ''' :stability: deprecated @@ -1903,7 +1909,7 @@ class _IReflectableProxy: __jsii_type__: typing.ClassVar[str] = "@scope/jsii-calc-lib.submodule.IReflectable" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="entries") def entries(self) -> typing.List["ReflectableEntry"]: ''' @@ -1939,7 +1945,7 @@ class NestingClass( ''' jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") def property(self) -> builtins.str: ''' @@ -2569,7 +2575,7 @@ class AbstractClassBase( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="abstractProperty") @abc.abstractmethod def abstract_property(self) -> builtins.str: @@ -2577,7 +2583,7 @@ class AbstractClassBase( class _AbstractClassBaseProxy(AbstractClassBase): - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="abstractProperty") def abstract_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "abstractProperty")) @@ -2601,7 +2607,7 @@ class AbstractClassReturner( def give_me_interface(self) -> "IInterfaceImplementedByAbstractClass": return typing.cast("IInterfaceImplementedByAbstractClass", jsii.invoke(self, "giveMeInterface", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="returnAbstractFromProperty") def return_abstract_from_property(self) -> AbstractClassBase: return typing.cast(AbstractClassBase, jsii.get(self, "returnAbstractFromProperty")) @@ -2616,7 +2622,7 @@ class AbstractSuite( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="someMethod") # type: ignore[misc] + @jsii.member(jsii_name="someMethod") @abc.abstractmethod def _some_method(self, str: builtins.str) -> builtins.str: ''' @@ -2632,7 +2638,7 @@ class AbstractSuite( ''' return typing.cast(builtins.str, jsii.invoke(self, "workItAll", [seed])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") @abc.abstractmethod def _property(self) -> builtins.str: @@ -2652,7 +2658,7 @@ class _AbstractSuiteProxy(AbstractSuite): ''' return typing.cast(builtins.str, jsii.invoke(self, "someMethod", [str])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") def _property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "property")) @@ -2693,12 +2699,12 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): ''' return typing.cast("StringEnum", jsii.invoke(self, "enumMethod", [value])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="enumPropertyValue") def enum_property_value(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "enumPropertyValue")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="anyArrayProperty") def any_array_property(self) -> typing.List[typing.Any]: return typing.cast(typing.List[typing.Any], jsii.get(self, "anyArrayProperty")) @@ -2707,7 +2713,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def any_array_property(self, value: typing.List[typing.Any]) -> None: jsii.set(self, "anyArrayProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="anyMapProperty") def any_map_property(self) -> typing.Mapping[builtins.str, typing.Any]: return typing.cast(typing.Mapping[builtins.str, typing.Any], jsii.get(self, "anyMapProperty")) @@ -2716,7 +2722,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def any_map_property(self, value: typing.Mapping[builtins.str, typing.Any]) -> None: jsii.set(self, "anyMapProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="anyProperty") def any_property(self) -> typing.Any: return typing.cast(typing.Any, jsii.get(self, "anyProperty")) @@ -2725,7 +2731,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def any_property(self, value: typing.Any) -> None: jsii.set(self, "anyProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arrayProperty") def array_property(self) -> typing.List[builtins.str]: return typing.cast(typing.List[builtins.str], jsii.get(self, "arrayProperty")) @@ -2734,7 +2740,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def array_property(self, value: typing.List[builtins.str]) -> None: jsii.set(self, "arrayProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="booleanProperty") def boolean_property(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "booleanProperty")) @@ -2743,7 +2749,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def boolean_property(self, value: builtins.bool) -> None: jsii.set(self, "booleanProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="dateProperty") def date_property(self) -> datetime.datetime: return typing.cast(datetime.datetime, jsii.get(self, "dateProperty")) @@ -2752,7 +2758,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def date_property(self, value: datetime.datetime) -> None: jsii.set(self, "dateProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="enumProperty") def enum_property(self) -> "AllTypesEnum": return typing.cast("AllTypesEnum", jsii.get(self, "enumProperty")) @@ -2761,7 +2767,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def enum_property(self, value: "AllTypesEnum") -> None: jsii.set(self, "enumProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="jsonProperty") def json_property(self) -> typing.Mapping[typing.Any, typing.Any]: return typing.cast(typing.Mapping[typing.Any, typing.Any], jsii.get(self, "jsonProperty")) @@ -2770,7 +2776,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def json_property(self, value: typing.Mapping[typing.Any, typing.Any]) -> None: jsii.set(self, "jsonProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mapProperty") def map_property(self) -> typing.Mapping[builtins.str, scope.jsii_calc_lib.Number]: return typing.cast(typing.Mapping[builtins.str, scope.jsii_calc_lib.Number], jsii.get(self, "mapProperty")) @@ -2782,7 +2788,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): ) -> None: jsii.set(self, "mapProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="numberProperty") def number_property(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "numberProperty")) @@ -2791,7 +2797,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def number_property(self, value: jsii.Number) -> None: jsii.set(self, "numberProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="stringProperty") def string_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "stringProperty")) @@ -2800,7 +2806,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def string_property(self, value: builtins.str) -> None: jsii.set(self, "stringProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unionArrayProperty") def union_array_property( self, @@ -2814,7 +2820,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): ) -> None: jsii.set(self, "unionArrayProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unionMapProperty") def union_map_property( self, @@ -2828,7 +2834,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): ) -> None: jsii.set(self, "unionMapProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unionProperty") def union_property( self, @@ -2842,7 +2848,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): ) -> None: jsii.set(self, "unionProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unknownArrayProperty") def unknown_array_property(self) -> typing.List[typing.Any]: return typing.cast(typing.List[typing.Any], jsii.get(self, "unknownArrayProperty")) @@ -2851,7 +2857,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def unknown_array_property(self, value: typing.List[typing.Any]) -> None: jsii.set(self, "unknownArrayProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unknownMapProperty") def unknown_map_property(self) -> typing.Mapping[builtins.str, typing.Any]: return typing.cast(typing.Mapping[builtins.str, typing.Any], jsii.get(self, "unknownMapProperty")) @@ -2863,7 +2869,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): ) -> None: jsii.set(self, "unknownMapProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unknownProperty") def unknown_property(self) -> typing.Any: return typing.cast(typing.Any, jsii.get(self, "unknownProperty")) @@ -2872,7 +2878,7 @@ class AllTypes(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AllTypes"): def unknown_property(self, value: typing.Any) -> None: jsii.set(self, "unknownProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="optionalEnumValue") def optional_enum_value(self) -> typing.Optional["StringEnum"]: return typing.cast(typing.Optional["StringEnum"], jsii.get(self, "optionalEnumValue")) @@ -2951,12 +2957,12 @@ class AmbiguousParameters( jsii.create(self.__class__, self, [scope_, props_]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="props") def props(self) -> "StructParameterType": return typing.cast("StructParameterType", jsii.get(self, "props")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="scope") def scope(self) -> "Bell": return typing.cast("Bell", jsii.get(self, "scope")) @@ -3022,9 +3028,9 @@ class BaseJsii976(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.BaseJsii976"): jsii.create(self.__class__, self, []) -@jsii.implements(scope.jsii_calc_lib.IFriendly) class BinaryOperation( scope.jsii_calc_lib.Operation, + *(() if type(scope.jsii_calc_lib.IFriendly) is type(typing_extensions.Protocol) else (scope.jsii_calc_lib.IFriendly,)), metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.BinaryOperation", ): @@ -3047,13 +3053,13 @@ class BinaryOperation( '''Say hello!''' return typing.cast(builtins.str, jsii.invoke(self, "hello", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="lhs") def lhs(self) -> scope.jsii_calc_lib.NumericValue: '''Left-hand side operand.''' return typing.cast(scope.jsii_calc_lib.NumericValue, jsii.get(self, "lhs")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="rhs") def rhs(self) -> scope.jsii_calc_lib.NumericValue: '''Right-hand side operand.''' @@ -3061,7 +3067,8 @@ class BinaryOperation( class _BinaryOperationProxy( - BinaryOperation, jsii.proxy_for(scope.jsii_calc_lib.Operation) # type: ignore[misc] + BinaryOperation, + jsii.proxy_for(scope.jsii_calc_lib.Operation), ): pass @@ -3082,7 +3089,7 @@ class BurriedAnonymousObject( def check(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.invoke(self, "check", [])) - @jsii.member(jsii_name="giveItBack") # type: ignore[misc] + @jsii.member(jsii_name="giveItBack") @abc.abstractmethod def give_it_back(self, value: typing.Any) -> typing.Any: '''Implement this method and have it return it's parameter. @@ -3184,19 +3191,19 @@ class Calculator( '''Returns teh value of the union property (if defined).''' return typing.cast(jsii.Number, jsii.invoke(self, "readUnionValue", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="expression") def expression(self) -> scope.jsii_calc_lib.NumericValue: '''Returns the expression.''' return typing.cast(scope.jsii_calc_lib.NumericValue, jsii.get(self, "expression")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="operationsLog") def operations_log(self) -> typing.List[scope.jsii_calc_lib.NumericValue]: '''A log of all operations.''' return typing.cast(typing.List[scope.jsii_calc_lib.NumericValue], jsii.get(self, "operationsLog")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="operationsMap") def operations_map( self, @@ -3204,7 +3211,7 @@ class Calculator( '''A map of per operation name of all operations performed.''' return typing.cast(typing.Mapping[builtins.str, typing.List[scope.jsii_calc_lib.NumericValue]], jsii.get(self, "operationsMap")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="curr") def curr(self) -> scope.jsii_calc_lib.NumericValue: '''The current value.''' @@ -3214,7 +3221,7 @@ class Calculator( def curr(self, value: scope.jsii_calc_lib.NumericValue) -> None: jsii.set(self, "curr", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="maxValue") def max_value(self) -> typing.Optional[jsii.Number]: '''The maximum value allows in this calculator.''' @@ -3224,7 +3231,7 @@ class Calculator( def max_value(self, value: typing.Optional[jsii.Number]) -> None: jsii.set(self, "maxValue", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unionProperty") def union_property( self, @@ -3310,17 +3317,17 @@ class ClassWithCollections( ''' jsii.create(self.__class__, self, [map, array]) - @jsii.member(jsii_name="createAList") # type: ignore[misc] + @jsii.member(jsii_name="createAList") @builtins.classmethod def create_a_list(cls) -> typing.List[builtins.str]: return typing.cast(typing.List[builtins.str], jsii.sinvoke(cls, "createAList", [])) - @jsii.member(jsii_name="createAMap") # type: ignore[misc] + @jsii.member(jsii_name="createAMap") @builtins.classmethod def create_a_map(cls) -> typing.Mapping[builtins.str, builtins.str]: return typing.cast(typing.Mapping[builtins.str, builtins.str], jsii.sinvoke(cls, "createAMap", [])) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="staticArray") def static_array(cls) -> typing.List[builtins.str]: return typing.cast(typing.List[builtins.str], jsii.sget(cls, "staticArray")) @@ -3329,7 +3336,7 @@ class ClassWithCollections( def static_array(cls, value: typing.List[builtins.str]) -> None: jsii.sset(cls, "staticArray", value) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="staticMap") def static_map(cls) -> typing.Mapping[builtins.str, builtins.str]: return typing.cast(typing.Mapping[builtins.str, builtins.str], jsii.sget(cls, "staticMap")) @@ -3338,7 +3345,7 @@ class ClassWithCollections( def static_map(cls, value: typing.Mapping[builtins.str, builtins.str]) -> None: jsii.sset(cls, "staticMap", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="array") def array(self) -> typing.List[builtins.str]: return typing.cast(typing.List[builtins.str], jsii.get(self, "array")) @@ -3347,7 +3354,7 @@ class ClassWithCollections( def array(self, value: typing.List[builtins.str]) -> None: jsii.set(self, "array", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="map") def map(self) -> typing.Mapping[builtins.str, builtins.str]: return typing.cast(typing.Mapping[builtins.str, builtins.str], jsii.get(self, "map")) @@ -3385,22 +3392,22 @@ class ClassWithContainerTypes( jsii.create(self.__class__, self, [array, record, obj, props]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="array") def array(self) -> typing.List["DummyObj"]: return typing.cast(typing.List["DummyObj"], jsii.get(self, "array")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="obj") def obj(self) -> typing.Mapping[builtins.str, "DummyObj"]: return typing.cast(typing.Mapping[builtins.str, "DummyObj"], jsii.get(self, "obj")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="record") def record(self) -> typing.Mapping[builtins.str, "DummyObj"]: return typing.cast(typing.Mapping[builtins.str, "DummyObj"], jsii.get(self, "record")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="props") def props(self) -> typing.Optional["ContainerProps"]: return typing.cast(typing.Optional["ContainerProps"], jsii.get(self, "props")) @@ -3441,7 +3448,7 @@ class ClassWithJavaReservedWords( ''' return typing.cast(builtins.str, jsii.invoke(self, "import", [assert_])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="int") def int(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "int")) @@ -3454,7 +3461,7 @@ class ClassWithMutableObjectLiteralProperty( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableObject") def mutable_object(self) -> "IMutableObjectLiteral": return typing.cast("IMutableObjectLiteral", jsii.get(self, "mutableObject")) @@ -3473,17 +3480,17 @@ class ConfusingToJackson( :see: https://github.com/aws/aws-cdk/issues/4080 ''' - @jsii.member(jsii_name="makeInstance") # type: ignore[misc] + @jsii.member(jsii_name="makeInstance") @builtins.classmethod def make_instance(cls) -> "ConfusingToJackson": return typing.cast("ConfusingToJackson", jsii.sinvoke(cls, "makeInstance", [])) - @jsii.member(jsii_name="makeStructInstance") # type: ignore[misc] + @jsii.member(jsii_name="makeStructInstance") @builtins.classmethod def make_struct_instance(cls) -> "ConfusingToJacksonStruct": return typing.cast("ConfusingToJacksonStruct", jsii.sinvoke(cls, "makeStructInstance", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="unionProperty") def union_property( self, @@ -3550,37 +3557,37 @@ class Constructors(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Constructors"): def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="hiddenInterface") # type: ignore[misc] + @jsii.member(jsii_name="hiddenInterface") @builtins.classmethod def hidden_interface(cls) -> "IPublicInterface": return typing.cast("IPublicInterface", jsii.sinvoke(cls, "hiddenInterface", [])) - @jsii.member(jsii_name="hiddenInterfaces") # type: ignore[misc] + @jsii.member(jsii_name="hiddenInterfaces") @builtins.classmethod def hidden_interfaces(cls) -> typing.List["IPublicInterface"]: return typing.cast(typing.List["IPublicInterface"], jsii.sinvoke(cls, "hiddenInterfaces", [])) - @jsii.member(jsii_name="hiddenSubInterfaces") # type: ignore[misc] + @jsii.member(jsii_name="hiddenSubInterfaces") @builtins.classmethod def hidden_sub_interfaces(cls) -> typing.List["IPublicInterface"]: return typing.cast(typing.List["IPublicInterface"], jsii.sinvoke(cls, "hiddenSubInterfaces", [])) - @jsii.member(jsii_name="makeClass") # type: ignore[misc] + @jsii.member(jsii_name="makeClass") @builtins.classmethod def make_class(cls) -> "PublicClass": return typing.cast("PublicClass", jsii.sinvoke(cls, "makeClass", [])) - @jsii.member(jsii_name="makeInterface") # type: ignore[misc] + @jsii.member(jsii_name="makeInterface") @builtins.classmethod def make_interface(cls) -> "IPublicInterface": return typing.cast("IPublicInterface", jsii.sinvoke(cls, "makeInterface", [])) - @jsii.member(jsii_name="makeInterface2") # type: ignore[misc] + @jsii.member(jsii_name="makeInterface2") @builtins.classmethod def make_interface2(cls) -> "IPublicInterface2": return typing.cast("IPublicInterface2", jsii.sinvoke(cls, "makeInterface2", [])) - @jsii.member(jsii_name="makeInterfaces") # type: ignore[misc] + @jsii.member(jsii_name="makeInterfaces") @builtins.classmethod def make_interfaces(cls) -> typing.List["IPublicInterface"]: return typing.cast(typing.List["IPublicInterface"], jsii.sinvoke(cls, "makeInterfaces", [])) @@ -3614,7 +3621,7 @@ class ConsumerCanRingBell( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="staticImplementedByObjectLiteral") # type: ignore[misc] + @jsii.member(jsii_name="staticImplementedByObjectLiteral") @builtins.classmethod def static_implemented_by_object_literal( cls, @@ -3628,7 +3635,7 @@ class ConsumerCanRingBell( ''' return typing.cast(builtins.bool, jsii.sinvoke(cls, "staticImplementedByObjectLiteral", [ringer])) - @jsii.member(jsii_name="staticImplementedByPrivateClass") # type: ignore[misc] + @jsii.member(jsii_name="staticImplementedByPrivateClass") @builtins.classmethod def static_implemented_by_private_class( cls, @@ -3642,7 +3649,7 @@ class ConsumerCanRingBell( ''' return typing.cast(builtins.bool, jsii.sinvoke(cls, "staticImplementedByPrivateClass", [ringer])) - @jsii.member(jsii_name="staticImplementedByPublicClass") # type: ignore[misc] + @jsii.member(jsii_name="staticImplementedByPublicClass") @builtins.classmethod def static_implemented_by_public_class(cls, ringer: "IBellRinger") -> builtins.bool: '''...if the interface is implemented using a public class. @@ -3653,7 +3660,7 @@ class ConsumerCanRingBell( ''' return typing.cast(builtins.bool, jsii.sinvoke(cls, "staticImplementedByPublicClass", [ringer])) - @jsii.member(jsii_name="staticWhenTypedAsClass") # type: ignore[misc] + @jsii.member(jsii_name="staticWhenTypedAsClass") @builtins.classmethod def static_when_typed_as_class(cls, ringer: "IConcreteBellRinger") -> builtins.bool: '''If the parameter is a concrete class instead of an interface. @@ -3865,17 +3872,17 @@ class DefaultedConstructorArgument( ''' jsii.create(self.__class__, self, [arg1, arg2, arg3]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arg1") def arg1(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "arg1")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arg3") def arg3(self) -> datetime.datetime: return typing.cast(datetime.datetime, jsii.get(self, "arg3")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arg2") def arg2(self) -> typing.Optional[builtins.str]: return typing.cast(typing.Optional[builtins.str], jsii.get(self, "arg2")) @@ -3891,13 +3898,13 @@ class Demonstrate982(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Demonstrate98 def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="takeThis") # type: ignore[misc] + @jsii.member(jsii_name="takeThis") @builtins.classmethod def take_this(cls) -> "ChildStruct982": '''It's dangerous to go alone!''' return typing.cast("ChildStruct982", jsii.sinvoke(cls, "takeThis", [])) - @jsii.member(jsii_name="takeThisToo") # type: ignore[misc] + @jsii.member(jsii_name="takeThisToo") @builtins.classmethod def take_this_too(cls) -> "ParentStruct982": '''It's dangerous to go alone!''' @@ -3935,7 +3942,7 @@ class DeprecatedClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DeprecatedCl ''' return typing.cast(None, jsii.invoke(self, "method", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> builtins.str: ''' @@ -3945,7 +3952,7 @@ class DeprecatedClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DeprecatedCl ''' return typing.cast(builtins.str, jsii.get(self, "readonlyProperty")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: ''' @@ -4445,7 +4452,7 @@ class DisappointingCollectionSource( This source of collections is disappointing - it'll always give you nothing :( ''' - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="maybeList") def MAYBE_LIST(cls) -> typing.Optional[typing.List[builtins.str]]: '''Some List of strings, maybe? @@ -4454,7 +4461,7 @@ class DisappointingCollectionSource( ''' return typing.cast(typing.Optional[typing.List[builtins.str]], jsii.sget(cls, "maybeList")) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="maybeMap") def MAYBE_MAP(cls) -> typing.Optional[typing.Mapping[builtins.str, jsii.Number]]: '''Some Map of strings to numbers, maybe? @@ -4623,7 +4630,7 @@ class DynamicPropertyBearer( ''' jsii.create(self.__class__, self, [value_store]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="dynamicProperty") def dynamic_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "dynamicProperty")) @@ -4632,7 +4639,7 @@ class DynamicPropertyBearer( def dynamic_property(self, value: builtins.str) -> None: jsii.set(self, "dynamicProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="valueStore") def value_store(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "valueStore")) @@ -4663,7 +4670,7 @@ class DynamicPropertyBearerChild( ''' return typing.cast(builtins.str, jsii.invoke(self, "overrideValue", [new_value])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="originalValue") def original_value(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "originalValue")) @@ -4687,7 +4694,7 @@ class Entropy(metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.Entropy"): ''' return typing.cast(builtins.str, jsii.invoke(self, "increase", [])) - @jsii.member(jsii_name="repeat") # type: ignore[misc] + @jsii.member(jsii_name="repeat") @abc.abstractmethod def repeat(self, word: builtins.str) -> builtins.str: '''Implement this method such that it returns \`\`word\`\`. @@ -4715,12 +4722,12 @@ typing.cast(typing.Any, Entropy).__jsii_proxy_class__ = lambda : _EntropyProxy class EnumDispenser(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.EnumDispenser"): - @jsii.member(jsii_name="randomIntegerLikeEnum") # type: ignore[misc] + @jsii.member(jsii_name="randomIntegerLikeEnum") @builtins.classmethod def random_integer_like_enum(cls) -> AllTypesEnum: return typing.cast(AllTypesEnum, jsii.sinvoke(cls, "randomIntegerLikeEnum", [])) - @jsii.member(jsii_name="randomStringLikeEnum") # type: ignore[misc] + @jsii.member(jsii_name="randomStringLikeEnum") @builtins.classmethod def random_string_like_enum(cls) -> "StringEnum": return typing.cast("StringEnum", jsii.sinvoke(cls, "randomStringLikeEnum", [])) @@ -4733,7 +4740,7 @@ class EraseUndefinedHashValues( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="doesKeyExist") # type: ignore[misc] + @jsii.member(jsii_name="doesKeyExist") @builtins.classmethod def does_key_exist( cls, @@ -4750,13 +4757,13 @@ class EraseUndefinedHashValues( ''' return typing.cast(builtins.bool, jsii.sinvoke(cls, "doesKeyExist", [opts, key])) - @jsii.member(jsii_name="prop1IsNull") # type: ignore[misc] + @jsii.member(jsii_name="prop1IsNull") @builtins.classmethod def prop1_is_null(cls) -> typing.Mapping[builtins.str, typing.Any]: '''We expect "prop1" to be erased.''' return typing.cast(typing.Mapping[builtins.str, typing.Any], jsii.sinvoke(cls, "prop1IsNull", [])) - @jsii.member(jsii_name="prop2IsUndefined") # type: ignore[misc] + @jsii.member(jsii_name="prop2IsUndefined") @builtins.classmethod def prop2_is_undefined(cls) -> typing.Mapping[builtins.str, typing.Any]: '''We expect "prop2" to be erased.''' @@ -4835,7 +4842,7 @@ class ExperimentalClass( ''' return typing.cast(None, jsii.invoke(self, "method", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> builtins.str: ''' @@ -4843,7 +4850,7 @@ class ExperimentalClass( ''' return typing.cast(builtins.str, jsii.get(self, "readonlyProperty")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: ''' @@ -4919,7 +4926,7 @@ class ExportedBaseClass( ''' jsii.create(self.__class__, self, [success]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="success") def success(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "success")) @@ -4990,7 +4997,7 @@ class ExternalClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ExternalClass" ''' return typing.cast(None, jsii.invoke(self, "method", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> builtins.str: ''' @@ -4998,7 +5005,7 @@ class ExternalClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ExternalClass" ''' return typing.cast(builtins.str, jsii.get(self, "readonlyProperty")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: ''' @@ -5168,7 +5175,7 @@ class GiveMeStructs(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.GiveMeStructs" return typing.cast(jsii.Number, jsii.invoke(self, "readFirstNumber", [first])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="structLiteral") def struct_literal(self) -> scope.jsii_calc_lib.StructWithOnlyOptionals: return typing.cast(scope.jsii_calc_lib.StructWithOnlyOptionals, jsii.get(self, "structLiteral")) @@ -5226,14 +5233,16 @@ class GreetingAugmenter( @jsii.interface(jsii_type="jsii-calc.IAnonymousImplementationProvider") -class IAnonymousImplementationProvider(typing_extensions.Protocol): +class IAnonymousImplementationProvider(metaclass = jsii.JSIIAbstractClass): '''We can return an anonymous interface implementation from an override without losing the interface declarations.''' @jsii.member(jsii_name="provideAsClass") + @abc.abstractmethod def provide_as_class(self) -> "Implementation": ... @jsii.member(jsii_name="provideAsInterface") + @abc.abstractmethod def provide_as_interface(self) -> "IAnonymouslyImplementMe": ... @@ -5256,13 +5265,15 @@ typing.cast(typing.Any, IAnonymousImplementationProvider).__jsii_proxy_class__ = @jsii.interface(jsii_type="jsii-calc.IAnonymouslyImplementMe") -class IAnonymouslyImplementMe(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IAnonymouslyImplementMe(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="value") + @abc.abstractmethod def value(self) -> jsii.Number: ... @jsii.member(jsii_name="verb") + @abc.abstractmethod def verb(self) -> builtins.str: ... @@ -5270,7 +5281,7 @@ class IAnonymouslyImplementMe(typing_extensions.Protocol): class _IAnonymouslyImplementMeProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IAnonymouslyImplementMe" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "value")) @@ -5284,13 +5295,15 @@ typing.cast(typing.Any, IAnonymouslyImplementMe).__jsii_proxy_class__ = lambda : @jsii.interface(jsii_type="jsii-calc.IAnotherPublicInterface") -class IAnotherPublicInterface(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IAnotherPublicInterface(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="a") + @abc.abstractmethod def a(self) -> builtins.str: ... @a.setter + @abc.abstractmethod def a(self, value: builtins.str) -> None: ... @@ -5298,7 +5311,7 @@ class IAnotherPublicInterface(typing_extensions.Protocol): class _IAnotherPublicInterfaceProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IAnotherPublicInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="a") def a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "a")) @@ -5312,8 +5325,9 @@ typing.cast(typing.Any, IAnotherPublicInterface).__jsii_proxy_class__ = lambda : @jsii.interface(jsii_type="jsii-calc.IBell") -class IBell(typing_extensions.Protocol): +class IBell(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="ring") + @abc.abstractmethod def ring(self) -> None: ... @@ -5330,10 +5344,11 @@ typing.cast(typing.Any, IBell).__jsii_proxy_class__ = lambda : _IBellProxy @jsii.interface(jsii_type="jsii-calc.IBellRinger") -class IBellRinger(typing_extensions.Protocol): +class IBellRinger(metaclass = jsii.JSIIAbstractClass): '''Takes the object parameter as an interface.''' @jsii.member(jsii_name="yourTurn") + @abc.abstractmethod def your_turn(self, bell: IBell) -> None: ''' :param bell: - @@ -5358,10 +5373,11 @@ typing.cast(typing.Any, IBellRinger).__jsii_proxy_class__ = lambda : _IBellRinge @jsii.interface(jsii_type="jsii-calc.IConcreteBellRinger") -class IConcreteBellRinger(typing_extensions.Protocol): +class IConcreteBellRinger(metaclass = jsii.JSIIAbstractClass): '''Takes the object parameter as a calss.''' @jsii.member(jsii_name="yourTurn") + @abc.abstractmethod def your_turn(self, bell: "Bell") -> None: ''' :param bell: - @@ -5386,15 +5402,16 @@ typing.cast(typing.Any, IConcreteBellRinger).__jsii_proxy_class__ = lambda : _IC @jsii.interface(jsii_type="jsii-calc.IDeprecatedInterface") -class IDeprecatedInterface(typing_extensions.Protocol): +class IDeprecatedInterface(metaclass = jsii.JSIIAbstractClass): ''' :deprecated: useless interface :stability: deprecated ''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") + @abc.abstractmethod def mutable_property(self) -> typing.Optional[jsii.Number]: ''' :deprecated: could be better @@ -5404,10 +5421,12 @@ class IDeprecatedInterface(typing_extensions.Protocol): ... @mutable_property.setter + @abc.abstractmethod def mutable_property(self, value: typing.Optional[jsii.Number]) -> None: ... @jsii.member(jsii_name="method") + @abc.abstractmethod def method(self) -> None: ''' :deprecated: services no purpose @@ -5426,7 +5445,7 @@ class _IDeprecatedInterfaceProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IDeprecatedInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: ''' @@ -5454,13 +5473,14 @@ typing.cast(typing.Any, IDeprecatedInterface).__jsii_proxy_class__ = lambda : _I @jsii.interface(jsii_type="jsii-calc.IExperimentalInterface") -class IExperimentalInterface(typing_extensions.Protocol): +class IExperimentalInterface(metaclass = jsii.JSIIAbstractClass): ''' :stability: experimental ''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") + @abc.abstractmethod def mutable_property(self) -> typing.Optional[jsii.Number]: ''' :stability: experimental @@ -5468,10 +5488,12 @@ class IExperimentalInterface(typing_extensions.Protocol): ... @mutable_property.setter + @abc.abstractmethod def mutable_property(self, value: typing.Optional[jsii.Number]) -> None: ... @jsii.member(jsii_name="method") + @abc.abstractmethod def method(self) -> None: ''' :stability: experimental @@ -5486,7 +5508,7 @@ class _IExperimentalInterfaceProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IExperimentalInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: ''' @@ -5510,18 +5532,21 @@ typing.cast(typing.Any, IExperimentalInterface).__jsii_proxy_class__ = lambda : @jsii.interface(jsii_type="jsii-calc.IExtendsPrivateInterface") -class IExtendsPrivateInterface(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IExtendsPrivateInterface(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="moreThings") + @abc.abstractmethod def more_things(self) -> typing.List[builtins.str]: ... - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="private") + @abc.abstractmethod def private(self) -> builtins.str: ... @private.setter + @abc.abstractmethod def private(self, value: builtins.str) -> None: ... @@ -5529,12 +5554,12 @@ class IExtendsPrivateInterface(typing_extensions.Protocol): class _IExtendsPrivateInterfaceProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IExtendsPrivateInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="moreThings") def more_things(self) -> typing.List[builtins.str]: return typing.cast(typing.List[builtins.str], jsii.get(self, "moreThings")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="private") def private(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "private")) @@ -5548,13 +5573,14 @@ typing.cast(typing.Any, IExtendsPrivateInterface).__jsii_proxy_class__ = lambda @jsii.interface(jsii_type="jsii-calc.IExternalInterface") -class IExternalInterface(typing_extensions.Protocol): +class IExternalInterface(metaclass = jsii.JSIIAbstractClass): ''' :external: true ''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") + @abc.abstractmethod def mutable_property(self) -> typing.Optional[jsii.Number]: ''' :external: true @@ -5562,10 +5588,12 @@ class IExternalInterface(typing_extensions.Protocol): ... @mutable_property.setter + @abc.abstractmethod def mutable_property(self, value: typing.Optional[jsii.Number]) -> None: ... @jsii.member(jsii_name="method") + @abc.abstractmethod def method(self) -> None: ''' :external: true @@ -5580,7 +5608,7 @@ class _IExternalInterfaceProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IExternalInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: ''' @@ -5604,15 +5632,23 @@ typing.cast(typing.Any, IExternalInterface).__jsii_proxy_class__ = lambda : _IEx @jsii.interface(jsii_type="jsii-calc.IFriendlier") -class IFriendlier(scope.jsii_calc_lib.IFriendly, typing_extensions.Protocol): +@jsii.implements( + *((scope.jsii_calc_lib.IFriendly,) if type(scope.jsii_calc_lib.IFriendly) is type(typing_extensions.Protocol) else ()) +) +class IFriendlier( + *(() if type(scope.jsii_calc_lib.IFriendly) is type(typing_extensions.Protocol) else (scope.jsii_calc_lib.IFriendly,)), + metaclass = jsii.JSIIAbstractClass, +): '''Even friendlier classes can implement this interface.''' @jsii.member(jsii_name="farewell") + @abc.abstractmethod def farewell(self) -> builtins.str: '''Say farewell.''' ... @jsii.member(jsii_name="goodbye") + @abc.abstractmethod def goodbye(self) -> builtins.str: '''Say goodbye. @@ -5621,9 +5657,7 @@ class IFriendlier(scope.jsii_calc_lib.IFriendly, typing_extensions.Protocol): ... -class _IFriendlierProxy( - jsii.proxy_for(scope.jsii_calc_lib.IFriendly) # type: ignore[misc] -): +class _IFriendlierProxy(jsii.proxy_for(scope.jsii_calc_lib.IFriendly)): '''Even friendlier classes can implement this interface.''' __jsii_type__: typing.ClassVar[str] = "jsii-calc.IFriendlier" @@ -5646,11 +5680,12 @@ typing.cast(typing.Any, IFriendlier).__jsii_proxy_class__ = lambda : _IFriendlie @jsii.interface(jsii_type="jsii-calc.IInterfaceImplementedByAbstractClass") -class IInterfaceImplementedByAbstractClass(typing_extensions.Protocol): +class IInterfaceImplementedByAbstractClass(metaclass = jsii.JSIIAbstractClass): '''awslabs/jsii#220 Abstract return type.''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="propFromInterface") + @abc.abstractmethod def prop_from_interface(self) -> builtins.str: ... @@ -5660,7 +5695,7 @@ class _IInterfaceImplementedByAbstractClassProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IInterfaceImplementedByAbstractClass" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="propFromInterface") def prop_from_interface(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "propFromInterface")) @@ -5670,8 +5705,9 @@ typing.cast(typing.Any, IInterfaceImplementedByAbstractClass).__jsii_proxy_class @jsii.interface(jsii_type="jsii-calc.IInterfaceWithInternal") -class IInterfaceWithInternal(typing_extensions.Protocol): +class IInterfaceWithInternal(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="visible") + @abc.abstractmethod def visible(self) -> None: ... @@ -5688,13 +5724,15 @@ typing.cast(typing.Any, IInterfaceWithInternal).__jsii_proxy_class__ = lambda : @jsii.interface(jsii_type="jsii-calc.IInterfaceWithMethods") -class IInterfaceWithMethods(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IInterfaceWithMethods(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="value") + @abc.abstractmethod def value(self) -> builtins.str: ... @jsii.member(jsii_name="doThings") + @abc.abstractmethod def do_things(self) -> None: ... @@ -5702,7 +5740,7 @@ class IInterfaceWithMethods(typing_extensions.Protocol): class _IInterfaceWithMethodsProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IInterfaceWithMethods" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "value")) @@ -5716,10 +5754,11 @@ typing.cast(typing.Any, IInterfaceWithMethods).__jsii_proxy_class__ = lambda : _ @jsii.interface(jsii_type="jsii-calc.IInterfaceWithOptionalMethodArguments") -class IInterfaceWithOptionalMethodArguments(typing_extensions.Protocol): +class IInterfaceWithOptionalMethodArguments(metaclass = jsii.JSIIAbstractClass): '''awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods.''' @jsii.member(jsii_name="hello") + @abc.abstractmethod def hello( self, arg1: builtins.str, @@ -5754,18 +5793,21 @@ typing.cast(typing.Any, IInterfaceWithOptionalMethodArguments).__jsii_proxy_clas @jsii.interface(jsii_type="jsii-calc.IInterfaceWithProperties") -class IInterfaceWithProperties(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IInterfaceWithProperties(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="readOnlyString") + @abc.abstractmethod def read_only_string(self) -> builtins.str: ... - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readWriteString") + @abc.abstractmethod def read_write_string(self) -> builtins.str: ... @read_write_string.setter + @abc.abstractmethod def read_write_string(self, value: builtins.str) -> None: ... @@ -5773,12 +5815,12 @@ class IInterfaceWithProperties(typing_extensions.Protocol): class _IInterfaceWithPropertiesProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IInterfaceWithProperties" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readOnlyString") def read_only_string(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readOnlyString")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readWriteString") def read_write_string(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readWriteString")) @@ -5794,24 +5836,24 @@ typing.cast(typing.Any, IInterfaceWithProperties).__jsii_proxy_class__ = lambda @jsii.interface(jsii_type="jsii-calc.IInterfaceWithPropertiesExtension") class IInterfaceWithPropertiesExtension( IInterfaceWithProperties, - typing_extensions.Protocol, + metaclass = jsii.JSIIAbstractClass, ): - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="foo") + @abc.abstractmethod def foo(self) -> jsii.Number: ... @foo.setter + @abc.abstractmethod def foo(self, value: jsii.Number) -> None: ... -class _IInterfaceWithPropertiesExtensionProxy( - jsii.proxy_for(IInterfaceWithProperties) # type: ignore[misc] -): +class _IInterfaceWithPropertiesExtensionProxy(jsii.proxy_for(IInterfaceWithProperties)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.IInterfaceWithPropertiesExtension" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="foo") def foo(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "foo")) @@ -5825,13 +5867,15 @@ typing.cast(typing.Any, IInterfaceWithPropertiesExtension).__jsii_proxy_class__ @jsii.interface(jsii_type="jsii-calc.IJSII417PublicBaseOfBase") -class IJSII417PublicBaseOfBase(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IJSII417PublicBaseOfBase(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="hasRoot") + @abc.abstractmethod def has_root(self) -> builtins.bool: ... @jsii.member(jsii_name="foo") + @abc.abstractmethod def foo(self) -> None: ... @@ -5839,7 +5883,7 @@ class IJSII417PublicBaseOfBase(typing_extensions.Protocol): class _IJSII417PublicBaseOfBaseProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IJSII417PublicBaseOfBase" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="hasRoot") def has_root(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "hasRoot")) @@ -5853,7 +5897,7 @@ typing.cast(typing.Any, IJSII417PublicBaseOfBase).__jsii_proxy_class__ = lambda @jsii.interface(jsii_type="jsii-calc.IJsii487External") -class IJsii487External(typing_extensions.Protocol): +class IJsii487External(metaclass = jsii.JSIIAbstractClass): pass @@ -5866,7 +5910,7 @@ typing.cast(typing.Any, IJsii487External).__jsii_proxy_class__ = lambda : _IJsii @jsii.interface(jsii_type="jsii-calc.IJsii487External2") -class IJsii487External2(typing_extensions.Protocol): +class IJsii487External2(metaclass = jsii.JSIIAbstractClass): pass @@ -5879,7 +5923,7 @@ typing.cast(typing.Any, IJsii487External2).__jsii_proxy_class__ = lambda : _IJsi @jsii.interface(jsii_type="jsii-calc.IJsii496") -class IJsii496(typing_extensions.Protocol): +class IJsii496(metaclass = jsii.JSIIAbstractClass): pass @@ -5892,13 +5936,15 @@ typing.cast(typing.Any, IJsii496).__jsii_proxy_class__ = lambda : _IJsii496Proxy @jsii.interface(jsii_type="jsii-calc.IMutableObjectLiteral") -class IMutableObjectLiteral(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IMutableObjectLiteral(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="value") + @abc.abstractmethod def value(self) -> builtins.str: ... @value.setter + @abc.abstractmethod def value(self, value: builtins.str) -> None: ... @@ -5906,7 +5952,7 @@ class IMutableObjectLiteral(typing_extensions.Protocol): class _IMutableObjectLiteralProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IMutableObjectLiteral" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "value")) @@ -5920,32 +5966,37 @@ typing.cast(typing.Any, IMutableObjectLiteral).__jsii_proxy_class__ = lambda : _ @jsii.interface(jsii_type="jsii-calc.INonInternalInterface") -class INonInternalInterface(IAnotherPublicInterface, typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class INonInternalInterface( + IAnotherPublicInterface, + metaclass = jsii.JSIIAbstractClass, +): + @builtins.property @jsii.member(jsii_name="b") + @abc.abstractmethod def b(self) -> builtins.str: ... @b.setter + @abc.abstractmethod def b(self, value: builtins.str) -> None: ... - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="c") + @abc.abstractmethod def c(self) -> builtins.str: ... @c.setter + @abc.abstractmethod def c(self, value: builtins.str) -> None: ... -class _INonInternalInterfaceProxy( - jsii.proxy_for(IAnotherPublicInterface) # type: ignore[misc] -): +class _INonInternalInterfaceProxy(jsii.proxy_for(IAnotherPublicInterface)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.INonInternalInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="b") def b(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "b")) @@ -5954,7 +6005,7 @@ class _INonInternalInterfaceProxy( def b(self, value: builtins.str) -> None: jsii.set(self, "b", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="c") def c(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "c")) @@ -5968,19 +6019,22 @@ typing.cast(typing.Any, INonInternalInterface).__jsii_proxy_class__ = lambda : _ @jsii.interface(jsii_type="jsii-calc.IObjectWithProperty") -class IObjectWithProperty(typing_extensions.Protocol): +class IObjectWithProperty(metaclass = jsii.JSIIAbstractClass): '''Make sure that setters are properly called on objects with interfaces.''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") + @abc.abstractmethod def property(self) -> builtins.str: ... @property.setter + @abc.abstractmethod def property(self, value: builtins.str) -> None: ... @jsii.member(jsii_name="wasSet") + @abc.abstractmethod def was_set(self) -> builtins.bool: ... @@ -5990,7 +6044,7 @@ class _IObjectWithPropertyProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IObjectWithProperty" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") def property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "property")) @@ -6008,10 +6062,11 @@ typing.cast(typing.Any, IObjectWithProperty).__jsii_proxy_class__ = lambda : _IO @jsii.interface(jsii_type="jsii-calc.IOptionalMethod") -class IOptionalMethod(typing_extensions.Protocol): +class IOptionalMethod(metaclass = jsii.JSIIAbstractClass): '''Checks that optional result from interface method code generates correctly.''' @jsii.member(jsii_name="optional") + @abc.abstractmethod def optional(self) -> typing.Optional[builtins.str]: ... @@ -6030,9 +6085,10 @@ typing.cast(typing.Any, IOptionalMethod).__jsii_proxy_class__ = lambda : _IOptio @jsii.interface(jsii_type="jsii-calc.IPrivatelyImplemented") -class IPrivatelyImplemented(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IPrivatelyImplemented(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="success") + @abc.abstractmethod def success(self) -> builtins.bool: ... @@ -6040,7 +6096,7 @@ class IPrivatelyImplemented(typing_extensions.Protocol): class _IPrivatelyImplementedProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IPrivatelyImplemented" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="success") def success(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "success")) @@ -6050,8 +6106,9 @@ typing.cast(typing.Any, IPrivatelyImplemented).__jsii_proxy_class__ = lambda : _ @jsii.interface(jsii_type="jsii-calc.IPublicInterface") -class IPublicInterface(typing_extensions.Protocol): +class IPublicInterface(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="bye") + @abc.abstractmethod def bye(self) -> builtins.str: ... @@ -6068,8 +6125,9 @@ typing.cast(typing.Any, IPublicInterface).__jsii_proxy_class__ = lambda : _IPubl @jsii.interface(jsii_type="jsii-calc.IPublicInterface2") -class IPublicInterface2(typing_extensions.Protocol): +class IPublicInterface2(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="ciao") + @abc.abstractmethod def ciao(self) -> builtins.str: ... @@ -6086,10 +6144,11 @@ typing.cast(typing.Any, IPublicInterface2).__jsii_proxy_class__ = lambda : _IPub @jsii.interface(jsii_type="jsii-calc.IRandomNumberGenerator") -class IRandomNumberGenerator(typing_extensions.Protocol): +class IRandomNumberGenerator(metaclass = jsii.JSIIAbstractClass): '''Generates random numbers.''' @jsii.member(jsii_name="next") + @abc.abstractmethod def next(self) -> jsii.Number: '''Returns another random number. @@ -6116,11 +6175,12 @@ typing.cast(typing.Any, IRandomNumberGenerator).__jsii_proxy_class__ = lambda : @jsii.interface(jsii_type="jsii-calc.IReturnJsii976") -class IReturnJsii976(typing_extensions.Protocol): +class IReturnJsii976(metaclass = jsii.JSIIAbstractClass): '''Returns a subclass of a known class which implements an interface.''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="foo") + @abc.abstractmethod def foo(self) -> jsii.Number: ... @@ -6130,7 +6190,7 @@ class _IReturnJsii976Proxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IReturnJsii976" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="foo") def foo(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "foo")) @@ -6140,13 +6200,15 @@ typing.cast(typing.Any, IReturnJsii976).__jsii_proxy_class__ = lambda : _IReturn @jsii.interface(jsii_type="jsii-calc.IReturnsNumber") -class IReturnsNumber(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IReturnsNumber(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="numberProp") + @abc.abstractmethod def number_prop(self) -> scope.jsii_calc_lib.Number: ... @jsii.member(jsii_name="obtainNumber") + @abc.abstractmethod def obtain_number(self) -> scope.jsii_calc_lib.IDoublable: ... @@ -6154,7 +6216,7 @@ class IReturnsNumber(typing_extensions.Protocol): class _IReturnsNumberProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IReturnsNumber" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="numberProp") def number_prop(self) -> scope.jsii_calc_lib.Number: return typing.cast(scope.jsii_calc_lib.Number, jsii.get(self, "numberProp")) @@ -6168,17 +6230,20 @@ typing.cast(typing.Any, IReturnsNumber).__jsii_proxy_class__ = lambda : _IReturn @jsii.interface(jsii_type="jsii-calc.IStableInterface") -class IStableInterface(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IStableInterface(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="mutableProperty") + @abc.abstractmethod def mutable_property(self) -> typing.Optional[jsii.Number]: ... @mutable_property.setter + @abc.abstractmethod def mutable_property(self, value: typing.Optional[jsii.Number]) -> None: ... @jsii.member(jsii_name="method") + @abc.abstractmethod def method(self) -> None: ... @@ -6186,7 +6251,7 @@ class IStableInterface(typing_extensions.Protocol): class _IStableInterfaceProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.IStableInterface" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: return typing.cast(typing.Optional[jsii.Number], jsii.get(self, "mutableProperty")) @@ -6204,10 +6269,11 @@ typing.cast(typing.Any, IStableInterface).__jsii_proxy_class__ = lambda : _IStab @jsii.interface(jsii_type="jsii-calc.IStructReturningDelegate") -class IStructReturningDelegate(typing_extensions.Protocol): +class IStructReturningDelegate(metaclass = jsii.JSIIAbstractClass): '''Verifies that a "pure" implementation of an interface works correctly.''' @jsii.member(jsii_name="returnStruct") + @abc.abstractmethod def return_struct(self) -> "StructB": ... @@ -6226,10 +6292,11 @@ typing.cast(typing.Any, IStructReturningDelegate).__jsii_proxy_class__ = lambda @jsii.interface(jsii_type="jsii-calc.IWallClock") -class IWallClock(typing_extensions.Protocol): +class IWallClock(metaclass = jsii.JSIIAbstractClass): '''Implement this interface.''' @jsii.member(jsii_name="iso8601Now") + @abc.abstractmethod def iso8601_now(self) -> builtins.str: '''Returns the current time, formatted as an ISO-8601 string.''' ... @@ -6256,7 +6323,7 @@ class ImplementInternalInterface( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="prop") def prop(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "prop")) @@ -6270,14 +6337,14 @@ class Implementation(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Implementatio def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "value")) -@jsii.implements(IInterfaceWithInternal) class ImplementsInterfaceWithInternal( + IInterfaceWithInternal, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ImplementsInterfaceWithInternal", ): @@ -6305,7 +6372,7 @@ class ImplementsPrivateInterface( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="private") def private(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "private")) @@ -6378,22 +6445,22 @@ class InterfaceCollections( See: https://github.com/aws/jsii/issues/1196 ''' - @jsii.member(jsii_name="listOfInterfaces") # type: ignore[misc] + @jsii.member(jsii_name="listOfInterfaces") @builtins.classmethod def list_of_interfaces(cls) -> typing.List[IBell]: return typing.cast(typing.List[IBell], jsii.sinvoke(cls, "listOfInterfaces", [])) - @jsii.member(jsii_name="listOfStructs") # type: ignore[misc] + @jsii.member(jsii_name="listOfStructs") @builtins.classmethod def list_of_structs(cls) -> typing.List["StructA"]: return typing.cast(typing.List["StructA"], jsii.sinvoke(cls, "listOfStructs", [])) - @jsii.member(jsii_name="mapOfInterfaces") # type: ignore[misc] + @jsii.member(jsii_name="mapOfInterfaces") @builtins.classmethod def map_of_interfaces(cls) -> typing.Mapping[builtins.str, IBell]: return typing.cast(typing.Mapping[builtins.str, IBell], jsii.sinvoke(cls, "mapOfInterfaces", [])) - @jsii.member(jsii_name="mapOfStructs") # type: ignore[misc] + @jsii.member(jsii_name="mapOfStructs") @builtins.classmethod def map_of_structs(cls) -> typing.Mapping[builtins.str, "StructA"]: return typing.cast(typing.Mapping[builtins.str, "StructA"], jsii.sinvoke(cls, "mapOfStructs", [])) @@ -6402,7 +6469,7 @@ class InterfaceCollections( class InterfacesMaker(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.InterfacesMaker"): '''We can return arrays of interfaces See aws/aws-cdk#2362.''' - @jsii.member(jsii_name="makeInterfaces") # type: ignore[misc] + @jsii.member(jsii_name="makeInterfaces") @builtins.classmethod def make_interfaces( cls, @@ -6462,7 +6529,7 @@ class JSII417PublicBaseOfBase( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="makeInstance") # type: ignore[misc] + @jsii.member(jsii_name="makeInstance") @builtins.classmethod def make_instance(cls) -> "JSII417PublicBaseOfBase": return typing.cast("JSII417PublicBaseOfBase", jsii.sinvoke(cls, "makeInstance", [])) @@ -6471,7 +6538,7 @@ class JSII417PublicBaseOfBase( def foo(self) -> None: return typing.cast(None, jsii.invoke(self, "foo", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="hasRoot") def has_root(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "hasRoot")) @@ -6512,7 +6579,7 @@ class JSObjectLiteralToNativeClass( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="propA") def prop_a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "propA")) @@ -6521,7 +6588,7 @@ class JSObjectLiteralToNativeClass( def prop_a(self, value: builtins.str) -> None: jsii.set(self, "propA", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="propB") def prop_b(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "propB")) @@ -6746,7 +6813,7 @@ class JavaReservedWords( def volatile(self) -> None: return typing.cast(None, jsii.invoke(self, "volatile", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="while") def while_(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "while")) @@ -6756,14 +6823,21 @@ class JavaReservedWords( jsii.set(self, "while", value) -@jsii.implements(IJsii487External2, IJsii487External) -class Jsii487Derived(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Jsii487Derived"): +class Jsii487Derived( + IJsii487External2, + IJsii487External, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.Jsii487Derived", +): def __init__(self) -> None: jsii.create(self.__class__, self, []) -@jsii.implements(IJsii496) -class Jsii496Derived(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Jsii496Derived"): +class Jsii496Derived( + IJsii496, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.Jsii496Derived", +): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -6774,7 +6848,7 @@ class JsiiAgent(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JsiiAgent"): def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="value") def value(cls) -> typing.Optional[builtins.str]: '''Returns the value of the JSII_AGENT environment variable.''' @@ -6787,72 +6861,72 @@ class JsonFormatter(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.JsonFormatter" :see: https://github.com/aws/aws-cdk/issues/5066 ''' - @jsii.member(jsii_name="anyArray") # type: ignore[misc] + @jsii.member(jsii_name="anyArray") @builtins.classmethod def any_array(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyArray", [])) - @jsii.member(jsii_name="anyBooleanFalse") # type: ignore[misc] + @jsii.member(jsii_name="anyBooleanFalse") @builtins.classmethod def any_boolean_false(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyBooleanFalse", [])) - @jsii.member(jsii_name="anyBooleanTrue") # type: ignore[misc] + @jsii.member(jsii_name="anyBooleanTrue") @builtins.classmethod def any_boolean_true(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyBooleanTrue", [])) - @jsii.member(jsii_name="anyDate") # type: ignore[misc] + @jsii.member(jsii_name="anyDate") @builtins.classmethod def any_date(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyDate", [])) - @jsii.member(jsii_name="anyEmptyString") # type: ignore[misc] + @jsii.member(jsii_name="anyEmptyString") @builtins.classmethod def any_empty_string(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyEmptyString", [])) - @jsii.member(jsii_name="anyFunction") # type: ignore[misc] + @jsii.member(jsii_name="anyFunction") @builtins.classmethod def any_function(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyFunction", [])) - @jsii.member(jsii_name="anyHash") # type: ignore[misc] + @jsii.member(jsii_name="anyHash") @builtins.classmethod def any_hash(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyHash", [])) - @jsii.member(jsii_name="anyNull") # type: ignore[misc] + @jsii.member(jsii_name="anyNull") @builtins.classmethod def any_null(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyNull", [])) - @jsii.member(jsii_name="anyNumber") # type: ignore[misc] + @jsii.member(jsii_name="anyNumber") @builtins.classmethod def any_number(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyNumber", [])) - @jsii.member(jsii_name="anyRef") # type: ignore[misc] + @jsii.member(jsii_name="anyRef") @builtins.classmethod def any_ref(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyRef", [])) - @jsii.member(jsii_name="anyString") # type: ignore[misc] + @jsii.member(jsii_name="anyString") @builtins.classmethod def any_string(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyString", [])) - @jsii.member(jsii_name="anyUndefined") # type: ignore[misc] + @jsii.member(jsii_name="anyUndefined") @builtins.classmethod def any_undefined(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyUndefined", [])) - @jsii.member(jsii_name="anyZero") # type: ignore[misc] + @jsii.member(jsii_name="anyZero") @builtins.classmethod def any_zero(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "anyZero", [])) - @jsii.member(jsii_name="stringify") # type: ignore[misc] + @jsii.member(jsii_name="stringify") @builtins.classmethod def stringify(cls, value: typing.Any = None) -> typing.Optional[builtins.str]: ''' @@ -6872,7 +6946,7 @@ class LevelOne(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.LevelOne"): jsii.create(self.__class__, self, [props]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="props") def props(self) -> "LevelOneProps": return typing.cast("LevelOneProps", jsii.get(self, "props")) @@ -7111,15 +7185,16 @@ class MethodNamedProperty( def property(self) -> builtins.str: return typing.cast(builtins.str, jsii.invoke(self, "property", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="elite") def elite(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "elite")) -@jsii.implements(IFriendlier, IRandomNumberGenerator) class Multiply( BinaryOperation, + IFriendlier, + IRandomNumberGenerator, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Multiply", ): @@ -7157,7 +7232,7 @@ class Multiply( '''String representation of the value.''' return typing.cast(builtins.str, jsii.invoke(self, "toString", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: '''The value.''' @@ -7168,7 +7243,7 @@ class NestedClassInstance( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.NestedClassInstance", ): - @jsii.member(jsii_name="makeInstance") # type: ignore[misc] + @jsii.member(jsii_name="makeInstance") @builtins.classmethod def make_instance( cls, @@ -7242,7 +7317,7 @@ class NodeStandardLibrary( ''' return typing.cast(builtins.str, jsii.invoke(self, "fsReadFileSync", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="osPlatform") def os_platform(self) -> builtins.str: '''Returns the current os.platform() from the "os" node module.''' @@ -7291,7 +7366,7 @@ class NullShouldBeTreatedAsUndefined( def verify_property_is_undefined(self) -> None: return typing.cast(None, jsii.invoke(self, "verifyPropertyIsUndefined", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="changeMeToUndefined") def change_me_to_undefined(self) -> typing.Optional[builtins.str]: return typing.cast(typing.Optional[builtins.str], jsii.get(self, "changeMeToUndefined")) @@ -7371,7 +7446,7 @@ class NumberGenerator(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.NumberGenera def next_times100(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.invoke(self, "nextTimes100", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="generator") def generator(self) -> IRandomNumberGenerator: return typing.cast(IRandomNumberGenerator, jsii.get(self, "generator")) @@ -7417,7 +7492,7 @@ class ObjectWithPropertyProvider( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ObjectWithPropertyProvider", ): - @jsii.member(jsii_name="provide") # type: ignore[misc] + @jsii.member(jsii_name="provide") @builtins.classmethod def provide(cls) -> IObjectWithProperty: return typing.cast(IObjectWithProperty, jsii.sinvoke(cls, "provide", [])) @@ -7482,17 +7557,17 @@ class OptionalConstructorArgument( ''' jsii.create(self.__class__, self, [arg1, arg2, arg3]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arg1") def arg1(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "arg1")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arg2") def arg2(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "arg2")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="arg3") def arg3(self) -> typing.Optional[datetime.datetime]: return typing.cast(typing.Optional[datetime.datetime], jsii.get(self, "arg3")) @@ -7541,12 +7616,12 @@ class OptionalStructConsumer( jsii.create(self.__class__, self, [optional_struct]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="parameterWasUndefined") def parameter_was_undefined(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "parameterWasUndefined")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="fieldValue") def field_value(self) -> typing.Optional[builtins.str]: return typing.cast(typing.Optional[builtins.str], jsii.get(self, "fieldValue")) @@ -7575,12 +7650,12 @@ class OverridableProtectedMember( def value_from_protected(self) -> builtins.str: return typing.cast(builtins.str, jsii.invoke(self, "valueFromProtected", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="overrideReadOnly") def _override_read_only(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "overrideReadOnly")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="overrideReadWrite") def _override_read_write(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "overrideReadWrite")) @@ -7645,7 +7720,7 @@ class PartiallyInitializedThisConsumer( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="consumePartiallyInitializedThis") # type: ignore[misc] + @jsii.member(jsii_name="consumePartiallyInitializedThis") @abc.abstractmethod def consume_partially_initialized_this( self, @@ -7711,13 +7786,13 @@ class Power( ''' jsii.create(self.__class__, self, [base, pow]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="base") def base(self) -> scope.jsii_calc_lib.NumericValue: '''The base of the power.''' return typing.cast(scope.jsii_calc_lib.NumericValue, jsii.get(self, "base")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="expression") def expression(self) -> scope.jsii_calc_lib.NumericValue: '''The expression that this operation consists of. @@ -7726,7 +7801,7 @@ class Power( ''' return typing.cast(scope.jsii_calc_lib.NumericValue, jsii.get(self, "expression")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="pow") def pow(self) -> scope.jsii_calc_lib.NumericValue: '''The number of times to multiply.''' @@ -7742,12 +7817,12 @@ class PropertyNamedProperty( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") def property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "property")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="yetAnoterOne") def yet_anoter_one(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "yetAnoterOne")) @@ -7918,7 +7993,7 @@ class ReferenceEnumFromScopedPackage( ''' return typing.cast(None, jsii.invoke(self, "saveFoo", [value])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="foo") def foo(self) -> typing.Optional[scope.jsii_calc_lib.EnumFromScopedModule]: return typing.cast(typing.Optional[scope.jsii_calc_lib.EnumFromScopedModule], jsii.get(self, "foo")) @@ -7945,7 +8020,7 @@ class ReturnsPrivateImplementationOfInterface( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="privateImplementation") def private_implementation(self) -> IPrivatelyImplemented: return typing.cast(IPrivatelyImplemented, jsii.get(self, "privateImplementation")) @@ -8007,7 +8082,7 @@ class RootStructValidator( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.RootStructValidator", ): - @jsii.member(jsii_name="validate") # type: ignore[misc] + @jsii.member(jsii_name="validate") @builtins.classmethod def validate( cls, @@ -8234,12 +8309,12 @@ class SomeTypeJsii976(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.SomeTypeJsii def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="returnAnonymous") # type: ignore[misc] + @jsii.member(jsii_name="returnAnonymous") @builtins.classmethod def return_anonymous(cls) -> typing.Any: return typing.cast(typing.Any, jsii.sinvoke(cls, "returnAnonymous", [])) - @jsii.member(jsii_name="returnReturn") # type: ignore[misc] + @jsii.member(jsii_name="returnReturn") @builtins.classmethod def return_return(cls) -> IReturnJsii976: return typing.cast(IReturnJsii976, jsii.sinvoke(cls, "returnReturn", [])) @@ -8261,12 +8336,12 @@ class StableClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StableClass"): def method(self) -> None: return typing.cast(None, jsii.invoke(self, "method", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readonlyProperty")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="mutableProperty") def mutable_property(self) -> typing.Optional[jsii.Number]: return typing.cast(typing.Optional[jsii.Number], jsii.get(self, "mutableProperty")) @@ -8320,12 +8395,12 @@ class StaticContext(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StaticContext" https://github.com/awslabs/aws-cdk/issues/2304 ''' - @jsii.member(jsii_name="canAccessStaticContext") # type: ignore[misc] + @jsii.member(jsii_name="canAccessStaticContext") @builtins.classmethod def can_access_static_context(cls) -> builtins.bool: return typing.cast(builtins.bool, jsii.sinvoke(cls, "canAccessStaticContext", [])) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="staticVariable") def static_variable(cls) -> builtins.bool: return typing.cast(builtins.bool, jsii.sget(cls, "staticVariable")) @@ -8349,12 +8424,12 @@ class StaticHelloParent( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="method") # type: ignore[misc] + @jsii.member(jsii_name="method") @builtins.classmethod def method(cls) -> None: return typing.cast(None, jsii.sinvoke(cls, "method", [])) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="property") def property(cls) -> jsii.Number: return typing.cast(jsii.Number, jsii.sget(cls, "property")) @@ -8367,7 +8442,7 @@ class Statics(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Statics"): ''' jsii.create(self.__class__, self, [value]) - @jsii.member(jsii_name="staticMethod") # type: ignore[misc] + @jsii.member(jsii_name="staticMethod") @builtins.classmethod def static_method(cls, name: builtins.str) -> builtins.str: '''Jsdocs for static method. @@ -8380,30 +8455,30 @@ class Statics(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Statics"): def just_method(self) -> builtins.str: return typing.cast(builtins.str, jsii.invoke(self, "justMethod", [])) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="BAR") def BAR(cls) -> jsii.Number: '''Constants may also use all-caps.''' return typing.cast(jsii.Number, jsii.sget(cls, "BAR")) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="ConstObj") def CONST_OBJ(cls) -> "DoubleTrouble": return typing.cast("DoubleTrouble", jsii.sget(cls, "ConstObj")) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="Foo") def FOO(cls) -> builtins.str: '''Jsdocs for static property.''' return typing.cast(builtins.str, jsii.sget(cls, "Foo")) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="zooBar") def ZOO_BAR(cls) -> typing.Mapping[builtins.str, builtins.str]: '''Constants can also use camelCase.''' return typing.cast(typing.Mapping[builtins.str, builtins.str], jsii.sget(cls, "zooBar")) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="instance") def instance(cls) -> "Statics": '''Jsdocs for static getter. @@ -8416,7 +8491,7 @@ class Statics(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Statics"): def instance(cls, value: "Statics") -> None: jsii.sset(cls, "instance", value) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="nonConstStatic") def non_const_static(cls) -> jsii.Number: return typing.cast(jsii.Number, jsii.sget(cls, "nonConstStatic")) @@ -8425,7 +8500,7 @@ class Statics(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Statics"): def non_const_static(cls, value: jsii.Number) -> None: jsii.sset(cls, "nonConstStatic", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "value")) @@ -8442,7 +8517,7 @@ class StripInternal(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StripInternal" def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="youSeeMe") def you_see_me(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "youSeeMe")) @@ -8626,7 +8701,7 @@ class StructPassing(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StructPassing" def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="howManyVarArgsDidIPass") # type: ignore[misc] + @jsii.member(jsii_name="howManyVarArgsDidIPass") @builtins.classmethod def how_many_var_args_did_i_pass( cls, @@ -8639,7 +8714,7 @@ class StructPassing(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StructPassing" ''' return typing.cast(jsii.Number, jsii.sinvoke(cls, "howManyVarArgsDidIPass", [_positional, *inputs])) - @jsii.member(jsii_name="roundTrip") # type: ignore[misc] + @jsii.member(jsii_name="roundTrip") @builtins.classmethod def round_trip( cls, @@ -8666,7 +8741,7 @@ class StructUnionConsumer( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StructUnionConsumer", ): - @jsii.member(jsii_name="isStructA") # type: ignore[misc] + @jsii.member(jsii_name="isStructA") @builtins.classmethod def is_struct_a(cls, struct: typing.Union[StructA, StructB]) -> builtins.bool: ''' @@ -8674,7 +8749,7 @@ class StructUnionConsumer( ''' return typing.cast(builtins.bool, jsii.sinvoke(cls, "isStructA", [struct])) - @jsii.member(jsii_name="isStructB") # type: ignore[misc] + @jsii.member(jsii_name="isStructB") @builtins.classmethod def is_struct_b(cls, struct: typing.Union[StructA, StructB]) -> builtins.bool: ''' @@ -8811,7 +8886,7 @@ class Sum( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="expression") def expression(self) -> scope.jsii_calc_lib.NumericValue: '''The expression that this operation consists of. @@ -8820,7 +8895,7 @@ class Sum( ''' return typing.cast(scope.jsii_calc_lib.NumericValue, jsii.get(self, "expression")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="parts") def parts(self) -> typing.List[scope.jsii_calc_lib.NumericValue]: '''The parts to sum.''' @@ -8903,18 +8978,18 @@ class SupportsNiceJavaBuilderWithRequiredProps( jsii.create(self.__class__, self, [id_, props]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="bar") def bar(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "bar")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="id") def id(self) -> jsii.Number: '''some identifier of your choice.''' return typing.cast(jsii.Number, jsii.get(self, "id")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="propId") def prop_id(self) -> typing.Optional[builtins.str]: return typing.cast(typing.Optional[builtins.str], jsii.get(self, "propId")) @@ -8979,12 +9054,12 @@ class SyncVirtualMethods( ''' return typing.cast(None, jsii.invoke(self, "writeA", [value])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readonlyProperty")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="a") def a(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "a")) @@ -8993,7 +9068,7 @@ class SyncVirtualMethods( def a(self, value: jsii.Number) -> None: jsii.set(self, "a", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="callerIsProperty") def caller_is_property(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "callerIsProperty")) @@ -9002,7 +9077,7 @@ class SyncVirtualMethods( def caller_is_property(self, value: jsii.Number) -> None: jsii.set(self, "callerIsProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="otherProperty") def other_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "otherProperty")) @@ -9011,7 +9086,7 @@ class SyncVirtualMethods( def other_property(self, value: builtins.str) -> None: jsii.set(self, "otherProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="theProperty") def the_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "theProperty")) @@ -9020,7 +9095,7 @@ class SyncVirtualMethods( def the_property(self, value: builtins.str) -> None: jsii.set(self, "theProperty", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="valueOfOtherProperty") def value_of_other_property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "valueOfOtherProperty")) @@ -9069,13 +9144,13 @@ class TestStructWithEnum( return typing.cast(builtins.bool, jsii.invoke(self, "isStringEnumB", [input])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="structWithFoo") def struct_with_foo(self) -> StructWithEnum: '''Returns \`\`foo: StringEnum.A\`\`.''' return typing.cast(StructWithEnum, jsii.get(self, "structWithFoo")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="structWithFooBar") def struct_with_foo_bar(self) -> StructWithEnum: '''Returns \`\`foo: StringEnum.C\`\` and \`\`bar: AllTypesEnum.MY_ENUM_VALUE\`\`.''' @@ -9177,7 +9252,7 @@ class TwoMethodsWithSimilarCapitalization( ''' return typing.cast(builtins.str, jsii.invoke(self, "toIsOString", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="fooBar") def foo_bar(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "fooBar")) @@ -9189,7 +9264,7 @@ class UmaskCheck(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.UmaskCheck"): :see: https://github.com/aws/jsii/issues/1765 ''' - @jsii.member(jsii_name="mode") # type: ignore[misc] + @jsii.member(jsii_name="mode") @builtins.classmethod def mode(cls) -> jsii.Number: '''This should return 0o644 (-rw-r--r--).''' @@ -9209,14 +9284,15 @@ class UnaryOperation( ''' jsii.create(self.__class__, self, [operand]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="operand") def operand(self) -> scope.jsii_calc_lib.NumericValue: return typing.cast(scope.jsii_calc_lib.NumericValue, jsii.get(self, "operand")) class _UnaryOperationProxy( - UnaryOperation, jsii.proxy_for(scope.jsii_calc_lib.Operation) # type: ignore[misc] + UnaryOperation, + jsii.proxy_for(scope.jsii_calc_lib.Operation), ): pass @@ -9269,8 +9345,8 @@ class UnionProperties: ) -@jsii.implements(scope.jsii_calc_lib.custom_submodule_name.IReflectable) class UpcasingReflectable( + *(() if type(scope.jsii_calc_lib.custom_submodule_name.IReflectable) is type(typing_extensions.Protocol) else (scope.jsii_calc_lib.custom_submodule_name.IReflectable,)), metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.UpcasingReflectable", ): @@ -9282,12 +9358,12 @@ class UpcasingReflectable( ''' jsii.create(self.__class__, self, [delegate]) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="reflector") def REFLECTOR(cls) -> scope.jsii_calc_lib.custom_submodule_name.Reflector: return typing.cast(scope.jsii_calc_lib.custom_submodule_name.Reflector, jsii.sget(cls, "reflector")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="entries") def entries( self, @@ -9349,7 +9425,7 @@ class UsesInterfaceWithProperties( ''' return typing.cast(builtins.str, jsii.invoke(self, "writeAndRead", [value])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="obj") def obj(self) -> IInterfaceWithProperties: return typing.cast(IInterfaceWithProperties, jsii.get(self, "obj")) @@ -9451,12 +9527,12 @@ class VoidCallback( def call_me(self) -> None: return typing.cast(None, jsii.invoke(self, "callMe", [])) - @jsii.member(jsii_name="overrideMe") # type: ignore[misc] + @jsii.member(jsii_name="overrideMe") @abc.abstractmethod def _override_me(self) -> None: ... - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="methodWasCalled") def method_was_called(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "methodWasCalled")) @@ -9483,22 +9559,22 @@ class WithPrivatePropertyInConstructor( ''' jsii.create(self.__class__, self, [private_field]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="success") def success(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "success")) -@jsii.implements(IInterfaceImplementedByAbstractClass) class AbstractClass( AbstractClassBase, + IInterfaceImplementedByAbstractClass, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.AbstractClass", ): def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.member(jsii_name="abstractMethod") # type: ignore[misc] + @jsii.member(jsii_name="abstractMethod") @abc.abstractmethod def abstract_method(self, name: builtins.str) -> builtins.str: ''' @@ -9510,15 +9586,13 @@ class AbstractClass( def non_abstract_method(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.invoke(self, "nonAbstractMethod", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="propFromInterface") def prop_from_interface(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "propFromInterface")) -class _AbstractClassProxy( - AbstractClass, jsii.proxy_for(AbstractClassBase) # type: ignore[misc] -): +class _AbstractClassProxy(AbstractClass, jsii.proxy_for(AbstractClassBase)): @jsii.member(jsii_name="abstractMethod") def abstract_method(self, name: builtins.str) -> builtins.str: ''' @@ -9550,15 +9624,15 @@ class Add(BinaryOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Add"): '''String representation of the value.''' return typing.cast(builtins.str, jsii.invoke(self, "toString", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: '''The value.''' return typing.cast(jsii.Number, jsii.get(self, "value")) -@jsii.implements(IAnonymousImplementationProvider) class AnonymousImplementationProvider( + IAnonymousImplementationProvider, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.AnonymousImplementationProvider", ): @@ -9574,8 +9648,7 @@ class AnonymousImplementationProvider( return typing.cast(IAnonymouslyImplementMe, jsii.invoke(self, "provideAsInterface", [])) -@jsii.implements(IBell) -class Bell(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Bell"): +class Bell(IBell, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Bell"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -9583,7 +9656,7 @@ class Bell(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Bell"): def ring(self) -> None: return typing.cast(None, jsii.invoke(self, "ring", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="rung") def rung(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "rung")) @@ -9633,15 +9706,15 @@ class ChildStruct982(ParentStruct982): ) -@jsii.implements(INonInternalInterface) class ClassThatImplementsTheInternalInterface( + INonInternalInterface, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassThatImplementsTheInternalInterface", ): def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="a") def a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "a")) @@ -9650,7 +9723,7 @@ class ClassThatImplementsTheInternalInterface( def a(self, value: builtins.str) -> None: jsii.set(self, "a", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="b") def b(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "b")) @@ -9659,7 +9732,7 @@ class ClassThatImplementsTheInternalInterface( def b(self, value: builtins.str) -> None: jsii.set(self, "b", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="c") def c(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "c")) @@ -9668,7 +9741,7 @@ class ClassThatImplementsTheInternalInterface( def c(self, value: builtins.str) -> None: jsii.set(self, "c", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="d") def d(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "d")) @@ -9678,15 +9751,15 @@ class ClassThatImplementsTheInternalInterface( jsii.set(self, "d", value) -@jsii.implements(INonInternalInterface) class ClassThatImplementsThePrivateInterface( + INonInternalInterface, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassThatImplementsThePrivateInterface", ): def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="a") def a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "a")) @@ -9695,7 +9768,7 @@ class ClassThatImplementsThePrivateInterface( def a(self, value: builtins.str) -> None: jsii.set(self, "a", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="b") def b(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "b")) @@ -9704,7 +9777,7 @@ class ClassThatImplementsThePrivateInterface( def b(self, value: builtins.str) -> None: jsii.set(self, "b", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="c") def c(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "c")) @@ -9713,7 +9786,7 @@ class ClassThatImplementsThePrivateInterface( def c(self, value: builtins.str) -> None: jsii.set(self, "c", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="e") def e(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "e")) @@ -9723,14 +9796,14 @@ class ClassThatImplementsThePrivateInterface( jsii.set(self, "e", value) -@jsii.implements(IInterfaceWithProperties) class ClassWithPrivateConstructorAndAutomaticProperties( + IInterfaceWithProperties, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties", ): '''Class that implements interface properties automatically, but using a private constructor.''' - @jsii.member(jsii_name="create") # type: ignore[misc] + @jsii.member(jsii_name="create") @builtins.classmethod def create( cls, @@ -9743,12 +9816,12 @@ class ClassWithPrivateConstructorAndAutomaticProperties( ''' return typing.cast("ClassWithPrivateConstructorAndAutomaticProperties", jsii.sinvoke(cls, "create", [read_only_string, read_write_string])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readOnlyString") def read_only_string(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readOnlyString")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="readWriteString") def read_write_string(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readWriteString")) @@ -9759,17 +9832,20 @@ class ClassWithPrivateConstructorAndAutomaticProperties( @jsii.interface(jsii_type="jsii-calc.IFriendlyRandomGenerator") +@jsii.implements( + *((scope.jsii_calc_lib.IFriendly,) if type(scope.jsii_calc_lib.IFriendly) is type(typing_extensions.Protocol) else ()) +) class IFriendlyRandomGenerator( IRandomNumberGenerator, - scope.jsii_calc_lib.IFriendly, - typing_extensions.Protocol, + *(() if type(scope.jsii_calc_lib.IFriendly) is type(typing_extensions.Protocol) else (scope.jsii_calc_lib.IFriendly,)), + metaclass = jsii.JSIIAbstractClass, ): pass class _IFriendlyRandomGeneratorProxy( - jsii.proxy_for(IRandomNumberGenerator), # type: ignore[misc] - jsii.proxy_for(scope.jsii_calc_lib.IFriendly), # type: ignore[misc] + jsii.proxy_for(IRandomNumberGenerator), + jsii.proxy_for(scope.jsii_calc_lib.IFriendly), ): __jsii_type__: typing.ClassVar[str] = "jsii-calc.IFriendlyRandomGenerator" pass @@ -9781,24 +9857,23 @@ typing.cast(typing.Any, IFriendlyRandomGenerator).__jsii_proxy_class__ = lambda @jsii.interface(jsii_type="jsii-calc.IInterfaceThatShouldNotBeADataType") class IInterfaceThatShouldNotBeADataType( IInterfaceWithMethods, - typing_extensions.Protocol, + metaclass = jsii.JSIIAbstractClass, ): '''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.''' - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="otherValue") + @abc.abstractmethod def other_value(self) -> builtins.str: ... -class _IInterfaceThatShouldNotBeADataTypeProxy( - jsii.proxy_for(IInterfaceWithMethods) # type: ignore[misc] -): +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.''' __jsii_type__: typing.ClassVar[str] = "jsii-calc.IInterfaceThatShouldNotBeADataType" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="otherValue") def other_value(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "otherValue")) @@ -9808,27 +9883,28 @@ typing.cast(typing.Any, IInterfaceThatShouldNotBeADataType).__jsii_proxy_class__ @jsii.interface(jsii_type="jsii-calc.IJSII417Derived") -class IJSII417Derived(IJSII417PublicBaseOfBase, typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IJSII417Derived(IJSII417PublicBaseOfBase, metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="property") + @abc.abstractmethod def property(self) -> builtins.str: ... @jsii.member(jsii_name="bar") + @abc.abstractmethod def bar(self) -> None: ... @jsii.member(jsii_name="baz") + @abc.abstractmethod def baz(self) -> None: ... -class _IJSII417DerivedProxy( - jsii.proxy_for(IJSII417PublicBaseOfBase) # type: ignore[misc] -): +class _IJSII417DerivedProxy(jsii.proxy_for(IJSII417PublicBaseOfBase)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.IJSII417Derived" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") def property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "property")) @@ -9845,9 +9921,9 @@ class _IJSII417DerivedProxy( typing.cast(typing.Any, IJSII417Derived).__jsii_proxy_class__ = lambda : _IJSII417DerivedProxy -@jsii.implements(IPublicInterface2) class InbetweenClass( PublicClass, + IPublicInterface2, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.InbetweenClass", ): @@ -9878,14 +9954,18 @@ class JSII417Derived( def baz(self) -> None: return typing.cast(None, jsii.invoke(self, "baz", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="property") def _property(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "property")) -@jsii.implements(IFriendlier) -class Negate(UnaryOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Negate"): +class Negate( + UnaryOperation, + IFriendlier, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.Negate", +): '''The negation operation ("-value").''' def __init__(self, operand: scope.jsii_calc_lib.NumericValue) -> None: @@ -9914,7 +9994,7 @@ class Negate(UnaryOperation, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Negat '''String representation of the value.''' return typing.cast(builtins.str, jsii.invoke(self, "toString", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: '''The value.''' @@ -9926,12 +10006,12 @@ class StaticHelloChild( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StaticHelloChild", ): - @jsii.member(jsii_name="method") # type: ignore[misc] + @jsii.member(jsii_name="method") @builtins.classmethod def method(cls) -> None: return typing.cast(None, jsii.sinvoke(cls, "method", [])) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="property") def property(cls) -> jsii.Number: return typing.cast(jsii.Number, jsii.sget(cls, "property")) @@ -9957,20 +10037,23 @@ class SupportsNiceJavaBuilder( ''' jsii.create(self.__class__, self, [id, default_bar, props, *rest]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="id") def id(self) -> jsii.Number: '''some identifier.''' return typing.cast(jsii.Number, jsii.get(self, "id")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="rest") def rest(self) -> typing.List[builtins.str]: return typing.cast(typing.List[builtins.str], jsii.get(self, "rest")) -@jsii.implements(IFriendlyRandomGenerator) -class DoubleTrouble(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DoubleTrouble"): +class DoubleTrouble( + IFriendlyRandomGenerator, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.DoubleTrouble", +): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -10305,7 +10388,7 @@ class Cdk16625( '''Run this function to verify that everything is working as it should.''' return typing.cast(None, jsii.invoke(self, "test", [])) - @jsii.member(jsii_name="unwrap") # type: ignore[misc] + @jsii.member(jsii_name="unwrap") @abc.abstractmethod def _unwrap(self, gen: _IRandomNumberGenerator_9643a8b9) -> jsii.Number: '''Implement this functin to return \`\`gen.next()\`\`. It is extremely important that the \`\`donotimport\`\` submodule is NEVER explicitly loaded in the testing application (otherwise this test is void). @@ -10352,8 +10435,8 @@ from ..._jsii import * from ... import IRandomNumberGenerator as _IRandomNumberGenerator_9643a8b9 -@jsii.implements(_IRandomNumberGenerator_9643a8b9) class UnimportedSubmoduleType( + *(() if type(_IRandomNumberGenerator_9643a8b9) is type(typing_extensions.Protocol) else (_IRandomNumberGenerator_9643a8b9,)), metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.cdk16625.donotimport.UnimportedSubmoduleType", ): @@ -10420,7 +10503,7 @@ class CompositeOperation( '''String representation of the value.''' return typing.cast(builtins.str, jsii.invoke(self, "toString", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="expression") @abc.abstractmethod def expression(self) -> scope.jsii_calc_lib.NumericValue: @@ -10430,13 +10513,13 @@ class CompositeOperation( ''' ... - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="value") def value(self) -> jsii.Number: '''The value.''' return typing.cast(jsii.Number, jsii.get(self, "value")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="decorationPostfixes") def decoration_postfixes(self) -> typing.List[builtins.str]: '''A set of postfixes to include in a decorated .toString().''' @@ -10446,7 +10529,7 @@ class CompositeOperation( def decoration_postfixes(self, value: typing.List[builtins.str]) -> None: jsii.set(self, "decorationPostfixes", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="decorationPrefixes") def decoration_prefixes(self) -> typing.List[builtins.str]: '''A set of prefixes to include in a decorated .toString().''' @@ -10456,7 +10539,7 @@ class CompositeOperation( def decoration_prefixes(self, value: typing.List[builtins.str]) -> None: jsii.set(self, "decorationPrefixes", value) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="stringStyle") def string_style(self) -> "CompositeOperation.CompositionStringStyle": '''The .toString() style.''' @@ -10480,9 +10563,9 @@ class CompositeOperation( class _CompositeOperationProxy( CompositeOperation, - jsii.proxy_for(scope.jsii_calc_lib.Operation), # type: ignore[misc] + jsii.proxy_for(scope.jsii_calc_lib.Operation), ): - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="expression") def expression(self) -> scope.jsii_calc_lib.NumericValue: '''The expression that this operation consists of. @@ -10524,7 +10607,7 @@ class Base( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="prop") def prop(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "prop")) @@ -10573,7 +10656,7 @@ class Foo( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="bar") def bar(self) -> typing.Optional[builtins.str]: return typing.cast(typing.Optional[builtins.str], jsii.get(self, "bar")) @@ -10704,7 +10787,7 @@ class MyClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2530.MyClass") ''' jsii.create(self.__class__, self, [_]) - @jsii.member(jsii_name="bar") # type: ignore[misc] + @jsii.member(jsii_name="bar") @builtins.classmethod def bar(cls, _: builtins.bool) -> None: ''' @@ -10746,12 +10829,12 @@ class OnlyStatics( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2617.OnlyStatics", ): - @jsii.member(jsii_name="bar") # type: ignore[misc] + @jsii.member(jsii_name="bar") @builtins.classmethod def bar(cls) -> None: return typing.cast(None, jsii.sinvoke(cls, "bar", [])) - @jsii.member(jsii_name="foo") # type: ignore[misc] + @jsii.member(jsii_name="foo") @builtins.classmethod def foo(cls) -> None: return typing.cast(None, jsii.sinvoke(cls, "foo", [])) @@ -10782,9 +10865,9 @@ import scope.jsii_calc_base_of_base import scope.jsii_calc_lib -@jsii.implements(scope.jsii_calc_lib.IFriendly) class ExtendAndImplement( scope.jsii_calc_lib.BaseFor2647, + *(() if type(scope.jsii_calc_lib.IFriendly) is type(typing_extensions.Protocol) else (scope.jsii_calc_lib.IFriendly,)), metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2647.ExtendAndImplement", ): @@ -10909,12 +10992,12 @@ class MyClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2689.props.MyC def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="bar") def bar(self) -> typing.Mapping[builtins.str, scope.jsii_calc_base.BaseProps]: return typing.cast(typing.Mapping[builtins.str, scope.jsii_calc_base.BaseProps], jsii.get(self, "bar")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="foo") def foo(self) -> typing.List[scope.jsii_calc_lib.Number]: return typing.cast(typing.List[scope.jsii_calc_lib.Number], jsii.get(self, "foo")) @@ -11235,13 +11318,15 @@ from .._jsii import * @jsii.interface(jsii_type="jsii-calc.module2700.IFoo") -class IFoo(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class IFoo(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="baz") + @abc.abstractmethod def baz(self) -> jsii.Number: ... @jsii.member(jsii_name="bar") + @abc.abstractmethod def bar(self) -> builtins.str: ... @@ -11249,7 +11334,7 @@ class IFoo(typing_extensions.Protocol): class _IFooProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.module2700.IFoo" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="baz") def baz(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "baz")) @@ -11262,8 +11347,7 @@ class _IFooProxy: typing.cast(typing.Any, IFoo).__jsii_proxy_class__ = lambda : _IFooProxy -@jsii.implements(IFoo) -class Base(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2700.Base"): +class Base(IFoo, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2700.Base"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -11271,13 +11355,12 @@ class Base(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2700.Base"): def bar(self) -> builtins.str: return typing.cast(builtins.str, jsii.invoke(self, "bar", [])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="baz") def baz(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "baz")) -@jsii.implements(IFoo) class Derived(Base, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2700.Derived"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -11334,14 +11417,17 @@ class Class2( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="base") def base(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "base")) -@jsii.implements(scope.jsii_calc_base.IBaseInterface) -class Class3(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Class3"): +class Class3( + *(() if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else (scope.jsii_calc_base.IBaseInterface,)), + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.module2702.Class3", +): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -11359,15 +11445,20 @@ class Class3(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Class3"): @jsii.interface(jsii_type="jsii-calc.module2702.IBaz") -class IBaz(scope.jsii_calc_base.IBaseInterface, typing_extensions.Protocol): +@jsii.implements( + *((scope.jsii_calc_base.IBaseInterface,) if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else ()) +) +class IBaz( + *(() if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else (scope.jsii_calc_base.IBaseInterface,)), + metaclass = jsii.JSIIAbstractClass, +): @jsii.member(jsii_name="bazMethod") + @abc.abstractmethod def baz_method(self) -> None: ... -class _IBazProxy( - jsii.proxy_for(scope.jsii_calc_base.IBaseInterface) # type: ignore[misc] -): +class _IBazProxy(jsii.proxy_for(scope.jsii_calc_base.IBaseInterface)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.module2702.IBaz" @jsii.member(jsii_name="bazMethod") @@ -11379,8 +11470,9 @@ typing.cast(typing.Any, IBaz).__jsii_proxy_class__ = lambda : _IBazProxy @jsii.interface(jsii_type="jsii-calc.module2702.IConstruct") -class IConstruct(typing_extensions.Protocol): +class IConstruct(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="constructMethod") + @abc.abstractmethod def construct_method(self) -> None: ... @@ -11397,19 +11489,24 @@ typing.cast(typing.Any, IConstruct).__jsii_proxy_class__ = lambda : _IConstructP @jsii.interface(jsii_type="jsii-calc.module2702.IFoo") -class IFoo(scope.jsii_calc_base.IBaseInterface, typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +@jsii.implements( + *((scope.jsii_calc_base.IBaseInterface,) if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else ()) +) +class IFoo( + *(() if type(scope.jsii_calc_base.IBaseInterface) is type(typing_extensions.Protocol) else (scope.jsii_calc_base.IBaseInterface,)), + metaclass = jsii.JSIIAbstractClass, +): + @builtins.property @jsii.member(jsii_name="iBaseInterface") + @abc.abstractmethod def i_base_interface(self) -> builtins.str: ... -class _IFooProxy( - jsii.proxy_for(scope.jsii_calc_base.IBaseInterface) # type: ignore[misc] -): +class _IFooProxy(jsii.proxy_for(scope.jsii_calc_base.IBaseInterface)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.module2702.IFoo" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="iBaseInterface") def i_base_interface(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "iBaseInterface")) @@ -11419,15 +11516,14 @@ typing.cast(typing.Any, IFoo).__jsii_proxy_class__ = lambda : _IFooProxy @jsii.interface(jsii_type="jsii-calc.module2702.IResource") -class IResource(IConstruct, typing_extensions.Protocol): +class IResource(IConstruct, metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="resourceMethod") + @abc.abstractmethod def resource_method(self) -> None: ... -class _IResourceProxy( - jsii.proxy_for(IConstruct) # type: ignore[misc] -): +class _IResourceProxy(jsii.proxy_for(IConstruct)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.module2702.IResource" @jsii.member(jsii_name="resourceMethod") @@ -11439,15 +11535,14 @@ typing.cast(typing.Any, IResource).__jsii_proxy_class__ = lambda : _IResourcePro @jsii.interface(jsii_type="jsii-calc.module2702.IVpc") -class IVpc(IResource, typing_extensions.Protocol): +class IVpc(IResource, metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="vpcMethod") + @abc.abstractmethod def vpc_method(self) -> None: ... -class _IVpcProxy( - jsii.proxy_for(IResource) # type: ignore[misc] -): +class _IVpcProxy(jsii.proxy_for(IResource)): __jsii_type__: typing.ClassVar[str] = "jsii-calc.module2702.IVpc" @jsii.member(jsii_name="vpcMethod") @@ -11458,8 +11553,7 @@ class _IVpcProxy( typing.cast(typing.Any, IVpc).__jsii_proxy_class__ = lambda : _IVpcProxy -@jsii.implements(IBaz) -class Baz(Class3, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Baz"): +class Baz(Class3, IBaz, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Baz"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -11468,8 +11562,11 @@ class Baz(Class3, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Baz") return typing.cast(None, jsii.invoke(self, "bazMethod", [])) -@jsii.implements(IConstruct) -class Construct(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Construct"): +class Construct( + IConstruct, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.module2702.Construct", +): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -11478,9 +11575,9 @@ class Construct(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Constru return typing.cast(None, jsii.invoke(self, "constructMethod", [])) -@jsii.implements(IResource) class Resource( Construct, + IResource, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.module2702.Resource", ): @@ -11499,8 +11596,12 @@ class _ResourceProxy(Resource): typing.cast(typing.Any, Resource).__jsii_proxy_class__ = lambda : _ResourceProxy -@jsii.implements(IVpc) -class Vpc(Resource, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.module2702.Vpc"): +class Vpc( + Resource, + IVpc, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.module2702.Vpc", +): def __init__(self) -> None: jsii.create(self.__class__, self, []) @@ -11635,7 +11736,7 @@ class OnlyStaticMethods( ): '''Test for https://github.com/aws/jsii/issues/2617.''' - @jsii.member(jsii_name="staticMethod") # type: ignore[misc] + @jsii.member(jsii_name="staticMethod") @builtins.classmethod def static_method(cls) -> builtins.str: return typing.cast(builtins.str, jsii.sinvoke(cls, "staticMethod", [])) @@ -11685,7 +11786,7 @@ class ClassWithSelf( ''' return typing.cast(builtins.str, jsii.invoke(self_, "method", [self])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="self") def self(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "self")) @@ -11703,15 +11804,16 @@ class ClassWithSelfKwarg( jsii.create(self_.__class__, self_, [props]) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="props") def props(self) -> "StructWithSelf": return typing.cast("StructWithSelf", jsii.get(self, "props")) @jsii.interface(jsii_type="jsii-calc.PythonSelf.IInterfaceWithSelf") -class IInterfaceWithSelf(typing_extensions.Protocol): +class IInterfaceWithSelf(metaclass = jsii.JSIIAbstractClass): @jsii.member(jsii_name="method") + @abc.abstractmethod def method(self_, self: jsii.Number) -> builtins.str: ''' :param self: - @@ -11840,8 +11942,11 @@ class Default: ) -@jsii.implements(_INamespaced_e2f386ad) -class MyClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.submodule.MyClass"): +class MyClass( + _INamespaced_e2f386ad, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.submodule.MyClass", +): def __init__(self, *, prop: _SomeEnum_b2e41d92) -> None: ''' :param prop: @@ -11859,27 +11964,27 @@ class MyClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.submodule.MyClass"): return typing.cast(builtins.str, jsii.invoke(self, "methodWithSpecialParam", [param])) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="awesomeness") def awesomeness(self) -> _Awesomeness_d37a24df: return typing.cast(_Awesomeness_d37a24df, jsii.get(self, "awesomeness")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="definedAt") def defined_at(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "definedAt")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="goodness") def goodness(self) -> _Goodness_2df26737: return typing.cast(_Goodness_2df26737, jsii.get(self, "goodness")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="props") def props(self) -> _SomeStruct_91627123: return typing.cast(_SomeStruct_91627123, jsii.get(self, "props")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="allTypes") def all_types(self) -> typing.Optional[_AllTypes_b08307c5]: return typing.cast(typing.Optional[_AllTypes_b08307c5], jsii.get(self, "allTypes")) @@ -11991,7 +12096,7 @@ class InnerClass( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @jsii.python.classproperty # type: ignore[misc] + @jsii.python.class_property @jsii.member(jsii_name="staticProp") def STATIC_PROP(cls) -> "SomeStruct": return typing.cast("SomeStruct", jsii.sget(cls, "staticProp")) @@ -12009,7 +12114,7 @@ class OuterClass( def __init__(self) -> None: jsii.create(self.__class__, self, []) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="innerClass") def inner_class(self) -> InnerClass: return typing.cast(InnerClass, jsii.get(self, "innerClass")) @@ -12170,7 +12275,7 @@ from ..child import ( class Kwargs(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.submodule.isolated.Kwargs"): '''Ensures imports are correctly registered for kwargs lifted properties from super-structs.''' - @jsii.member(jsii_name="method") # type: ignore[misc] + @jsii.member(jsii_name="method") @builtins.classmethod def method( cls, @@ -12212,17 +12317,17 @@ from ..child import Goodness as _Goodness_2df26737 from .deeply_nested import INamespaced as _INamespaced_e2f386ad -@jsii.implements(_INamespaced_e2f386ad) class Namespaced( + _INamespaced_e2f386ad, metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.submodule.nested_submodule.Namespaced", ): - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="definedAt") def defined_at(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "definedAt")) - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="goodness") @abc.abstractmethod def goodness(self) -> _Goodness_2df26737: @@ -12230,7 +12335,7 @@ class Namespaced( class _NamespacedProxy(Namespaced): - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="goodness") def goodness(self) -> _Goodness_2df26737: return typing.cast(_Goodness_2df26737, jsii.get(self, "goodness")) @@ -12264,9 +12369,10 @@ from ...._jsii import * @jsii.interface( jsii_type="jsii-calc.submodule.nested_submodule.deeplyNested.INamespaced" ) -class INamespaced(typing_extensions.Protocol): - @builtins.property # type: ignore[misc] +class INamespaced(metaclass = jsii.JSIIAbstractClass): + @builtins.property @jsii.member(jsii_name="definedAt") + @abc.abstractmethod def defined_at(self) -> builtins.str: ... @@ -12274,7 +12380,7 @@ class INamespaced(typing_extensions.Protocol): class _INamespacedProxy: __jsii_type__: typing.ClassVar[str] = "jsii-calc.submodule.nested_submodule.deeplyNested.INamespaced" - @builtins.property # type: ignore[misc] + @builtins.property @jsii.member(jsii_name="definedAt") def defined_at(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "definedAt"))