Skip to content

Commit fffe207

Browse files
eacodegenbagel897codegen-bot
committed
Fix gradio (#130)
# Motivation <!-- Why is this change necessary? --> # Content <!-- Please include a summary of the change --> # Testing <!-- How was the change tested? --> # Please check the following before marking your PR as ready for review - [ ] I have added tests for my changes - [ ] I have updated the documentation or added new documentation as needed - [ ] I have read and agree to the [Contributor License Agreement](../CLA.md) --------- Co-authored-by: bagel897 <[email protected]> Co-authored-by: codegen-bot <[email protected]>
1 parent a97f64c commit fffe207

File tree

6 files changed

+23
-4
lines changed

6 files changed

+23
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ classifiers = [
8686
"Topic :: Software Development :: Code Generators",
8787
"Topic :: Software Development :: Libraries",
8888
]
89-
authors = [{ name = "Codegen Team", email = "team+codegenbot@codegen.sh" }]
89+
authors = [{ name = "Codegen Team", email = "[email protected]" }]
9090
keywords = [
9191
"codegen",
9292
"codebase",

src/codegen/sdk/core/file.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,10 @@ def valid_symbol_names(self) -> dict[str, Symbol | TImport | WildcardImport[TImp
819819
@reader
820820
def resolve_name(self, name: str, start_byte: int | None = None) -> Symbol | Import | WildcardImport | None:
821821
if resolved := self.valid_symbol_names.get(name):
822+
if start_byte is not None and resolved.end_byte > start_byte:
823+
for symbol in self.symbols:
824+
if symbol.start_byte <= start_byte and symbol.name == name:
825+
return symbol
822826
return resolved
823827

824828
@property

src/codegen/sdk/core/import_resolution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ class WildcardImport(Chainable, Generic[TImport]):
624624
def __init__(self, imp: TImport, symbol: Importable):
625625
self.imp = imp
626626
self.symbol = symbol
627+
self.ts_node = imp.ts_node
627628

628629
@reader
629630
@noapidoc

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from typing import TYPE_CHECKING, Generic, Self, TypeVar, Union
23

34
from tree_sitter import Node as TSNode
@@ -20,6 +21,8 @@
2021

2122
Parent = TypeVar("Parent", bound="Editable")
2223

24+
logger = logging.getLogger(__name__)
25+
2326

2427
@apidoc
2528
class Importable(Expression[Parent], HasName, Generic[Parent]):
@@ -90,7 +93,11 @@ def recompute(self, incremental: bool = False) -> list["Importable"]:
9093
"""
9194
if incremental:
9295
self._remove_internal_edges(EdgeType.SYMBOL_USAGE)
93-
self._compute_dependencies()
96+
try:
97+
self._compute_dependencies()
98+
except Exception as e:
99+
logger.error(f"Error in file {self.file.path} while computing dependencies for symbol {self.name}")
100+
raise e
94101
if incremental:
95102
return self.descendant_symbols + self.file.get_nodes(sort=False)
96103
return []
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "gradio",
3+
"commit": "f40747c9fd12d160ac9f7b3c5273be6be815efac",
4+
"url": "https://github.com/gradio-app/gradio",
5+
"language": "PYTHON",
6+
"size": "small"
7+
}

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)