From 9c4bff7f5b754b6c7ec94ed8e73e65413dffe7d0 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Fri, 24 Jan 2025 13:21:15 -0800 Subject: [PATCH 1/2] update type hint --- src/codegen/sdk/core/codebase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/codegen/sdk/core/codebase.py b/src/codegen/sdk/core/codebase.py index 7805fa36f..539864e41 100644 --- a/src/codegen/sdk/core/codebase.py +++ b/src/codegen/sdk/core/codebase.py @@ -20,6 +20,7 @@ from typing_extensions import deprecated from codegen.git.repo_operator.local_repo_operator import LocalRepoOperator +from codegen.git.repo_operator.remote_repo_operator import RemoteRepoOperator from codegen.git.repo_operator.repo_operator import RepoOperator from codegen.git.schemas.enums import CheckoutResult from codegen.git.schemas.repo_config import BaseRepoConfig @@ -99,7 +100,7 @@ class Codebase(Generic[TSourceFile, TDirectory, TSymbol, TClass, TFunction, TImp 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. """ - _op: RepoOperator + _op: RepoOperator | RemoteRepoOperator viz: VisualizationManager repo_path: Path console: Console From b20786d348a7c22c5d6f1f1ed8a10c73b6895a98 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Fri, 24 Jan 2025 13:34:40 -0800 Subject: [PATCH 2/2] fix basic test --- .../test_ast/test_ast_basic/ast.json | 650 +++++++++--------- 1 file changed, 325 insertions(+), 325 deletions(-) diff --git a/tests/unit/codegen/sdk/output/snapshots/test_ast/test_ast_basic/ast.json b/tests/unit/codegen/sdk/output/snapshots/test_ast/test_ast_basic/ast.json index 27e102535..1d7784baf 100644 --- a/tests/unit/codegen/sdk/output/snapshots/test_ast/test_ast_basic/ast.json +++ b/tests/unit/codegen/sdk/output/snapshots/test_ast/test_ast_basic/ast.json @@ -1,327 +1,327 @@ { - "codegen_sdk_type": "PyClass", - "span": { - "range": { - "start_byte": 1, - "end_byte": 48, - "start_point": { - "row": 1, - "column": 0 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "class_definition", - "children": [ - [ - "get_name()", - { - "codegen_sdk_type": "Name", - "span": { - "range": { - "start_byte": 7, - "end_byte": 10, - "start_point": { - "row": 1, - "column": 6 - }, - "end_point": { - "row": 1, - "column": 9 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "identifier", - "children": [] - } - ], - [ - "methods", - { - "codegen_sdk_type": "PyCodeBlock", - "span": { - "range": { - "start_byte": 16, - "end_byte": 48, - "start_point": { - "row": 2, - "column": 4 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "block", - "children": [ - [ - "statements", - { - "codegen_sdk_type": "MultiLineCollection", - "span": { - "range": { - "start_byte": 16, - "end_byte": 48, - "start_point": { - "row": 2, - "column": 4 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "block", - "children": [ - [ - null, - { - "codegen_sdk_type": "SymbolStatement", - "span": { - "range": { - "start_byte": 16, - "end_byte": 48, - "start_point": { - "row": 2, - "column": 4 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "function_definition", - "children": [ - [ - null, - { - "codegen_sdk_type": "Name", - "span": { - "range": { - "start_byte": 20, - "end_byte": 23, - "start_point": { - "row": 2, - "column": 8 - }, - "end_point": { - "row": 2, - "column": 11 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "identifier", - "children": [] - } - ], - [ - null, - { - "codegen_sdk_type": "Collection", - "span": { - "range": { - "start_byte": 23, - "end_byte": 28, - "start_point": { - "row": 2, - "column": 11 - }, - "end_point": { - "row": 2, - "column": 16 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "parameters", - "children": [ - [ - null, - { - "codegen_sdk_type": "PyParameter", - "span": { - "range": { - "start_byte": 24, - "end_byte": 27, - "start_point": { - "row": 2, - "column": 12 - }, - "end_point": { - "row": 2, - "column": 15 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "identifier", - "children": [] - } - ] - ] - } - ], - [ - null, - { - "codegen_sdk_type": "PyCodeBlock", - "span": { - "range": { - "start_byte": 38, - "end_byte": 48, - "start_point": { - "row": 3, - "column": 8 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "block", - "children": [ - [ - "statements", - { - "codegen_sdk_type": "MultiLineCollection", - "span": { - "range": { - "start_byte": 38, - "end_byte": 48, - "start_point": { - "row": 3, - "column": 8 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "block", - "children": [ - [ - null, - { - "codegen_sdk_type": "ReturnStatement", - "span": { - "range": { - "start_byte": 38, - "end_byte": 48, - "start_point": { - "row": 3, - "column": 8 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "return_statement", - "children": [ - [ - "value", - { - "codegen_sdk_type": "Name", - "span": { - "range": { - "start_byte": 45, - "end_byte": 48, - "start_point": { - "row": 3, - "column": 15 - }, - "end_point": { - "row": 3, - "column": 18 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "identifier", - "children": [] - } - ] - ] - } - ] - ] - } - ] - ] - } - ] - ] - } - ] - ] - } - ] - ] - } - ], - [ - null, - { - "codegen_sdk_type": "Name", - "span": { - "range": { - "start_byte": 20, - "end_byte": 23, - "start_point": { - "row": 2, - "column": 8 - }, - "end_point": { - "row": 2, - "column": 11 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "identifier", - "children": [] - } - ], - [ - null, - { - "codegen_sdk_type": "Name", - "span": { - "range": { - "start_byte": 24, - "end_byte": 27, - "start_point": { - "row": 2, - "column": 12 - }, - "end_point": { - "row": 2, - "column": 15 - } - }, - "filepath": "test.py" - }, - "tree_sitter_type": "identifier", - "children": [] - } - ] - ] + "codegen_sdk_type": "PyClass", + "span": { + "range": { + "start_byte": 1, + "end_byte": 48, + "start_point": { + "row": 1, + "column": 0 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "class_definition", + "children": [ + [ + "get_name()", + { + "codegen_sdk_type": "Name", + "span": { + "range": { + "start_byte": 7, + "end_byte": 10, + "start_point": { + "row": 1, + "column": 6 + }, + "end_point": { + "row": 1, + "column": 9 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "identifier", + "children": [] + } + ], + [ + "methods", + { + "codegen_sdk_type": "PyCodeBlock", + "span": { + "range": { + "start_byte": 16, + "end_byte": 48, + "start_point": { + "row": 2, + "column": 4 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "block", + "children": [ + [ + "statements", + { + "codegen_sdk_type": "MultiLineCollection", + "span": { + "range": { + "start_byte": 16, + "end_byte": 48, + "start_point": { + "row": 2, + "column": 4 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "block", + "children": [ + [ + null, + { + "codegen_sdk_type": "SymbolStatement", + "span": { + "range": { + "start_byte": 16, + "end_byte": 48, + "start_point": { + "row": 2, + "column": 4 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "function_definition", + "children": [ + [ + null, + { + "codegen_sdk_type": "Name", + "span": { + "range": { + "start_byte": 20, + "end_byte": 23, + "start_point": { + "row": 2, + "column": 8 + }, + "end_point": { + "row": 2, + "column": 11 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "identifier", + "children": [] + } + ], + [ + null, + { + "codegen_sdk_type": "Collection", + "span": { + "range": { + "start_byte": 23, + "end_byte": 28, + "start_point": { + "row": 2, + "column": 11 + }, + "end_point": { + "row": 2, + "column": 16 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "parameters", + "children": [ + [ + null, + { + "codegen_sdk_type": "PyParameter", + "span": { + "range": { + "start_byte": 24, + "end_byte": 27, + "start_point": { + "row": 2, + "column": 12 + }, + "end_point": { + "row": 2, + "column": 15 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "identifier", + "children": [] + } + ] + ] + } + ], + [ + null, + { + "codegen_sdk_type": "PyCodeBlock", + "span": { + "range": { + "start_byte": 38, + "end_byte": 48, + "start_point": { + "row": 3, + "column": 8 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "block", + "children": [ + [ + "statements", + { + "codegen_sdk_type": "MultiLineCollection", + "span": { + "range": { + "start_byte": 38, + "end_byte": 48, + "start_point": { + "row": 3, + "column": 8 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "block", + "children": [ + [ + null, + { + "codegen_sdk_type": "ReturnStatement", + "span": { + "range": { + "start_byte": 38, + "end_byte": 48, + "start_point": { + "row": 3, + "column": 8 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "return_statement", + "children": [ + [ + "value", + { + "codegen_sdk_type": "Name", + "span": { + "range": { + "start_byte": 45, + "end_byte": 48, + "start_point": { + "row": 3, + "column": 15 + }, + "end_point": { + "row": 3, + "column": 18 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "identifier", + "children": [] + } + ] + ] + } + ] + ] + } + ] + ] + } + ] + ] + } + ] + ] + } + ] + ] + } + ], + [ + null, + { + "codegen_sdk_type": "Name", + "span": { + "range": { + "start_byte": 20, + "end_byte": 23, + "start_point": { + "row": 2, + "column": 8 + }, + "end_point": { + "row": 2, + "column": 11 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "identifier", + "children": [] + } + ], + [ + null, + { + "codegen_sdk_type": "Name", + "span": { + "range": { + "start_byte": 24, + "end_byte": 27, + "start_point": { + "row": 2, + "column": 12 + }, + "end_point": { + "row": 2, + "column": 15 + } + }, + "filepath": "test.py" + }, + "tree_sitter_type": "identifier", + "children": [] + } + ] + ] }