|
9 | 9 | from contextlib import contextmanager |
10 | 10 | from functools import cached_property |
11 | 11 | from pathlib import Path |
12 | | -from typing import TYPE_CHECKING, Generic, Literal, TypeVar, Unpack, overload |
| 12 | +from typing import Generic, Literal, Unpack, overload |
13 | 13 |
|
14 | 14 | import plotly.graph_objects as go |
15 | 15 | import rich.repr |
|
19 | 19 | from github.PullRequest import PullRequest |
20 | 20 | from networkx import Graph |
21 | 21 | from rich.console import Console |
22 | | -from typing_extensions import deprecated |
| 22 | +from typing_extensions import TypeVar, deprecated |
23 | 23 |
|
24 | 24 | from codegen.git.repo_operator.local_repo_operator import LocalRepoOperator |
25 | 25 | from codegen.git.repo_operator.remote_repo_operator import RemoteRepoOperator |
|
44 | 44 | from codegen.sdk.core.detached_symbols.code_block import CodeBlock |
45 | 45 | from codegen.sdk.core.detached_symbols.parameter import Parameter |
46 | 46 | from codegen.sdk.core.directory import Directory |
| 47 | +from codegen.sdk.core.export import Export |
47 | 48 | from codegen.sdk.core.external_module import ExternalModule |
48 | 49 | from codegen.sdk.core.file import File, SourceFile |
49 | 50 | from codegen.sdk.core.function import Function |
|
84 | 85 | from codegen.shared.performance.stopwatch_utils import stopwatch |
85 | 86 | from codegen.visualizations.visualization_manager import VisualizationManager |
86 | 87 |
|
87 | | -if TYPE_CHECKING: |
88 | | - from codegen.sdk.core.export import Export |
89 | | - |
90 | 88 | logger = logging.getLogger(__name__) |
91 | 89 | MAX_LINES = 10000 # Maximum number of lines of text allowed to be logged |
92 | 90 |
|
93 | 91 |
|
94 | | -TSourceFile = TypeVar("TSourceFile", bound="SourceFile") |
95 | | -TDirectory = TypeVar("TDirectory", bound="Directory") |
96 | | -TSymbol = TypeVar("TSymbol", bound="Symbol") |
97 | | -TClass = TypeVar("TClass", bound="Class") |
98 | | -TFunction = TypeVar("TFunction", bound="Function") |
99 | | -TImport = TypeVar("TImport", bound="Import") |
100 | | -TGlobalVar = TypeVar("TGlobalVar", bound="Assignment") |
101 | | -TInterface = TypeVar("TInterface", bound="Interface") |
102 | | -TTypeAlias = TypeVar("TTypeAlias", bound="TypeAlias") |
103 | | -TParameter = TypeVar("TParameter", bound="Parameter") |
104 | | -TCodeBlock = TypeVar("TCodeBlock", bound="CodeBlock") |
105 | | -TExport = TypeVar("TExport", bound="Export") |
106 | | -TSGlobalVar = TypeVar("TSGlobalVar", bound="Assignment") |
107 | | -PyGlobalVar = TypeVar("PyGlobalVar", bound="Assignment") |
| 92 | +TSourceFile = TypeVar("TSourceFile", bound="SourceFile", default=SourceFile) |
| 93 | +TDirectory = TypeVar("TDirectory", bound="Directory", default=Directory) |
| 94 | +TSymbol = TypeVar("TSymbol", bound="Symbol", default=Symbol) |
| 95 | +TClass = TypeVar("TClass", bound="Class", default=Class) |
| 96 | +TFunction = TypeVar("TFunction", bound="Function", default=Function) |
| 97 | +TImport = TypeVar("TImport", bound="Import", default=Import) |
| 98 | +TGlobalVar = TypeVar("TGlobalVar", bound="Assignment", default=Assignment) |
| 99 | +TInterface = TypeVar("TInterface", bound="Interface", default=Interface) |
| 100 | +TTypeAlias = TypeVar("TTypeAlias", bound="TypeAlias", default=TypeAlias) |
| 101 | +TParameter = TypeVar("TParameter", bound="Parameter", default=Parameter) |
| 102 | +TCodeBlock = TypeVar("TCodeBlock", bound="CodeBlock", default=CodeBlock) |
| 103 | +TExport = TypeVar("TExport", bound="Export", default=Export) |
| 104 | +TSGlobalVar = TypeVar("TSGlobalVar", bound="Assignment", default=Assignment) |
| 105 | +PyGlobalVar = TypeVar("PyGlobalVar", bound="Assignment", default=Assignment) |
108 | 106 | TSDirectory = Directory[TSFile, TSSymbol, TSImportStatement, TSGlobalVar, TSClass, TSFunction, TSImport] |
109 | 107 | PyDirectory = Directory[PyFile, PySymbol, PyImportStatement, PyGlobalVar, PyClass, PyFunction, PyImport] |
110 | 108 |
|
|
0 commit comments