# Codegen ## Docs - [Codegen](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/overview.md) - [Getting Started](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/getting-started.md) - [Installation](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/installation.md) - [Using Codegen in Your IDE](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/ide-usage.md) - [Working with AI](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/work-with-ai.md) - [Under the Hood](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/how-it-works.md) - [Guiding Principles](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/guiding-principles.md) - [Community & Contributing](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/community.md) - [Codegen, Inc.](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/about.md) - [Frequently Asked Questions](https://codegeninc-jay-docs-fixes-24.mintlify.site/introduction/faq.md) - [Learn by Example](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/at-a-glance.md) - [Migrating APIs](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/migrating-apis.md) - [Organizing Your Codebase](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/organize-your-codebase.md) - [Improving Code Modularity](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/modularity.md) - [Deleting Dead Code](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/deleting-dead-code.md) - [Increasing Type Coverage](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/increase-type-coverage.md) - [Mining Training Data for LLMs](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/training-data.md): Learn how to generate training data for large language models using Codegen - [Managing Feature Flags](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/manage-feature-flags.md) - [Managing TypeScript Exports](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/managing-typescript-exports.md): Safely and systematically manage exports in your TypeScript codebase - [Converting Default Exports](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/converting-default-exports.md): Convert default exports to named exports in your TypeScript codebase - [Creating Documentation](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/creating-documentation.md) - [React Modernization](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/react-modernization.md): Modernize your React codebase with Codegen - [Migrating from unittest to pytest](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/unittest-to-pytest.md): Learn how to migrate unittest test suites to pytest using Codegen - [Migrating from SQLAlchemy 1.6 to 2.0](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/sqlalchemy-1.6-to-2.0.md): Learn how to migrate SQLAlchemy 1.6 codebases to 2.0 using Codegen - [Migrating from Python 2 to Python 3](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/python2-to-python3.md): Learn how to migrate Python 2 codebases to Python 3 using Codegen - [Migrating from Flask to FastAPI](https://codegeninc-jay-docs-fixes-24.mintlify.site/tutorials/flask-to-fastapi.md) - [Building with Codegen](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/at-a-glance.md) - [Parsing Codebases](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/parsing-codebases.md) - [Reusable Codemods](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/reusable-codemods.md) - [The .codegen Directory](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/dot-codegen.md) - [Language Support](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/language-support.md) - [Commit and Reset](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/commit-and-reset.md) - [Git Operations](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/git-operations.md) - [Files and Directories](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/files-and-directories.md) - [The Editable API](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/the-editable-api.md) - [The Symbol API](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/symbol-api.md) - [The Class API](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/class-api.md) - [The Import API](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/imports.md) - [The Export API](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/exports.md) - [Inheritable Behaviors](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/inheritable-behaviors.md) - [Statements and Code Blocks](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/statements-and-code-blocks.md) - [Dependencies and Usages](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/dependencies-and-usages.md) - [Function Calls and Call Sites](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/function-calls-and-callsites.md) - [Variable Assignments](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/variable-assignments.md) - [Local Variables](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/local-variables.md) - [Comments and Docstrings](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/comments-and-docstrings.md) - [External Modules](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/external-modules.md) - [Working with Type Annotations](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/type-annotations.md) - [Moving Symbols](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/moving-symbols.md) - [Collections](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/collections.md) - [Traversing the Call Graph](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/traversing-the-call-graph.md) - [React and JSX](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/react-and-jsx.md) - [Codebase Visualization](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/codebase-visualization.md) - [Calling Out to LLMs](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/calling-out-to-llms.md) - [Reducing Conditions](https://codegeninc-jay-docs-fixes-24.mintlify.site/building-with-codegen/reducing-conditions.md) - [API Reference](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/index.md) - [Argument](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Argument.md): Represents an argument passed into a FunctionCall. - [Assignment](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Assignment.md): Represents an assignment for a single variable within an assignment statement. Attributes: left: The left side of the assignment right: The right side of the assignment Example: ```typescript var z var z = 5 ``` - [AssignmentStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/AssignmentStatement.md): A class that represents an assignment statement in a codebase, such as `x = 1`, `a, b = 1, 2`, `const {a: b} = myFunc(),`, etc. This includes potentially multiple Assignments via `statement.assignments`, which represent each assignment of a value to a variable within this statement. For example, ass… - [Attribute](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Attribute.md): Abstract representation of an attribute on a class definition. - [AwaitExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/AwaitExpression.md): An awaited expression, only found in asynchronous contexts, e.g. await(foo(bar)) - [BinaryExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/BinaryExpression.md): Represents binary expressions, e.g. all of +,-,*,/, as well as booleaneoperations (and, or) etc. - [BlockStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/BlockStatement.md): Statement which contains a block. - [Boolean](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Boolean.md): A boolean value eg. True, False - [Callable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Callable.md): Any symbol that can be invoked with arguments eg. Function, Class, Decorator, ExternalModule - [CatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/CatchStatement.md): Abstract representation catch clause. Attributes: code_block: The code block that may trigger an exception condition: The condition which triggers this clause - [ChainedAttribute](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ChainedAttribute.md): An attribute of an object. (IE a method on a class, a function from a module, etc) Examples: A.method() - [Class](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Class.md): Abstract representation of a Class definition. - [CodeBlock](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/CodeBlock.md): Container class for a list of code Statements that share an indentation level, e.g. a function body or class body. Enables various types of queries and operations on the code block. - [Codebase](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Codebase.md): This class provides the main entrypoint for most programs to analyzing and manipulating codebases. It provides a high-level interface to interact with the codebase graph, and provides methods to access and manipulate files, directories, symbols, and other entities in the codebase. - [Comment](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Comment.md): Abstract representation of comment statements. - [CommentGroup](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/CommentGroup.md): A group of comments that form a larger comment block. - [ComparisonExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ComparisonExpression.md): Any comparison expression in the code. Includes all set of `<`, `<=`, `>`, `>=`, `==`, `!=` etc. - [Decorator](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Decorator.md): Abstract representation of a Decorator. - [Dict](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Dict.md): Represents a dict (object) literal the source code. You can use standard Python operations to operate on this dict (i.e. `len`, `del`, `set`, `get`, etc) - [Directory](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Directory.md): Directory representation for codebase. GraphSitter abstraction of a file directory that can be used to look for files and symbols within a specific directory. - [Editable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Editable.md): An editable instance is an abstract text representation of any text in a file. The editable APIs enables text search and edit within the given Editable wrapper around any group of text in a file. - [Export](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Export.md): Represents a single symbol being exported. - [ExportStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ExportStatement.md): Abstract representation of a single export statement that appears in a file. One export statement can export multiple symbols from a single source. Attributes: exports: A list of the individual exports this statement represents - [Exportable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Exportable.md): An interface for any node object that can be exported eg. Class, class name, top-level functions, imports - [Expression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Expression.md): Represents an arbitrary Expression, such as List, Dict, Binary Expression, String. - [ExpressionGroup](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ExpressionGroup.md): Group of contiguous set of expressions. - [ExpressionStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ExpressionStatement.md): Abstract representation of any expression statements that resolves to an expression. In some languages without a statement delimiter, expression statement and the enclosed expression looks the same in text. For example, in Python: ```python x = 1 ``` The above code is an expression statement, but it… - [ExternalModule](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ExternalModule.md): Represents an external module, like `datetime`, that can be referenced. These are only added to the graph during import resolution and will not exist in a local file's subgraph. This is because we don't know what an import is referencing or resolves to until we see the full codebase. - [File](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/File.md): Represents a generic file. Could represent a source file or a non-code file such as a markdown file or image file. - [FlagKwargs](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/FlagKwargs.md): Kwargs for the flag_instance method of the Codebase class. Attributes: message: The message to be displayed in the diff preview or posted as a comment on the PR. message_type: Where the message will be sent (CODEGEN, GITHUB, SLACK) message_recipient: The recipient of the message. - [ForLoopStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ForLoopStatement.md): Abstract representation of the for loop. Attributes: code_block: The code block that is executed in each iteration of the loop - [Function](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Function.md): Abstract representation of a Function. Attributes: return_type: the return type annotation of the function - [FunctionCall](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/FunctionCall.md): Abstract representation of a function invocation, e.g. in Python: ``` def f(): g() # FunctionCall ``` - [GenericType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/GenericType.md): Abstract representation of the generic types of the programming language. - [HasBlock](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/HasBlock.md): An interface for any code object that has a block of code, e.g. a function, class, etc. - [HasName](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/HasName.md): An interface for any node object that has a name. - [HasValue](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/HasValue.md): An interface for any node object that has a value. - [IfBlockStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/IfBlockStatement.md): Abstract representation of the if/elif/else if/else statement block. For example, if there is a code block like: if condition1: block1 elif condition2: block2 else: block3 This class represents the entire block, including the conditions and nested code blocks. Attributes: condition: The condition ex… - [Import](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Import.md): Represents a single symbol being imported. For example, this is one `Import` in Python (and similar applies to Typescript, etc.): ``` from a.b import c ``` This is two separate `Import` in Python: ``` from a.b import c, d # one import for each `c` and `d` ``` Attributes: symbol_name: The name of th… - [ImportStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ImportStatement.md): Abstract representation of a single import statement that appears in a file. One import statement can import multiple symbols from a single source. Attributes: imports: A collection of the individual imports this statement represents - [Importable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Importable.md): An interface for any node object that can import (or reference) an exportable symbol eg. All nodes that are on the graph must inherit from here Class, function, imports, exports, etc. - [List](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/List.md): A list object. You can use standard operations to operate on this list (IE len, del, append, insert, etc) - [MessageType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/MessageType.md): Destination of the message Attributes: CODEGEN: Rendered in the diff preview GITHUB: Posted as a comment on the PR SLACK: Sent over slack - [MultiExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/MultiExpression.md): Represents an group of Expressions, such as List, Dict, Binary Expression, String. - [MultiLineCollection](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/MultiLineCollection.md): A list containing multi-line objects. Example: A list of function definitions, class definitions You can use standard operations to operate on this list (IE len, del, append, insert, etc) - [Name](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Name.md): Editable attribute on any given code objects that has a name. For example, function, classes, global variable, interfaces, attributes, parameters are all composed of a name. - [NamedType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/NamedType.md): An abstract representation of a named type. - [NoneType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/NoneType.md): Represents a None or Null object. - [Number](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Number.md): A number value. eg. 1, 2.0, 3.14 - [Pair](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Pair.md): An abstract representation of a key, value pair belonging to a `Dict` - [Parameter](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Parameter.md): Abstract representation of a parameter in a Function definition. - [ParenthesizedExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ParenthesizedExpression.md): An expression surrounded in a set of parenthesis. Example: ```typescript (5 + 5) ``` - [Placeholder](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Placeholder.md): A placeholder for a node that does not exist yet. Use bool checks (ie is node) to check if the node exists. You can call edit to replace the placeholder with a real node and it will automatically insert formatting. - [PlaceholderType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/PlaceholderType.md): Represents a type that has not been implemented yet. - [RaiseStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/RaiseStatement.md): Abstract representation of raise statements, e.g. in Python: ```python def f(x): raise ValueError() ``` - [ReturnStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/ReturnStatement.md): Abstract representation of return statements, e.g. in Python: ```python def f(x): if x: return x**2 # ReturnStatement else: return 1 # ReturnStatement ``` - [SourceFile](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/SourceFile.md): Represents a file with source code in the codebase. Enables creating, reading, updating, and deleting files and searching through their contents, etc. - [Span](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Span.md): Range within the codebase - [Statement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Statement.md): Represents a single code statement, e.g. a function definition, an assignment, an if/else statement, etc. - [StatementType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/StatementType.md): Enum representing the different types of statements that can be parsed. - [String](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/String.md): GraphSitter representation of String. Attributes: content: The content of the string expressions: embedded expressions in the string, only applicable for templated or formatted strings - [StubPlaceholder](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/StubPlaceholder.md): A placeholder for a stub that does not exist. Can be populated using the `edit` method. - [SubscriptExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/SubscriptExpression.md): Indexing onto an object (Aka using brackets on an object) Examples: A[] - [SwitchCase](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/SwitchCase.md): Abstract representation for a switch case. Attributes: code_block: The code block that is executed if the condition is met condition: The condition which triggers this case - [SwitchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/SwitchStatement.md): Abstract representation of the switch statement. Attributes: value: The value to switch on - [Symbol](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Symbol.md): Abstract representation of a Symbol in a Codebase. A Symbol is a top-level entity in a file, e.g. a Function, Class, GlobalVariable, etc. - [SymbolGroup](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/SymbolGroup.md): These are groups of symbols that form some kind of logical grouping, like a class or module, that do not follow the traditional tree structure. - [SymbolStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/SymbolStatement.md): A statement that represents a symbol definition in a codeblock. Examples include: - a function definition, class definition, global variable assignment - [TernaryExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/TernaryExpression.md): Any ternary expression in the code where a condition will determine branched execution. - [TryCatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/TryCatchStatement.md): Abstract representation of the try catch statement block. Attributes: code_block: The code block that may trigger an exception finalizer: The code block executed regardless of if an exception is thrown or not - [Tuple](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Tuple.md): A tuple object. You can use standard operations to operate on this list (IE len, del, append, insert, etc) - [TupleType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/TupleType.md): An abstract representation of a tuple type. For example `[number, number]`. - [Type](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Type.md): Abstract representation of a type Used to store the types of variables, parameters, or return values in functions, classes, etc. - [TypeAlias](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/TypeAlias.md): Abstract representation of a Type object. Only applicable for some programming languages like TypeScript. - [TypePlaceholder](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/TypePlaceholder.md): A placeholder for a Type node that does not exist. Can be populated using the `edit` method. - [Typeable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Typeable.md): An interface for any node object that can be typed, eg. function parameters, variables, etc. Attributes: type: The type annotation associated with this node - [UnaryExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/UnaryExpression.md): Unary expression which is a single operation on a single operand. eg. -5, !true. Attributes: argument: The argument of the unary expression - [UnionType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/UnionType.md): An abstract representation of a union type. For example `str | None` or `string | number`. - [Unpack](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Unpack.md): Unpacking of an iterable. Example: ```python [a, *b] ``` - [Unwrappable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Unwrappable.md): An abstract representation of an expression that can be unwrapped. Expressions that can be unwrapped include binary expressions and ternary expressions. - [Usable](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Usable.md): An interface for any node object that can be referenced by another node. - [Usage](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Usage.md): A reference to an exportable object in a file. Attributes: match: The exact match of the usage usage_symbol: The symbol this object is used in usage_type: How this symbol was used kind: Where this symbol was used (IE: in a type parameter or in the body of the class, etc) - [UsageKind](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/UsageKind.md): SymbolUsageType is an enumeration class that defines different types of symbol usage within Python code. Attributes: SUBCLASS: Used in symbol inheritance. TYPE_ANNOTATION: Used as a type annotation on a parameter or assignment statement. BODY: Usage within the body of a function/method. DECORATOR:… - [UsageType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/UsageType.md): Describes how a symbol is used elsewhere. Used in conjunction with get_usages Attributes: DIRECT: Direct imports and usages within the same file CHAINED: Chained references (ie: module.foo) INDIRECT: Indirect usages with the same name ALIASED: Aliased indirect usages - [Value](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/Value.md): Editable attribute on code objects that has a value. For example, Functions, Classes, Assignments, Interfaces, Expressions, Arguments and Parameters all have values. See also HasValue. - [WhileStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/WhileStatement.md): Abstract representation of the while statement block. - [WithStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/core/WithStatement.md): Pythons implementation of the with statement. Examples: with feature_flag_enabled(...): # code block with open("file.txt") as file: # code block with (context_manager1 as var1, context_manager2 as var2, context_manager3 as var3): # code block Attributes: code_block: (PyCodeBlock) the code block of t… - [PyAssignment](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyAssignment.md): An abstract representation of a assignment in python. This includes assignments of variables to functions, other variables, class instantiations, etc. - [PyAssignmentStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyAssignmentStatement.md): A class that represents a Python assignment statement in a codebase, such as `x = 1` or `a, b = 1, 2`. This includes potentially multiple Assignments via `statement.assignments`, which represent each assignment of a value to a variable within this statement. For example, assigning to a list, or assi… - [PyAttribute](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyAttribute.md): Python implementation of Attribute detached symbol. - [PyBlockStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyBlockStatement.md): Statement which contains a block. - [PyBreakStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyBreakStatement.md): An abstract representation of a python break statement. - [PyCatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyCatchStatement.md): Python catch clause. Attributes: code_block: The code block that may trigger an exception condition: The condition which triggers this clause - [PyChainedAttribute](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyChainedAttribute.md): Abstract representation of a python chained attribute. This includes methods of python classes and module functions. - [PyClass](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyClass.md): Extends Class for Python codebases - [PyCodeBlock](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyCodeBlock.md): Extends CodeBlock for Python codebases. - [PyComment](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyComment.md): Abstract representation of python comments - [PyCommentGroup](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyCommentGroup.md): A group of related symbols that represent a comment or docstring in Python For example: ``` # Comment 1 # Comment 2 # Comment 3 ``` would be 3 individual comments (accessible via `symbols`), but together they form a `CommentGroup` (accessible via `self`). - [PyCommentType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyCommentType.md): Enum representing different types of comments. - [PyConditionalExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyConditionalExpression.md): Conditional Expressions (A if condition else B) - [PyDecorator](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyDecorator.md): Extends Decorators for Python codebases. - [PyFile](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyFile.md): SourceFile representation for Python codebase - [PyForLoopStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyForLoopStatement.md): Abstract representation of the for loop in Python Attributes: item: An item in the iterable object iterable: The iterable that is being iterated over - [PyFunction](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyFunction.md): Extends Function for Python codebases. - [PyGenericType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyGenericType.md): Generic python type. Examples: list[int] - [PyHasBlock](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyHasBlock.md): Extends HasBlock for Python codebases. - [PyIfBlockStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyIfBlockStatement.md): Pythons implementation of the if/elif/else statement block. For example, if there is a code block like: if condition1: block1 elif condition2: block2 else: block3 This class represents the entire block, including the conditions and nested code blocks. - [PyImport](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyImport.md): Extends Import for Python codebases. - [PyImportStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyImportStatement.md): An abstract representation of a python import statement. - [PyMatchCase](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyMatchCase.md): Python match case. - [PyMatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyMatchStatement.md): Abstract representation of the match block - [PyNamedType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyNamedType.md): Named python type Examples: int,str (builtin types) Path (classes) - [PyParameter](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyParameter.md): Extends Parameter for Python codebases. - [PyPassStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyPassStatement.md): An abstract representation of a python pass statement. - [PyReturnTypePlaceholder](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyReturnTypePlaceholder.md): A placeholder for a python return type that does not exist. Can be populated using the `edit` method. - [PyString](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyString.md): An abstract representation of a python string. - [PySymbol](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PySymbol.md): Extends `Symbol` for Python codebases. - [PyTryCatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyTryCatchStatement.md): Abstract representation of the try/catch/finally block in Python. Attributes: except_clauses: The exception handlers. - [PyUnionType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyUnionType.md): Union type Examples: str | int - [PyWhileStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/python/PyWhileStatement.md): An abstract representation of a python while statement. Attributes: else_statement (PyIfBlockStatement | None): the statement that will run if the while loop completes, if any. - [JSXElement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/JSXElement.md): Abstract representation of TSX/JSX elements, e.g. ``. This allows for many React-specific modifications, like adding props, changing the name, etc. - [JSXExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/JSXExpression.md): Abstract representation of TSX/JSX expression - [JSXProp](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/JSXProp.md): Abstract representation of TSX/JSX prop, e.g ``. - [TSArrayType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSArrayType.md): Array type Examples: string[] - [TSAssignment](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSAssignment.md): A class representing TypeScript assignments, including variable declarations and property assignments. Handles various types of TypeScript assignments including variable declarators, assignment expressions, augmented assignments, property signatures, and public field definitions. It provides functio… - [TSAssignmentStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSAssignmentStatement.md): A class that represents a TypeScript assignment statement in a codebase, such as `const x = 1` or `const { a: b } = myFunc()`. This includes potentially multiple Assignments via `statement.assignments`, which represent each assignment of a value to a variable within this statement. For example, assi… - [TSAttribute](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSAttribute.md): Typescript implementation of Attribute detached symbol. - [TSBlockStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSBlockStatement.md): Statement which contains a block. - [TSCatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSCatchStatement.md): Typescript catch clause. Attributes: code_block: The code block that may trigger an exception condition: The condition which triggers this clause - [TSChainedAttribute](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSChainedAttribute.md): A TypeScript chained attribute class representing member access expressions. This class handles the representation and analysis of chained attribute access expressions in TypeScript, such as 'object.property' or 'object.method()'. It provides functionality for accessing the object and property compo… - [TSClass](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSClass.md): A class representing a TypeScript/JavaScript class with enhanced functionality for class manipulation. The TSClass provides comprehensive functionality for working with TypeScript/JavaScript classes, including handling class methods, attributes, JSX components, and inheritance relationships. It supp… - [TSCodeBlock](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSCodeBlock.md): Extends the CodeBlock class to provide TypeScript-specific functionality. - [TSComment](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSComment.md): Abstract representation of typescript comments - [TSCommentGroup](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSCommentGroup.md): A group of related symbols that represent a comment or docstring in TypeScript For example: ``` // Comment 1 // Comment 2 // Comment 3 ``` would be 3 individual comments (accessible via `symbols`), but together they form a `CommentGroup` (accessible via `self). - [TSCommentType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSCommentType.md): An enumeration representing different types of comments in TypeScript. Represents the possible types of comments that can be used in TypeScript code, including double slash comments (//), slash star comments (/* */), and unknown comment types. Attributes: DOUBLE_SLASH (str): Represents a single-line… - [TSConditionalType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSConditionalType.md): Conditional Type Examples: typeof s - [TSConfig](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSConfig.md): TypeScript configuration file specified in tsconfig.json, used for import resolution and computing dependencies. - [TSDecorator](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSDecorator.md): Abstract representation of a Decorator - [TSDict](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSDict.md): A typescript dict object. You can use standard operations to operate on this dict (IE len, del, set, get, etc) - [TSEnum](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSEnum.md): Representation of an Enum in TypeScript - [TSExport](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSExport.md): Represents a single exported symbol. There is a 1:M relationship between an ExportStatement and an Export - [TSExpressionType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSExpressionType.md): Type defined by evaluation of an expression Attributes: expression: The expression to evaluate that yields the type - [TSFile](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSFile.md): Extends the SourceFile class to provide TypeScript-specific functionality. - [TSForLoopStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSForLoopStatement.md): Abstract representation of the for loop in TypeScript. Attributes: item: An item in the iterable object. Only applicable for `for...of` loops. iterable: The iterable that is being iterated over. Only applicable for `for...of` loops. initializer: The counter variable. Applicable for traditional for l… - [TSFunction](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSFunction.md): Representation of a Function in JavaScript/TypeScript - [TSFunctionType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSFunctionType.md): Function type definition. Attributes: return_type: Return type of the function. Examples: a: (a: number) => number - [TSGenericType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSGenericType.md): Generic type Examples: `Array` - [TSHasBlock](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSHasBlock.md): A TypeScript base class that provides block-level code organization and decorator handling capabilities. This class extends the concept of block scoping for TypeScript code elements like classes and functions. It provides functionality for managing code blocks, decorators, JSX elements, and document… - [TSIfBlockStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSIfBlockStatement.md): Typescript implementation of the if/elif/else statement block. For example, if there is a code block like: if (condition1) { block1 } else if (condition2) { block2 } else { block3 } This class represents the entire block, including the conditions and nested code blocks. - [TSImport](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSImport.md): Extends Import for TypeScript codebases. - [TSImportStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSImportStatement.md): A class representing an import statement in TypeScript, managing both static and dynamic imports. This class handles various types of TypeScript imports including regular import statements, dynamic imports, and export statements. It provides functionality to manage and track imports within a TypeScr… - [TSInterface](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSInterface.md): Representation of an Interface in TypeScript Attributes: parent_interfaces: All the interfaces that this interface extends. code_block: The code block that contains the interface's body. - [TSLabeledStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSLabeledStatement.md): Statement with a named label. It resolves to various types of statements like loops, switch cases, etc. Examples: ``` outerLoop: for (let i = 0; i < 5; i++) { innerLoop: for (let j = 0; j < 5; j++) { if (i === 2 && j === 2) { break outerLoop; // This will break out of the outer loop } console.log(`i… - [TSLookupType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSLookupType.md): Type lookup Examples: a["key"] - [TSNamedType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSNamedType.md): Named type Examples: string - [TSNamespace](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSNamespace.md): Representation of a namespace module in TypeScript - [TSObjectType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSObjectType.md): A class representing a TypeScript object type with type annotations and dependencies. A specialized class extending `TSDict` and implementing `Type` for handling TypeScript object type annotations. This class handles object type definitions including nested type structures and manages their dependen… - [TSPair](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSPair.md): A TypeScript pair node that represents key-value pairs in object literals. A specialized class extending `Pair` for handling TypeScript key-value pairs, particularly in object literals. It provides functionality for handling both regular key-value pairs and shorthand property identifiers, with suppo… - [TSParameter](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSParameter.md): A class representing a TypeScript function parameter with extensive type analysis capabilities. This class provides functionality to inspect and manipulate TypeScript function parameters, including support for destructured parameters, optional parameters, variadic parameters, default values, and typ… - [TSQueryType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSQueryType.md): Type query Examples: typeof s - [TSReadonlyType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSReadonlyType.md): Readonly type Examples: readonly s - [TSReturnTypePlaceholder](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSReturnTypePlaceholder.md): A placeholder class for function return type annotations in TypeScript. This class represents a placeholder for function return type annotations, allowing for modification and addition of return type annotations after the parameter list. It provides functionality to add or modify return type annotat… - [TSString](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSString.md): A TypeScript string node representing both literal strings and template strings. This class handles both regular string literals and template strings in TypeScript, providing functionality to parse and manage template string expressions. It extends the base String class with TypeScript-specific capa… - [TSSwitchCase](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSSwitchCase.md): Typescript switch case. Attributes: default: is this a default case? - [TSSwitchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSSwitchStatement.md): Typescript switch statement - [TSSymbol](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSSymbol.md): A TypeScript symbol representing a code element with advanced manipulation capabilities. This class extends Symbol and Exportable to provide TypeScript-specific functionality for managing code symbols. It offers methods for handling imports, comments, code refactoring, and file operations like movin… - [TSTernaryExpression](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSTernaryExpression.md): Any ternary expression in the code where a condition will determine branched execution - [TSTryCatchStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSTryCatchStatement.md): Abstract representation of the try/catch/finally block in TypeScript. Attributes: catch: The catch block. - [TSTypeAlias](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSTypeAlias.md): Representation of an Interface in TypeScript - [TSUndefinedType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSUndefinedType.md): Undefined type. Represents the undefined keyword Examples: undefined - [TSUnionType](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSUnionType.md): Union type Examples: string | number - [TSWhileStatement](https://codegeninc-jay-docs-fixes-24.mintlify.site/api-reference/typescript/TSWhileStatement.md): A TypeScript while statement class that represents while loops and manages their condition and code block. This class provides functionality for handling while statements in TypeScript code, including managing the loop's condition and associated code block. It extends the base WhileStatement class w… - [Codegen CLI](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/about.md) - [Init Command](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/init.md) - [Notebook Command](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/notebook.md): Open a Jupyter notebook with the current codebase loaded - [Create Command](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/create.md) - [Run Command](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/run.md) - [Reset Command](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/reset.md) - [Expert Command](https://codegeninc-jay-docs-fixes-24.mintlify.site/cli/expert.md) - [All Posts](https://codegeninc-jay-docs-fixes-24.mintlify.site/blog/posts.md) - [Act via Code](https://codegeninc-jay-docs-fixes-24.mintlify.site/blog/act-via-code.md): The path to fully-automated software engineering - [Codegen Updates](https://codegeninc-jay-docs-fixes-24.mintlify.site/changelog/changelog.md)