Files
Viper_VSCode/architecture/generated/subsystems/analyzer.md
TermiNexus e9e4693333
Some checks failed
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
初始化上传
2026-07-24 17:08:39 +08:00

39 KiB

Subsystem: analyzer

Source files under analyzer/. Grouped by the functional area each file was assigned to during semantic lifting.

  • Files: 82
  • Symbols (leaves): 1776

Constraint Solving and Type Variables

Diagnostics and Configuration

Documentation and Comments

Flow Narrowing and Type Guards

  • analyzer/codeFlowEngine.ts — Determines narrowed types for variables and expressions and computes statement reachability via the code flow graph
  • analyzer/codeFlowTypes.ts — Types and helpers for tracking code-flow nodes and reference keys used in Pyright's code flow analysis
  • analyzer/codeFlowUtils.ts — Generates an ASCII diagram of a control flow graph from FlowNode structures
  • analyzer/patternMatching.ts — Type evaluation and narrowing utilities for Python structural pattern matching (PEP 634) in Pyright
  • analyzer/staticExpressions.ts — Evaluates parse-node expressions to determine static boolean, version, and platform string outcomes
  • analyzer/typeGuards.ts — Narrow types based on conditional expressions, isinstance checks, and user-defined type guards

Import Resolution and Packaging

Parser, Binder, and Symbols

  • analyzer/analyzerNodeInfo.ts — Stores and manages analysis metadata (scopes, declarations, control-flow, imports, and all) for parse nodes
  • analyzer/binder.ts — Performs Python parse-tree name binding and creates scopes and symbol tables for static analysis
  • analyzer/declaration.ts — Describes declaration kinds and interfaces that record symbol locations, nodes, and import/alias resolution metadata
  • analyzer/declarationUtils.ts — Utilities for inspecting, comparing, and resolving declarations and alias references in the analyzer
  • analyzer/parseTreeCleaner.ts — Walks a Module parse tree and clears analyzer-specific analysis info from each parse node
  • analyzer/parseTreeUtils.ts — Utilities for traversing, querying, and printing Python parse tree nodes and their evaluation ranges
  • analyzer/parseTreeWalker.ts — Traverses a Python parse tree and provides visitor/walker classes to visit and process parse nodes
  • analyzer/scope.ts — Models evaluation scopes and provides symbol table, binding info, and recursive lookup for Python analysis
  • analyzer/scopeUtils.ts — Utilities for locating and inspecting analysis scopes and scope hierarchies for parse tree nodes
  • analyzer/symbol.ts — Represents program symbols, tracking their flags, declarations, and synthesized type information
  • analyzer/symbolNameUtils.ts — Classify Python symbol names (private, protected, dunder, constant, type alias, public constant/type alias)
  • analyzer/symbolUtils.ts — Helpers for Symbol declaration queries, visibility checks, TypedDict index access, and class-var/final semantics
  • analyzer/testWalker.ts — Validates parse-tree node parent/range invariants and evaluates NameNode types using a TypeEvaluator

Program Analysis and Scheduling

  • analyzer/analysis.ts — Exports types and analyzeProgram to run a Program analysis, gather diagnostics, and invoke a completion callback
  • analyzer/analyzerFileInfo.ts — Provides interfaces and utilities for storing per-source-file analysis metadata and import lookup in the analyzer
  • analyzer/backgroundAnalysisProgram.ts — Manages a Program with optional background analysis, syncing config, imports, file state and diagnostics
  • analyzer/cacheManager.ts — Tracks cache owners and heap usage to trigger cache eviction when memory usage approaches the heap limit
  • analyzer/cellChainIndex.ts — Provides a lazily-built index mapping notebook CellDocs cells to their chain tails for fast later-cell lookups
  • analyzer/circularDependency.ts — Represents circular import chains as ordered lists of file URIs, normalizing start and comparing equality
  • analyzer/parentDirectoryCache.ts — Cache for storing parent-directory import lookup results to avoid repeated folder searches
  • analyzer/program.ts — Tracks and manages the project's source files, imports, and analysis state for Pyright's type checker
  • analyzer/programTypes.ts — Defines ISourceFileFactory interface and a type guard for creating SourceFile instances
  • analyzer/service.ts — Analyzes Python files and manages background analysis, programs, configuration, and import resolution
  • analyzer/serviceUtils.ts — Helpers to locate pyproject.toml and project config files starting from a given Uri
  • analyzer/sourceFile.ts — Represents a single Python source or stub file and manages its parsing, analysis, and diagnostics
  • analyzer/sourceFileInfo.ts — Holds per-file metadata and mutable program relations like imports, diagnostics, and edit-mode snapshots
  • analyzer/sourceFileInfoUtils.ts — Utilities for SourceFileInfo: import/chain relationships, cycle checks, and parsing open IPython notebook cells

