Skip to content

Commit 2d9aa8a

Browse files
authored
feat: do not dump location tables in the trace (#1326)
Signed-off-by: Louis Mandel <lmandel@us.ibm.com>
1 parent f2496e8 commit 2d9aa8a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/pdl/pdl_dumper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def block_to_dict( # noqa: C901
303303
[ContributeTarget.CONTEXT, ContributeTarget.RESULT],
304304
]:
305305
d["contribute"] = contribute_to_list(block.contribute)
306-
if block.pdl__result is not None:
306+
if block.pdl__result is not None and not isinstance(block, ImportBlock):
307307
d["pdl__result"] = data_to_dict(block.pdl__result.result(), json_compatible)
308308
if block.parser is not None:
309309
d["parser"] = parser_to_dict(block.parser)
@@ -470,6 +470,8 @@ def as_json(value: Any) -> JsonType:
470470
return {str(k): as_json(v) for k, v in value.items()}
471471
if isinstance(value, Iterable):
472472
return [as_json(v) for v in value]
473+
if isinstance(value, Block):
474+
return as_json(block_to_dict(value, json_compatible=True)) # pyright: ignore
473475
return str(value)
474476

475477

@@ -493,7 +495,7 @@ def parser_to_dict(parser: ParserType) -> str | dict[str, Any]:
493495

494496

495497
def location_to_dict(location: PdlLocationType) -> dict[str, Any]:
496-
return {"path": location.path, "file": location.file, "table": location.table}
498+
return {"path": location.path, "file": location.file, "table": {}}
497499

498500

499501
def contribute_to_list(

src/pdl/pdl_lazy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def data(self):
3131
return self._data
3232

3333
def __repr__(self):
34-
return self.result().__repr__()
34+
return repr(self.result())
3535

3636
def result(self) -> PdlConstT:
3737
while isinstance(self._data, (Future, PdlLazy)):
@@ -74,7 +74,7 @@ def __len__(self):
7474
return len(self.data)
7575

7676
def __repr__(self):
77-
return self.result().__repr__()
77+
return repr(self.result())
7878

7979
def __add__(self, value: Union["PdlList", list]):
8080
if isinstance(value, PdlList):
@@ -128,7 +128,7 @@ def __len__(self):
128128
return len(self.data)
129129

130130
def __repr__(self):
131-
return self.result().__repr__()
131+
return repr(self.result())
132132

133133
def __or__(self, value: Union["PdlLazy", dict]):
134134
if isinstance(value, PdlLazy):
@@ -164,7 +164,7 @@ def data(self):
164164
return self._data
165165

166166
def __repr__(self):
167-
return self.result().__repr__()
167+
return repr(self.result())
168168

169169
def result(self) -> ApplyOutputT:
170170
data = self.data
@@ -220,7 +220,7 @@ def data(self) -> Apply2OutputT | PdlLazy[Apply2OutputT]:
220220
return self._data
221221

222222
def __repr__(self):
223-
return self.result().__repr__()
223+
return repr(self.result())
224224

225225
def result(self) -> Apply2OutputT:
226226
data = self.data

0 commit comments

Comments
 (0)