@suss/adapter-python 0.37.1 → 0.38.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/dist/index.cjs +15 -6
- package/dist/index.js +15 -6
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -164,6 +164,11 @@ function stringLiteralValue(node) {
|
|
|
164
164
|
}
|
|
165
165
|
return content;
|
|
166
166
|
}
|
|
167
|
+
function numberLiteralValue(node) {
|
|
168
|
+
const text2 = node.text.replaceAll("_", "");
|
|
169
|
+
const value = /[jJ]$/.test(text2) ? Number.NaN : Number(text2);
|
|
170
|
+
return Number.isFinite(value) ? value : null;
|
|
171
|
+
}
|
|
167
172
|
function children(node) {
|
|
168
173
|
if (node === null || node === void 0) {
|
|
169
174
|
return [];
|
|
@@ -2698,9 +2703,13 @@ function stringsIn(nodes) {
|
|
|
2698
2703
|
|
|
2699
2704
|
// src/values/lowering.ts
|
|
2700
2705
|
var ROOT_TYPES = /* @__PURE__ */ new Set(["module", "function_definition", "lambda"]);
|
|
2706
|
+
var numberLiteral = (node) => {
|
|
2707
|
+
const value = numberLiteralValue(node);
|
|
2708
|
+
return value === null ? { kind: "opaque" } : { kind: "literal", value };
|
|
2709
|
+
};
|
|
2701
2710
|
var LITERAL_TYPES = {
|
|
2702
|
-
integer:
|
|
2703
|
-
float:
|
|
2711
|
+
integer: numberLiteral,
|
|
2712
|
+
float: numberLiteral,
|
|
2704
2713
|
true: () => ({ kind: "literal", value: true }),
|
|
2705
2714
|
false: () => ({ kind: "literal", value: false }),
|
|
2706
2715
|
none: () => ({ kind: "literal", value: null })
|
|
@@ -3658,8 +3667,8 @@ function argShapeOf(node) {
|
|
|
3658
3667
|
return { kind: "string", value: literal };
|
|
3659
3668
|
}
|
|
3660
3669
|
if (node.type === "integer") {
|
|
3661
|
-
const value =
|
|
3662
|
-
if (
|
|
3670
|
+
const value = numberLiteralValue(node);
|
|
3671
|
+
if (value !== null) {
|
|
3663
3672
|
return { kind: "number", value };
|
|
3664
3673
|
}
|
|
3665
3674
|
return { kind: "other" };
|
|
@@ -6912,8 +6921,8 @@ function shapeOfReturned(node, depth = 0) {
|
|
|
6912
6921
|
return { type: "literal", value: node.text.slice(1, -1) };
|
|
6913
6922
|
}
|
|
6914
6923
|
if (node.type === "integer") {
|
|
6915
|
-
const value =
|
|
6916
|
-
return
|
|
6924
|
+
const value = numberLiteralValue(node);
|
|
6925
|
+
return value === null ? { type: "integer" } : { type: "literal", value };
|
|
6917
6926
|
}
|
|
6918
6927
|
if (node.type === "float") {
|
|
6919
6928
|
return { type: "number" };
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,11 @@ function stringLiteralValue(node) {
|
|
|
93
93
|
}
|
|
94
94
|
return content;
|
|
95
95
|
}
|
|
96
|
+
function numberLiteralValue(node) {
|
|
97
|
+
const text2 = node.text.replaceAll("_", "");
|
|
98
|
+
const value = /[jJ]$/.test(text2) ? Number.NaN : Number(text2);
|
|
99
|
+
return Number.isFinite(value) ? value : null;
|
|
100
|
+
}
|
|
96
101
|
function children(node) {
|
|
97
102
|
if (node === null || node === void 0) {
|
|
98
103
|
return [];
|
|
@@ -2655,9 +2660,13 @@ function stringsIn(nodes) {
|
|
|
2655
2660
|
|
|
2656
2661
|
// src/values/lowering.ts
|
|
2657
2662
|
var ROOT_TYPES = /* @__PURE__ */ new Set(["module", "function_definition", "lambda"]);
|
|
2663
|
+
var numberLiteral = (node) => {
|
|
2664
|
+
const value = numberLiteralValue(node);
|
|
2665
|
+
return value === null ? { kind: "opaque" } : { kind: "literal", value };
|
|
2666
|
+
};
|
|
2658
2667
|
var LITERAL_TYPES = {
|
|
2659
|
-
integer:
|
|
2660
|
-
float:
|
|
2668
|
+
integer: numberLiteral,
|
|
2669
|
+
float: numberLiteral,
|
|
2661
2670
|
true: () => ({ kind: "literal", value: true }),
|
|
2662
2671
|
false: () => ({ kind: "literal", value: false }),
|
|
2663
2672
|
none: () => ({ kind: "literal", value: null })
|
|
@@ -3637,8 +3646,8 @@ function argShapeOf(node) {
|
|
|
3637
3646
|
return { kind: "string", value: literal };
|
|
3638
3647
|
}
|
|
3639
3648
|
if (node.type === "integer") {
|
|
3640
|
-
const value =
|
|
3641
|
-
if (
|
|
3649
|
+
const value = numberLiteralValue(node);
|
|
3650
|
+
if (value !== null) {
|
|
3642
3651
|
return { kind: "number", value };
|
|
3643
3652
|
}
|
|
3644
3653
|
return { kind: "other" };
|
|
@@ -6932,8 +6941,8 @@ function shapeOfReturned(node, depth = 0) {
|
|
|
6932
6941
|
return { type: "literal", value: node.text.slice(1, -1) };
|
|
6933
6942
|
}
|
|
6934
6943
|
if (node.type === "integer") {
|
|
6935
|
-
const value =
|
|
6936
|
-
return
|
|
6944
|
+
const value = numberLiteralValue(node);
|
|
6945
|
+
return value === null ? { type: "integer" } : { type: "literal", value };
|
|
6937
6946
|
}
|
|
6938
6947
|
if (node.type === "float") {
|
|
6939
6948
|
return { type: "number" };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-python",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Read a Python codebase with suss and check what each FastAPI or Flask route returns against the clients, specs and infrastructure that depend on it.",
|
|
6
6
|
"keywords": [
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"typecheck": "tsc --noEmit"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@suss/behavioral-ir": "0.
|
|
53
|
-
"@suss/datalog": "0.
|
|
54
|
-
"@suss/extractor": "0.
|
|
55
|
-
"@suss/ir-core": "0.
|
|
56
|
-
"@suss/resolution": "0.
|
|
57
|
-
"@suss/sql": "0.
|
|
58
|
-
"@suss/values": "0.
|
|
52
|
+
"@suss/behavioral-ir": "0.38.0",
|
|
53
|
+
"@suss/datalog": "0.38.0",
|
|
54
|
+
"@suss/extractor": "0.38.0",
|
|
55
|
+
"@suss/ir-core": "0.38.0",
|
|
56
|
+
"@suss/resolution": "0.38.0",
|
|
57
|
+
"@suss/sql": "0.38.0",
|
|
58
|
+
"@suss/values": "0.38.0",
|
|
59
59
|
"smol-toml": "^1.4.2",
|
|
60
60
|
"web-tree-sitter": "^0.26.11"
|
|
61
61
|
},
|