Skip to content

Commit 9f60333

Browse files
fix: improve code readability and fix type annotations
- Replace complex ternary with clear condition in _get_all_dependencies - Fix type annotations in Symbol class to remove invalid use of ... Co-Authored-By: [email protected] <[email protected]>
1 parent 0e964ef commit 9f60333

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/codegen/sdk/core/interfaces/importable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _get_all_dependencies(self, max_depth: Optional[int] = None) -> list[Union["
145145
current_depth = 1
146146

147147
def _collect_deps(symbol: Self, depth: int) -> None:
148-
if depth > max_depth if max_depth is not None else False:
148+
if max_depth is not None and depth > max_depth:
149149
return
150150

151151
direct_deps = symbol.get_dependencies(UsageType.DIRECT)

src/codegen/sdk/core/symbol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040

4141
@apidoc
42-
class Symbol(Usable[Statement["CodeBlock[Parent, ...]"]], Generic[Parent, TCodeBlock]):
42+
class Symbol(Usable[Statement["CodeBlock[Parent]"]], Generic[Parent, TCodeBlock]):
4343
"""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.
4444
4545
Attributes:
@@ -55,7 +55,7 @@ def __init__(
5555
ts_node: TSNode,
5656
file_id: NodeId,
5757
G: CodebaseGraph,
58-
parent: Statement[CodeBlock[Parent, ...]],
58+
parent: Statement[CodeBlock[Parent]],
5959
name_node: TSNode | None = None,
6060
name_node_type: type[Name] = DefinedName,
6161
) -> None:

0 commit comments

Comments
 (0)