Shared Runtime Infrastructure

  • analyzer/sentinel.ts — Produces a PEP 661 Sentinel class instance type for sentinel declarations during type evaluation
  • analyzer/tracePrinter.ts — Converts AST nodes, declarations, symbols, and types into concise string representations

Type Evaluation

  • analyzer/checker.ts — Performs static type checking and traverses parse trees to validate and report diagnostics for a source file
  • analyzer/constructorTransform.ts — Transforms objects created by constructors for special-case behaviors like functools.partial and TypedDicts
  • analyzer/constructors.ts — Evaluates Python constructor and metaclass calls, validating new/init arguments and inferring resulting instance types
  • analyzer/dataClasses.ts — Handles special-case analysis and synthesis for Python dataclasses and dataclass_transform behaviors
  • analyzer/decorators.ts — Evaluates and applies function/class decorators, adjusting types, flags, overloads, properties, and dataclass behavior
  • analyzer/enums.ts — Provides type analysis and special-case handling for Python Enum classes and enum members
  • analyzer/functionTransform.ts — Adds missing comparison methods to classes decorated with functools.total_ordering
  • analyzer/namedTuples.ts — Constructs and manages Python namedtuple class types with named fields and optional type annotations
  • analyzer/operations.ts — Evaluates types and validates semantics for unary, binary, augmented assignment, and ternary Python operators
  • analyzer/parameterUtils.ts — Utilities for analyzing and handling function parameters, param lists, and related parameter typing in the analyzer
  • analyzer/properties.ts — Evaluates and constructs Python property types and manages getter/setter/deleter method typing and symbol table entries
  • analyzer/protocols.ts — Provides type evaluation logic for protocol (structural subtyping) classes
  • analyzer/tuples.ts — Tuple type analysis utilities: construct, infer, slice, expand, and assign tuple types for the type evaluator
  • analyzer/typeCacheUtils.ts — Tracks speculative type contexts and caches speculative type results for nodes during speculative analysis
  • analyzer/typeComplexity.ts — Computes a complexity score for types to rank candidate types during constraint solving
  • analyzer/typeDocStringUtils.ts — Retrieves and resolves docstrings for modules, classes, functions, variables, and properties including inherited stubs
  • analyzer/typeEvaluator.ts — Evaluates types of parse tree nodes within a Python program
  • analyzer/typeEvaluatorTypes.ts — Type evaluator interfaces, helper types, constants, and utilities for Pyright's analyzer
  • analyzer/typeEvaluatorWithTracker.ts — Wraps the type evaluator with logging and timing to track performance of type evaluation entry points
  • analyzer/typePrinter.ts — Produces human-readable string representations of Pyright type objects for diagnostics and display
  • analyzer/typePrinterUtils.ts — Formats and escapes string and bytes literals for the type printer
  • analyzer/typeUtils.ts — Utilities and transformers for analyzing and manipulating Type objects used by the type checker
  • analyzer/typeWalker.ts — Walks components of a Type graph to visit contained types while preventing infinite recursion
  • analyzer/typedDicts.ts — Provides TypedDict type creation, member resolution, assignment and helper utilities for the analyzer
  • analyzer/types.ts — Represents and manipulates Python type abstractions used by the Pyright analyzer

Cross-subsystem dependencies

Imported by (external):

Imports (external):