@suss/adapter-python 0.27.0 → 0.28.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 +690 -452
- package/dist/index.d.cts +33 -12
- package/dist/index.d.ts +33 -12
- package/dist/index.js +683 -440
- package/package.json +8 -8
package/dist/index.d.cts
CHANGED
|
@@ -717,12 +717,15 @@ interface StorageLookup {
|
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
/**
|
|
720
|
-
* What a call's callee is
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
720
|
+
* What a call's callee is: a function in this run the walk can step
|
|
721
|
+
* into, or a reason it cannot.
|
|
722
|
+
*
|
|
723
|
+
* The rules in @suss/resolution decide it. Every language feature that
|
|
724
|
+
* moves a value is a hop they already state, so nothing here reads a
|
|
725
|
+
* name, an alias, an attribute, or an instance for itself.
|
|
726
|
+
*
|
|
727
|
+
* What is left is about files rather than values: a module before the
|
|
728
|
+
* dot, and a name only a wildcard import could have brought in.
|
|
726
729
|
*/
|
|
727
730
|
|
|
728
731
|
/** A function in this run, and the export path its summary gets. */
|
|
@@ -754,6 +757,8 @@ interface WrapperIndexOptions {
|
|
|
754
757
|
packs: readonly PythonPack[];
|
|
755
758
|
roots: string[];
|
|
756
759
|
facts: Database | undefined;
|
|
760
|
+
/** The function each function key was read from. */
|
|
761
|
+
definitions: ReadonlyMap<string, Node>;
|
|
757
762
|
storageFor: (file: BoundPythonFile) => StorageLookup | undefined;
|
|
758
763
|
}
|
|
759
764
|
/** The route asking which wrappers reach it: the decorator it was found by, and where that decorator was read. */
|
|
@@ -787,6 +792,8 @@ declare class PythonWrapperIndex {
|
|
|
787
792
|
private readonly unitsByKey;
|
|
788
793
|
private readonly unitsByFile;
|
|
789
794
|
constructor(options: WrapperIndexOptions, filesByPath: ReadonlyMap<string, BoundPythonFile>);
|
|
795
|
+
/** The project function a module-level name in this file refers to, or null for anything else. */
|
|
796
|
+
functionCalled(file: string, name: string): ReachedFunction | null;
|
|
790
797
|
register(covers: {
|
|
791
798
|
kind: "everyRoute";
|
|
792
799
|
pack: string;
|
|
@@ -843,11 +850,7 @@ interface DiscoveryOptions {
|
|
|
843
850
|
}
|
|
844
851
|
declare function discoverUnits(root: Node, module: ModuleBinding, options: DiscoveryOptions): RawCodeStructure[];
|
|
845
852
|
|
|
846
|
-
/**
|
|
847
|
-
* Ask what these calls come down to, then derive. Asking about every call in
|
|
848
|
-
* a project costs seconds on a large one and answers questions nobody has,
|
|
849
|
-
* so a caller names the handful it needs.
|
|
850
|
-
*/
|
|
853
|
+
/** Ask what these calls come down to, then derive. */
|
|
851
854
|
declare function resolveCalls(db: Database, callKeys: readonly string[]): void;
|
|
852
855
|
/**
|
|
853
856
|
* The values an object contains under its own keys, in the order the source
|
|
@@ -857,6 +860,19 @@ declare function containedValues(db: Database, objectKey: string): string[];
|
|
|
857
860
|
/** What a call comes down to, when the rules settled it on an object. */
|
|
858
861
|
declare function objectReturnedBy(db: Database, callKey: string): string | null;
|
|
859
862
|
|
|
863
|
+
/**
|
|
864
|
+
* values.ts: the facts @suss/resolution already joins, emitted for Python.
|
|
865
|
+
* The relation names and shapes come from that package's own header, so a
|
|
866
|
+
* Python value follows the same rules a TypeScript one does.
|
|
867
|
+
*
|
|
868
|
+
* A name is keyed by the scope that binds it. A function's own names take
|
|
869
|
+
* the function's key, so two handlers that both write `query` stay apart,
|
|
870
|
+
* and a module's names take the file's key, which is what another file
|
|
871
|
+
* imports back out. Every write to a name in one scope is collected in
|
|
872
|
+
* source order and `valueLeftByWrites` says what the name comes down to,
|
|
873
|
+
* so a reassigned name states one value or none rather than two.
|
|
874
|
+
*/
|
|
875
|
+
|
|
860
876
|
/**
|
|
861
877
|
* A node's identity across the whole run. The end is part of it because a
|
|
862
878
|
* call and its callee start at the same offset.
|
|
@@ -868,6 +884,11 @@ declare function nodeId(filePath: string, node: Node): string;
|
|
|
868
884
|
* the function the expression is written in, or null at module level.
|
|
869
885
|
*/
|
|
870
886
|
declare function readKey(filePath: string, node: Node, enclosing: Node | null): string;
|
|
887
|
+
/**
|
|
888
|
+
* The key a name joins on, for a caller holding the name as text and the
|
|
889
|
+
* function it is written in.
|
|
890
|
+
*/
|
|
891
|
+
declare function nameKeyIn(filePath: string, enclosing: Node | null, name: string): string;
|
|
871
892
|
/**
|
|
872
893
|
* Walk a module and emit the value facts. A nested function is walked in its
|
|
873
894
|
* own right, so a body's returns and calls belong to the function that wrote
|
|
@@ -1021,4 +1042,4 @@ declare function pythonImportEvidence(options: PythonImportEvidenceOptions): Pro
|
|
|
1021
1042
|
*/
|
|
1022
1043
|
declare const ADAPTER_VERSION = "0.1.0";
|
|
1023
1044
|
|
|
1024
|
-
export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyStatusCall, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
|
|
1045
|
+
export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyStatusCall, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nameKeyIn, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -717,12 +717,15 @@ interface StorageLookup {
|
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
/**
|
|
720
|
-
* What a call's callee is
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
720
|
+
* What a call's callee is: a function in this run the walk can step
|
|
721
|
+
* into, or a reason it cannot.
|
|
722
|
+
*
|
|
723
|
+
* The rules in @suss/resolution decide it. Every language feature that
|
|
724
|
+
* moves a value is a hop they already state, so nothing here reads a
|
|
725
|
+
* name, an alias, an attribute, or an instance for itself.
|
|
726
|
+
*
|
|
727
|
+
* What is left is about files rather than values: a module before the
|
|
728
|
+
* dot, and a name only a wildcard import could have brought in.
|
|
726
729
|
*/
|
|
727
730
|
|
|
728
731
|
/** A function in this run, and the export path its summary gets. */
|
|
@@ -754,6 +757,8 @@ interface WrapperIndexOptions {
|
|
|
754
757
|
packs: readonly PythonPack[];
|
|
755
758
|
roots: string[];
|
|
756
759
|
facts: Database | undefined;
|
|
760
|
+
/** The function each function key was read from. */
|
|
761
|
+
definitions: ReadonlyMap<string, Node>;
|
|
757
762
|
storageFor: (file: BoundPythonFile) => StorageLookup | undefined;
|
|
758
763
|
}
|
|
759
764
|
/** The route asking which wrappers reach it: the decorator it was found by, and where that decorator was read. */
|
|
@@ -787,6 +792,8 @@ declare class PythonWrapperIndex {
|
|
|
787
792
|
private readonly unitsByKey;
|
|
788
793
|
private readonly unitsByFile;
|
|
789
794
|
constructor(options: WrapperIndexOptions, filesByPath: ReadonlyMap<string, BoundPythonFile>);
|
|
795
|
+
/** The project function a module-level name in this file refers to, or null for anything else. */
|
|
796
|
+
functionCalled(file: string, name: string): ReachedFunction | null;
|
|
790
797
|
register(covers: {
|
|
791
798
|
kind: "everyRoute";
|
|
792
799
|
pack: string;
|
|
@@ -843,11 +850,7 @@ interface DiscoveryOptions {
|
|
|
843
850
|
}
|
|
844
851
|
declare function discoverUnits(root: Node, module: ModuleBinding, options: DiscoveryOptions): RawCodeStructure[];
|
|
845
852
|
|
|
846
|
-
/**
|
|
847
|
-
* Ask what these calls come down to, then derive. Asking about every call in
|
|
848
|
-
* a project costs seconds on a large one and answers questions nobody has,
|
|
849
|
-
* so a caller names the handful it needs.
|
|
850
|
-
*/
|
|
853
|
+
/** Ask what these calls come down to, then derive. */
|
|
851
854
|
declare function resolveCalls(db: Database, callKeys: readonly string[]): void;
|
|
852
855
|
/**
|
|
853
856
|
* The values an object contains under its own keys, in the order the source
|
|
@@ -857,6 +860,19 @@ declare function containedValues(db: Database, objectKey: string): string[];
|
|
|
857
860
|
/** What a call comes down to, when the rules settled it on an object. */
|
|
858
861
|
declare function objectReturnedBy(db: Database, callKey: string): string | null;
|
|
859
862
|
|
|
863
|
+
/**
|
|
864
|
+
* values.ts: the facts @suss/resolution already joins, emitted for Python.
|
|
865
|
+
* The relation names and shapes come from that package's own header, so a
|
|
866
|
+
* Python value follows the same rules a TypeScript one does.
|
|
867
|
+
*
|
|
868
|
+
* A name is keyed by the scope that binds it. A function's own names take
|
|
869
|
+
* the function's key, so two handlers that both write `query` stay apart,
|
|
870
|
+
* and a module's names take the file's key, which is what another file
|
|
871
|
+
* imports back out. Every write to a name in one scope is collected in
|
|
872
|
+
* source order and `valueLeftByWrites` says what the name comes down to,
|
|
873
|
+
* so a reassigned name states one value or none rather than two.
|
|
874
|
+
*/
|
|
875
|
+
|
|
860
876
|
/**
|
|
861
877
|
* A node's identity across the whole run. The end is part of it because a
|
|
862
878
|
* call and its callee start at the same offset.
|
|
@@ -868,6 +884,11 @@ declare function nodeId(filePath: string, node: Node): string;
|
|
|
868
884
|
* the function the expression is written in, or null at module level.
|
|
869
885
|
*/
|
|
870
886
|
declare function readKey(filePath: string, node: Node, enclosing: Node | null): string;
|
|
887
|
+
/**
|
|
888
|
+
* The key a name joins on, for a caller holding the name as text and the
|
|
889
|
+
* function it is written in.
|
|
890
|
+
*/
|
|
891
|
+
declare function nameKeyIn(filePath: string, enclosing: Node | null, name: string): string;
|
|
871
892
|
/**
|
|
872
893
|
* Walk a module and emit the value facts. A nested function is walked in its
|
|
873
894
|
* own right, so a body's returns and calls belong to the function that wrote
|
|
@@ -1021,4 +1042,4 @@ declare function pythonImportEvidence(options: PythonImportEvidenceOptions): Pro
|
|
|
1021
1042
|
*/
|
|
1022
1043
|
declare const ADAPTER_VERSION = "0.1.0";
|
|
1023
1044
|
|
|
1024
|
-
export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyStatusCall, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
|
|
1045
|
+
export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyStatusCall, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nameKeyIn, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
|