Skip to content

Commit 3334afc

Browse files
committed
reformat
1 parent e990698 commit 3334afc

File tree

9 files changed

+12
-22
lines changed

9 files changed

+12
-22
lines changed

ruff.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,5 @@ extend-generics = [
216216
]
217217
[lint.isort]
218218
known-first-party = ["codegen"]
219+
[format]
220+
docstring-code-format = true

src/codegen/sdk/core/detached_symbols/function_call.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class FunctionCall(Expression[Parent], HasName, Resolvable, Generic[Parent]):
4242
"""Abstract representation of a function invocation, e.g. in Python:
4343
```
4444
def f():
45-
g() # FunctionCall
45+
g() # FunctionCall
4646
```
4747
"""
4848

src/codegen/sdk/core/file.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,8 @@ def get_node_by_name(self, name: str) -> Symbol | TImport | None:
812812
def valid_symbol_names(self) -> dict[str, Symbol | TImport | WildcardImport[TImport]]:
813813
"""Returns a dict mapping name => Symbol (or import) in this file."""
814814
valid_symbol_names = {}
815-
for s in self.symbols:
816-
valid_symbol_names[s.full_name] = s
817-
for imp in self.imports:
818-
for name, dest in imp.names:
819-
valid_symbol_names[name] = dest
815+
valid_symbol_names.update({s.full_name: s for s in self.symbols})
816+
valid_symbol_names.update({name: dest for imp in self.imports for name, dest in imp.names})
820817
return valid_symbol_names
821818

822819
@noapidoc

src/codegen/sdk/core/import_resolution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def is_dynamic(self) -> bool:
403403
def my_function():
404404
import foo # Dynamic - only imported when function runs
405405
406+
406407
if condition:
407408
from bar import baz # Dynamic - only imported if condition is True
408409

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,10 +1123,7 @@ def parent_class(self) -> Class | None:
11231123

11241124
def _get_ast_children(self) -> list[tuple[str | None, AST]]:
11251125
children = []
1126-
names = {}
1127-
for name, val in self._list_members(include_methods=True).items():
1128-
if isinstance(val, Editable):
1129-
names[val] = name
1126+
names = {val: name for name, val in self._list_members(include_methods=True).items()}
11301127
for child in self.file._range_index.get_children(self):
11311128
if self.G.config.feature_flags.debug:
11321129
assert child != self, child

src/codegen/sdk/core/symbol_groups/expression_group.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,4 @@ def function_calls(self) -> list[FunctionCall]:
5959
list[FunctionCall]: A list of all function calls found in the expressions
6060
of this group.
6161
"""
62-
fcalls = []
63-
for expr in self.expressions:
64-
for call in expr.function_calls:
65-
fcalls.append(call)
66-
return fcalls
62+
return [call for expr in self.expressions for call in expr.function_calls]

src/codegen/sdk/python/statements/comment.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ def _parse_comment(self) -> str:
7777
# Remove the triple quotes and extract the text content
7878
text_block = self.source[3:-3]
7979
# Parse the text block into lines
80-
text_lines = []
81-
for line in text_block.lstrip("\n").split("\n"):
82-
text_lines.append(line)
80+
text_lines = list(text_block.lstrip("\n").split("\n"))
8381
# Get indentation level
8482
padding = lowest_indentation(text_lines, skip_lines=skip_lines)
8583
# Remove indentation

src/codegen/sdk/typescript/file.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,7 @@ def valid_import_names(self) -> dict[str, Symbol | TSImport]:
391391
valid_export_names = {}
392392
if len(self.default_exports) == 1:
393393
valid_export_names["default"] = self.default_exports[0]
394-
for export in self.exports:
395-
for name, dest in export.names:
396-
valid_export_names[name] = dest
394+
valid_export_names.update({name: dest for export in self.exports for name, dest in export.names})
397395
return valid_export_names
398396

399397
####################################################################################################################

src/codegen/sdk/typescript/statements/switch_case.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
from codegen.shared.decorators.docs import ts_apidoc
1010

1111
if TYPE_CHECKING:
12-
from codegen.sdk.codebase.codebase_graph import CodebaseGraph
1312
from src.codegen.sdk.typescript.statements.switch_statement import TSSwitchStatement
1413

14+
from codegen.sdk.codebase.codebase_graph import CodebaseGraph
15+
1516

1617
@ts_apidoc
1718
class TSSwitchCase(SwitchCase[TSCodeBlock["TSSwitchStatement"]], TSBlockStatement):

0 commit comments

Comments
 (0)