jsii-pacmak 1.63.1 → 1.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/jsii-pacmak.js +10 -0
- package/lib/builder.d.ts +12 -7
- package/lib/builder.js +4 -3
- package/lib/generator.d.ts +7 -1
- package/lib/generator.js +4 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js +7 -5
- package/lib/target.d.ts +3 -0
- package/lib/target.js +4 -3
- package/lib/targets/dotnet/dotnetgenerator.d.ts +12 -2
- package/lib/targets/dotnet/dotnetgenerator.js +278 -14
- package/lib/targets/dotnet/dotnettyperesolver.d.ts +12 -0
- package/lib/targets/dotnet/dotnettyperesolver.js +54 -0
- package/lib/targets/dotnet/filegenerator.d.ts +1 -1
- package/lib/targets/dotnet/filegenerator.js +14 -1
- package/lib/targets/dotnet.js +5 -4
- package/lib/targets/go/package.d.ts +0 -3
- package/lib/targets/go/package.js +12 -28
- package/lib/targets/go/types/go-type-reference.js +6 -3
- package/lib/targets/go/types/interface.d.ts +2 -2
- package/lib/targets/go/types/interface.js +12 -3
- package/lib/targets/go/util.d.ts +1 -1
- package/lib/targets/go/util.js +2 -12
- package/lib/targets/java.d.ts +5 -2
- package/lib/targets/java.js +8 -7
- package/lib/targets/js.d.ts +1 -0
- package/lib/targets/js.js +4 -0
- package/lib/targets/python/type-name.d.ts +10 -0
- package/lib/targets/python/type-name.js +16 -2
- package/lib/targets/python.d.ts +3 -1
- package/lib/targets/python.js +54 -54
- package/lib/targets/version-utils.js +1 -1
- package/lib/version.d.ts +2 -2
- package/lib/version.js +3 -3
- package/package.json +16 -13
package/lib/targets/python.js
CHANGED
|
@@ -26,7 +26,7 @@ const DOCSTRING_QUOTES = "'''";
|
|
|
26
26
|
class Python extends target_1.Target {
|
|
27
27
|
constructor(options) {
|
|
28
28
|
super(options);
|
|
29
|
-
this.generator = new PythonGenerator(options.rosetta);
|
|
29
|
+
this.generator = new PythonGenerator(options.rosetta, options);
|
|
30
30
|
}
|
|
31
31
|
async generateCode(outDir, tarball) {
|
|
32
32
|
await super.generateCode(outDir, tarball);
|
|
@@ -295,7 +295,7 @@ class BasePythonClassType {
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
class BaseMethod {
|
|
298
|
-
constructor(generator, pythonName, jsName, parameters, returns, docs, isStatic,
|
|
298
|
+
constructor(generator, pythonName, jsName, parameters, returns, docs, isStatic, opts) {
|
|
299
299
|
this.generator = generator;
|
|
300
300
|
this.pythonName = pythonName;
|
|
301
301
|
this.jsName = jsName;
|
|
@@ -303,7 +303,6 @@ class BaseMethod {
|
|
|
303
303
|
this.returns = returns;
|
|
304
304
|
this.docs = docs;
|
|
305
305
|
this.isStatic = isStatic;
|
|
306
|
-
this.pythonParent = pythonParent;
|
|
307
306
|
this.classAsFirstParameter = false;
|
|
308
307
|
this.returnFromJSIIMethod = true;
|
|
309
308
|
this.shouldEmitBody = true;
|
|
@@ -420,7 +419,6 @@ class BaseMethod {
|
|
|
420
419
|
}
|
|
421
420
|
const decorators = new Array();
|
|
422
421
|
if (this.jsName !== undefined) {
|
|
423
|
-
// "# type: ignore[misc]" needed because mypy does not know how to check decorated declarations
|
|
424
422
|
decorators.push(`@jsii.member(jsii_name="${this.jsName}")`);
|
|
425
423
|
}
|
|
426
424
|
if (this.decorator !== undefined) {
|
|
@@ -430,22 +428,19 @@ class BaseMethod {
|
|
|
430
428
|
decorators.push('@abc.abstractmethod');
|
|
431
429
|
}
|
|
432
430
|
if (decorators.length > 0) {
|
|
433
|
-
|
|
434
|
-
for (const decorator of decorators
|
|
435
|
-
.join(' # type: ignore[misc]\n')
|
|
436
|
-
.split('\n')) {
|
|
431
|
+
for (const decorator of decorators) {
|
|
437
432
|
code.line(decorator);
|
|
438
433
|
}
|
|
439
434
|
}
|
|
440
435
|
pythonParams.unshift(slugifyAsNeeded(this.implicitParameter, pythonParams.map((param) => param.split(':')[0].trim())));
|
|
441
|
-
openSignature(code, 'def', this.pythonName, pythonParams,
|
|
436
|
+
openSignature(code, 'def', this.pythonName, pythonParams, returnType);
|
|
442
437
|
this.generator.emitDocString(code, this.apiLocation, this.docs, {
|
|
443
438
|
arguments: documentableArgs,
|
|
444
439
|
documentableItem: `method-${this.pythonName}`,
|
|
445
440
|
});
|
|
446
441
|
if ((this.shouldEmitBody || forceEmitBody) &&
|
|
447
442
|
(!renderAbstract || !this.abstract)) {
|
|
448
|
-
emitParameterTypeChecks(code, pythonParams.slice(1), `${this.
|
|
443
|
+
emitParameterTypeChecks(code, context, pythonParams.slice(1), `${(0, type_name_1.toPythonFullName)(this.parent.fqn, context.assembly)}.${this.pythonName}`);
|
|
449
444
|
}
|
|
450
445
|
this.emitBody(code, context, renderAbstract, forceEmitBody, liftedPropNames, pythonParams[0], returnType);
|
|
451
446
|
code.closeBlock();
|
|
@@ -546,13 +541,12 @@ class BaseMethod {
|
|
|
546
541
|
}
|
|
547
542
|
}
|
|
548
543
|
class BaseProperty {
|
|
549
|
-
constructor(generator, pythonName, jsName, type, docs,
|
|
544
|
+
constructor(generator, pythonName, jsName, type, docs, opts) {
|
|
550
545
|
this.generator = generator;
|
|
551
546
|
this.pythonName = pythonName;
|
|
552
547
|
this.jsName = jsName;
|
|
553
548
|
this.type = type;
|
|
554
549
|
this.docs = docs;
|
|
555
|
-
this.pythonParent = pythonParent;
|
|
556
550
|
this.shouldEmitBody = true;
|
|
557
551
|
const { abstract = false, immutable = false, isStatic = false } = opts;
|
|
558
552
|
this.abstract = abstract;
|
|
@@ -569,13 +563,17 @@ class BaseProperty {
|
|
|
569
563
|
emit(code, context, opts) {
|
|
570
564
|
const { renderAbstract = true, forceEmitBody = false } = opts ?? {};
|
|
571
565
|
const pythonType = (0, type_name_1.toTypeName)(this.type).pythonType(context);
|
|
572
|
-
|
|
573
|
-
code.line(`@${this.decorator} # type: ignore[misc]`);
|
|
566
|
+
code.line(`@${this.decorator}`);
|
|
574
567
|
code.line(`@jsii.member(jsii_name="${this.jsName}")`);
|
|
575
568
|
if (renderAbstract && this.abstract) {
|
|
576
569
|
code.line('@abc.abstractmethod');
|
|
577
570
|
}
|
|
578
|
-
openSignature(code, 'def', this.pythonName, [this.implicitParameter],
|
|
571
|
+
openSignature(code, 'def', this.pythonName, [this.implicitParameter], pythonType,
|
|
572
|
+
// PyRight and MyPY both special-case @property, but not custom implementations such as our @classproperty...
|
|
573
|
+
// MyPY reports on the re-declaration, but PyRight reports on the initial declaration (duh!)
|
|
574
|
+
this.isStatic && !this.immutable
|
|
575
|
+
? 'pyright: ignore [reportGeneralTypeIssues]'
|
|
576
|
+
: undefined);
|
|
579
577
|
this.generator.emitDocString(code, this.apiLocation, this.docs, {
|
|
580
578
|
documentableItem: `prop-${this.pythonName}`,
|
|
581
579
|
});
|
|
@@ -590,18 +588,20 @@ class BaseProperty {
|
|
|
590
588
|
code.closeBlock();
|
|
591
589
|
if (!this.immutable) {
|
|
592
590
|
code.line();
|
|
591
|
+
// PyRight and MyPY both special-case @property, but not custom implementations such as our @classproperty...
|
|
592
|
+
// MyPY reports on the re-declaration, but PyRight reports on the initial declaration (duh!)
|
|
593
593
|
code.line(`@${this.pythonName}.setter${this.isStatic ? ' # type: ignore[no-redef]' : ''}`);
|
|
594
594
|
if (renderAbstract && this.abstract) {
|
|
595
595
|
code.line('@abc.abstractmethod');
|
|
596
596
|
}
|
|
597
|
-
openSignature(code, 'def', this.pythonName, [this.implicitParameter, `value: ${pythonType}`],
|
|
597
|
+
openSignature(code, 'def', this.pythonName, [this.implicitParameter, `value: ${pythonType}`], 'None');
|
|
598
598
|
if ((this.shouldEmitBody || forceEmitBody) &&
|
|
599
599
|
(!renderAbstract || !this.abstract)) {
|
|
600
|
-
emitParameterTypeChecks(code, [`value: ${pythonType}`],
|
|
600
|
+
emitParameterTypeChecks(code, context, [`value: ${pythonType}`],
|
|
601
601
|
// In order to get a property accessor, we must resort to getting the
|
|
602
602
|
// attribute on the type, instead of the value (where the getter would
|
|
603
603
|
// be implicitly invoked for us...)
|
|
604
|
-
`getattr(${this.
|
|
604
|
+
`getattr(${(0, type_name_1.toPythonFullName)(this.parent.fqn, context.assembly)}, ${JSON.stringify(this.pythonName)}).fset`);
|
|
605
605
|
code.line(`jsii.${this.jsiiSetMethod}(${this.implicitParameter}, "${this.jsName}", value)`);
|
|
606
606
|
}
|
|
607
607
|
else {
|
|
@@ -734,20 +734,17 @@ class Struct extends BasePythonClassType {
|
|
|
734
734
|
const constructorArguments = kwargs.length > 0
|
|
735
735
|
? [implicitParameter, '*', ...kwargs]
|
|
736
736
|
: [implicitParameter];
|
|
737
|
-
openSignature(code, 'def', '__init__', constructorArguments,
|
|
737
|
+
openSignature(code, 'def', '__init__', constructorArguments, 'None');
|
|
738
738
|
this.emitConstructorDocstring(code);
|
|
739
739
|
// Re-type struct arguments that were passed as "dict". Do this before validating argument types...
|
|
740
740
|
for (const member of members.filter((m) => m.isStruct(this.generator))) {
|
|
741
741
|
// Note that "None" is NOT an instance of dict (that's convenient!)
|
|
742
|
-
const typeName = (0, type_name_1.
|
|
743
|
-
...context,
|
|
744
|
-
typeAnnotation: false,
|
|
745
|
-
});
|
|
742
|
+
const typeName = (0, type_name_1.toPythonFullName)(member.type.type.fqn, context.assembly);
|
|
746
743
|
code.openBlock(`if isinstance(${member.pythonName}, dict)`);
|
|
747
744
|
code.line(`${member.pythonName} = ${typeName}(**${member.pythonName})`);
|
|
748
745
|
code.closeBlock();
|
|
749
746
|
}
|
|
750
|
-
emitParameterTypeChecks(code, kwargs, `${this.
|
|
747
|
+
emitParameterTypeChecks(code, context, kwargs, `${(0, type_name_1.toPythonFullName)(this.spec.fqn, context.assembly)}.__init__`);
|
|
751
748
|
// Required properties, those will always be put into the dict
|
|
752
749
|
assignDictionary(code, `${implicitParameter}._values: typing.Dict[str, typing.Any]`, members
|
|
753
750
|
.filter((m) => !m.optional)
|
|
@@ -774,7 +771,7 @@ class Struct extends BasePythonClassType {
|
|
|
774
771
|
emitGetter(member, code, context) {
|
|
775
772
|
const pythonType = member.typeAnnotation(context);
|
|
776
773
|
code.line('@builtins.property');
|
|
777
|
-
openSignature(code, 'def', member.pythonName, ['self'],
|
|
774
|
+
openSignature(code, 'def', member.pythonName, ['self'], pythonType);
|
|
778
775
|
member.emitDocString(code);
|
|
779
776
|
// NOTE: No parameter to validate here, this is a getter.
|
|
780
777
|
code.line(`result = self._values.get(${JSON.stringify(member.pythonName)})`);
|
|
@@ -1485,6 +1482,12 @@ class Package {
|
|
|
1485
1482
|
.reduce((buildTools, entry) => (entry ? [...buildTools, entry] : buildTools), new Array());
|
|
1486
1483
|
code.line(`requires = [${buildTools.map((x) => `"${x}"`).join(', ')}]`);
|
|
1487
1484
|
code.line('build-backend = "setuptools.build_meta"');
|
|
1485
|
+
code.line();
|
|
1486
|
+
code.line('[tool.pyright]');
|
|
1487
|
+
code.line('defineConstant = { DEBUG = true }');
|
|
1488
|
+
code.line('pythonVersion = "3.7"');
|
|
1489
|
+
code.line('pythonPlatform = "All"');
|
|
1490
|
+
code.line('reportSelfClsParameterName = false');
|
|
1488
1491
|
code.closeFile('pyproject.toml');
|
|
1489
1492
|
// We also need to write out a MANIFEST.in to ensure that all of our required
|
|
1490
1493
|
// files are included.
|
|
@@ -1577,7 +1580,7 @@ class TypeResolver {
|
|
|
1577
1580
|
}
|
|
1578
1581
|
}
|
|
1579
1582
|
class PythonGenerator extends generator_1.Generator {
|
|
1580
|
-
constructor(rosetta, options
|
|
1583
|
+
constructor(rosetta, options) {
|
|
1581
1584
|
super(options);
|
|
1582
1585
|
this.rosetta = rosetta;
|
|
1583
1586
|
this.code.openBlockFormatter = (s) => `${s}:`;
|
|
@@ -1725,6 +1728,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1725
1728
|
assembly: assm,
|
|
1726
1729
|
emittedTypes: new Set(),
|
|
1727
1730
|
resolver,
|
|
1731
|
+
runtimeTypeChecking: this.runtimeTypeChecking,
|
|
1728
1732
|
submodule: assm.name,
|
|
1729
1733
|
typeResolver: (fqn) => resolver.dereference(fqn),
|
|
1730
1734
|
});
|
|
@@ -1774,7 +1778,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1774
1778
|
if (cls.initializer !== undefined) {
|
|
1775
1779
|
const { parameters = [] } = cls.initializer;
|
|
1776
1780
|
klass.addMember(new Initializer(this, '__init__', undefined, parameters, undefined, cls.initializer.docs, false, // Never static
|
|
1777
|
-
|
|
1781
|
+
{ liftedProp: this.getliftedProp(cls.initializer), parent: cls }));
|
|
1778
1782
|
}
|
|
1779
1783
|
this.addPythonType(klass);
|
|
1780
1784
|
}
|
|
@@ -1782,7 +1786,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1782
1786
|
const { parameters = [] } = method;
|
|
1783
1787
|
const klass = this.getPythonType(cls.fqn);
|
|
1784
1788
|
klass.addMember(new StaticMethod(this, toPythonMethodName(method.name), method.name, parameters, method.returns, method.docs, true, // Always static
|
|
1785
|
-
|
|
1789
|
+
{
|
|
1786
1790
|
abstract: method.abstract,
|
|
1787
1791
|
liftedProp: this.getliftedProp(method),
|
|
1788
1792
|
parent: cls,
|
|
@@ -1790,7 +1794,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1790
1794
|
}
|
|
1791
1795
|
onStaticProperty(cls, prop) {
|
|
1792
1796
|
const klass = this.getPythonType(cls.fqn);
|
|
1793
|
-
klass.addMember(new StaticProperty(this, toPythonPropertyName(prop.name, prop.const), prop.name, prop, prop.docs,
|
|
1797
|
+
klass.addMember(new StaticProperty(this, toPythonPropertyName(prop.name, prop.const), prop.name, prop, prop.docs, {
|
|
1794
1798
|
abstract: prop.abstract,
|
|
1795
1799
|
immutable: prop.immutable,
|
|
1796
1800
|
isStatic: prop.static,
|
|
@@ -1801,14 +1805,14 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1801
1805
|
const { parameters = [] } = method;
|
|
1802
1806
|
const klass = this.getPythonType(cls.fqn);
|
|
1803
1807
|
if (method.async) {
|
|
1804
|
-
klass.addMember(new AsyncMethod(this, toPythonMethodName(method.name, method.protected), method.name, parameters, method.returns, method.docs, !!method.static,
|
|
1808
|
+
klass.addMember(new AsyncMethod(this, toPythonMethodName(method.name, method.protected), method.name, parameters, method.returns, method.docs, !!method.static, {
|
|
1805
1809
|
abstract: method.abstract,
|
|
1806
1810
|
liftedProp: this.getliftedProp(method),
|
|
1807
1811
|
parent: cls,
|
|
1808
1812
|
}));
|
|
1809
1813
|
}
|
|
1810
1814
|
else {
|
|
1811
|
-
klass.addMember(new Method(this, toPythonMethodName(method.name, method.protected), method.name, parameters, method.returns, method.docs, !!method.static,
|
|
1815
|
+
klass.addMember(new Method(this, toPythonMethodName(method.name, method.protected), method.name, parameters, method.returns, method.docs, !!method.static, {
|
|
1812
1816
|
abstract: method.abstract,
|
|
1813
1817
|
liftedProp: this.getliftedProp(method),
|
|
1814
1818
|
parent: cls,
|
|
@@ -1817,7 +1821,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1817
1821
|
}
|
|
1818
1822
|
onProperty(cls, prop) {
|
|
1819
1823
|
const klass = this.getPythonType(cls.fqn);
|
|
1820
|
-
klass.addMember(new Property(this, toPythonPropertyName(prop.name, prop.const, prop.protected), prop.name, prop, prop.docs,
|
|
1824
|
+
klass.addMember(new Property(this, toPythonPropertyName(prop.name, prop.const, prop.protected), prop.name, prop, prop.docs, {
|
|
1821
1825
|
abstract: prop.abstract,
|
|
1822
1826
|
immutable: prop.immutable,
|
|
1823
1827
|
isStatic: prop.static,
|
|
@@ -1843,7 +1847,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1843
1847
|
onInterfaceMethod(ifc, method) {
|
|
1844
1848
|
const { parameters = [] } = method;
|
|
1845
1849
|
const klass = this.getPythonType(ifc.fqn);
|
|
1846
|
-
klass.addMember(new InterfaceMethod(this, toPythonMethodName(method.name, method.protected), method.name, parameters, method.returns, method.docs, !!method.static,
|
|
1850
|
+
klass.addMember(new InterfaceMethod(this, toPythonMethodName(method.name, method.protected), method.name, parameters, method.returns, method.docs, !!method.static, { liftedProp: this.getliftedProp(method), parent: ifc }));
|
|
1847
1851
|
}
|
|
1848
1852
|
onInterfaceProperty(ifc, prop) {
|
|
1849
1853
|
let ifaceProperty;
|
|
@@ -1852,7 +1856,7 @@ class PythonGenerator extends generator_1.Generator {
|
|
|
1852
1856
|
ifaceProperty = new StructField(this, prop, ifc);
|
|
1853
1857
|
}
|
|
1854
1858
|
else {
|
|
1855
|
-
ifaceProperty = new InterfaceProperty(this, toPythonPropertyName(prop.name, prop.const, prop.protected), prop.name, prop, prop.docs,
|
|
1859
|
+
ifaceProperty = new InterfaceProperty(this, toPythonPropertyName(prop.name, prop.const, prop.protected), prop.name, prop, prop.docs, { immutable: prop.immutable, isStatic: prop.static, parent: ifc });
|
|
1856
1860
|
}
|
|
1857
1861
|
klass.addMember(ifaceProperty);
|
|
1858
1862
|
}
|
|
@@ -1974,7 +1978,7 @@ function slugifyAsNeeded(name, inUse) {
|
|
|
1974
1978
|
//
|
|
1975
1979
|
// @see https://black.readthedocs.io/en/stable/the_black_code_style.html
|
|
1976
1980
|
const TARGET_LINE_LENGTH = 88;
|
|
1977
|
-
function openSignature(code, keyword, name, params,
|
|
1981
|
+
function openSignature(code, keyword, name, params, returnType, lineComment) {
|
|
1978
1982
|
const prefix = `${keyword} ${name}`;
|
|
1979
1983
|
const suffix = returnType ? ` -> ${returnType}` : '';
|
|
1980
1984
|
if (params.length === 0) {
|
|
@@ -1983,8 +1987,8 @@ function openSignature(code, keyword, name, params, trailingComma = false, retur
|
|
|
1983
1987
|
}
|
|
1984
1988
|
const join = ', ';
|
|
1985
1989
|
const { elementsSize, joinSize } = totalSizeOf(params, join);
|
|
1986
|
-
const hasComments =
|
|
1987
|
-
if (hasComments &&
|
|
1990
|
+
const hasComments = params.some((param) => /#\s*.+$/.exec(param) != null);
|
|
1991
|
+
if (!hasComments &&
|
|
1988
1992
|
TARGET_LINE_LENGTH >
|
|
1989
1993
|
code.currentIndentLength +
|
|
1990
1994
|
prefix.length +
|
|
@@ -1992,25 +1996,15 @@ function openSignature(code, keyword, name, params, trailingComma = false, retur
|
|
|
1992
1996
|
joinSize +
|
|
1993
1997
|
suffix.length +
|
|
1994
1998
|
2) {
|
|
1995
|
-
code.
|
|
1999
|
+
code.indent(`${prefix}(${params.join(join)})${suffix}:${lineComment ? ` # ${lineComment}` : ''}`);
|
|
1996
2000
|
return;
|
|
1997
2001
|
}
|
|
1998
2002
|
code.indent(`${prefix}(`);
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
code.currentIndentLength +
|
|
2002
|
-
elementsSize +
|
|
2003
|
-
joinSize +
|
|
2004
|
-
(trailingComma ? 1 : 0)) {
|
|
2005
|
-
code.line(`${params.join(join)}${trailingComma ? ',' : ''}`);
|
|
2006
|
-
}
|
|
2007
|
-
else {
|
|
2008
|
-
for (const param of params) {
|
|
2009
|
-
code.line(param.replace(/(\s*# .+)?$/, ',$1'));
|
|
2010
|
-
}
|
|
2003
|
+
for (const param of params) {
|
|
2004
|
+
code.line(param.replace(/(\s*# .+)?$/, ',$1'));
|
|
2011
2005
|
}
|
|
2012
2006
|
code.unindent(false);
|
|
2013
|
-
code.
|
|
2007
|
+
code.indent(`)${suffix}:${lineComment ? ` # ${lineComment}` : ''}`);
|
|
2014
2008
|
}
|
|
2015
2009
|
/**
|
|
2016
2010
|
* Emits runtime type checking code for parameters.
|
|
@@ -2019,9 +2013,12 @@ function openSignature(code, keyword, name, params, trailingComma = false, retur
|
|
|
2019
2013
|
* @param params the parameter signatures to be type-checked.
|
|
2020
2014
|
* @param typedEntity the type-annotated entity.
|
|
2021
2015
|
*/
|
|
2022
|
-
function emitParameterTypeChecks(code, params, typedEntity) {
|
|
2016
|
+
function emitParameterTypeChecks(code, context, params, typedEntity) {
|
|
2017
|
+
if (!context.runtimeTypeChecking) {
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2023
2020
|
const paramInfo = params.map((param) => {
|
|
2024
|
-
const [name] = param.split(/\s*[
|
|
2021
|
+
const [name] = param.split(/\s*[:=#]\s*/, 1);
|
|
2025
2022
|
if (name === '*') {
|
|
2026
2023
|
return { kwargsMark: true };
|
|
2027
2024
|
}
|
|
@@ -2046,11 +2043,14 @@ function emitParameterTypeChecks(code, params, typedEntity) {
|
|
|
2046
2043
|
openedBlock = true;
|
|
2047
2044
|
}
|
|
2048
2045
|
let expectedType = `${typesVar}[${JSON.stringify(name)}]`;
|
|
2046
|
+
let comment = '';
|
|
2049
2047
|
if (is_rest) {
|
|
2050
2048
|
// This is a vararg, so the value will appear as a tuple.
|
|
2051
2049
|
expectedType = `typing.Tuple[${expectedType}, ...]`;
|
|
2050
|
+
// Need to ignore reportGeneralTypeIssues because pyright incorrectly parses that as a type annotation 😒
|
|
2051
|
+
comment = ' # pyright: ignore [reportGeneralTypeIssues]';
|
|
2052
2052
|
}
|
|
2053
|
-
code.line(`check_type(argname=${JSON.stringify(`argument ${name}`)}, value=${name}, expected_type=${expectedType})`);
|
|
2053
|
+
code.line(`check_type(argname=${JSON.stringify(`argument ${name}`)}, value=${name}, expected_type=${expectedType})${comment}`);
|
|
2054
2054
|
}
|
|
2055
2055
|
if (openedBlock) {
|
|
2056
2056
|
code.closeBlock();
|
|
@@ -72,7 +72,7 @@ exports.toPythonVersionRange = toPythonVersionRange;
|
|
|
72
72
|
* @returns the version that should be serialized
|
|
73
73
|
*/
|
|
74
74
|
function toReleaseVersion(assemblyVersion, target) {
|
|
75
|
-
const version = (0, semver_1.parse)(assemblyVersion
|
|
75
|
+
const version = (0, semver_1.parse)(assemblyVersion);
|
|
76
76
|
if (version == null) {
|
|
77
77
|
throw new Error(`Unable to parse the provided assembly version: "${assemblyVersion}"`);
|
|
78
78
|
}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.65.0";
|
|
3
3
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
4
|
-
export declare const VERSION_DESC = "1.
|
|
4
|
+
export declare const VERSION_DESC = "1.65.0 (build 7a02b7f)";
|
|
5
5
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/version.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated at 2022-
|
|
2
|
+
// Generated at 2022-08-18T14:34:45Z by generate.sh
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.VERSION_DESC = exports.VERSION = void 0;
|
|
5
5
|
/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
|
|
6
|
-
exports.VERSION = '1.
|
|
6
|
+
exports.VERSION = '1.65.0';
|
|
7
7
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
8
|
-
exports.VERSION_DESC = '1.
|
|
8
|
+
exports.VERSION_DESC = '1.65.0 (build 7a02b7f)';
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-pacmak",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.65.0",
|
|
4
4
|
"description": "A code generation framework for jsii backend languages",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,32 +37,35 @@
|
|
|
37
37
|
"package": "package-js"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@jsii/check-node": "1.
|
|
41
|
-
"@jsii/spec": "^1.
|
|
40
|
+
"@jsii/check-node": "1.65.0",
|
|
41
|
+
"@jsii/spec": "^1.65.0",
|
|
42
42
|
"clone": "^2.1.2",
|
|
43
|
-
"codemaker": "^1.
|
|
43
|
+
"codemaker": "^1.65.0",
|
|
44
44
|
"commonmark": "^0.30.0",
|
|
45
45
|
"escape-string-regexp": "^4.0.0",
|
|
46
46
|
"fs-extra": "^10.1.0",
|
|
47
|
-
"jsii-reflect": "^1.
|
|
48
|
-
"jsii-rosetta": "^1.
|
|
47
|
+
"jsii-reflect": "^1.65.0",
|
|
48
|
+
"jsii-rosetta": "^1.65.0",
|
|
49
49
|
"semver": "^7.3.7",
|
|
50
50
|
"spdx-license-list": "^6.6.0",
|
|
51
51
|
"xmlbuilder": "^15.1.1",
|
|
52
52
|
"yargs": "^16.2.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@jsii/dotnet-runtime": "^1.
|
|
56
|
-
"@jsii/java-runtime": "^1.
|
|
57
|
-
"@jsii/go-runtime": "^1.
|
|
58
|
-
"@scope/jsii-calc-lib": "^1.
|
|
55
|
+
"@jsii/dotnet-runtime": "^1.65.0",
|
|
56
|
+
"@jsii/java-runtime": "^1.65.0",
|
|
57
|
+
"@jsii/go-runtime": "^1.65.0",
|
|
58
|
+
"@scope/jsii-calc-lib": "^1.65.0",
|
|
59
59
|
"@types/clone": "^2.1.1",
|
|
60
|
+
"@types/diff": "^5.0.2",
|
|
60
61
|
"@types/commonmark": "^0.27.5",
|
|
61
62
|
"@types/fs-extra": "^9.0.13",
|
|
62
63
|
"@types/semver": "^7.3.10",
|
|
63
|
-
"
|
|
64
|
-
"jsii
|
|
65
|
-
"jsii-
|
|
64
|
+
"diff": "^5.1.0",
|
|
65
|
+
"jsii": "^1.65.0",
|
|
66
|
+
"jsii-build-tools": "^1.65.0",
|
|
67
|
+
"jsii-calc": "^3.20.120",
|
|
68
|
+
"pyright": "^1.1.266"
|
|
66
69
|
},
|
|
67
70
|
"keywords": [
|
|
68
71
|
"jsii",
|