Skip to content

Commit 54460ed

Browse files
committed
Fix ruff lint and format issues in preview.py
1 parent d5439cf commit 54460ed

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/datajoint/preview.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ def _format_object_display(json_data):
2424
return "=OBJ[file]="
2525

2626

27-
def _get_display_value(tup, field, object_fields, object_data):
28-
"""Get display value for a field, handling objects specially."""
29-
if field in tup.dtype.names:
30-
return tup[field]
31-
elif field in object_fields and object_data is not None:
32-
# Find the matching tuple in object_data by index
33-
idx = list(tup.dtype.names).index(list(tup.dtype.names)[0]) # placeholder
34-
return _format_object_display(object_data.get(field))
35-
else:
36-
return "=BLOB="
37-
38-
3927
def preview(query_expression, limit, width):
4028
heading = query_expression.heading
4129
rel = query_expression.proj(*heading.non_blobs)
@@ -90,9 +78,7 @@ def get_display_value(tup, f, idx):
9078
+ "\n"
9179
+ " ".join(["+" + "-" * (widths[column] - 2) + "+" for column in columns])
9280
+ "\n"
93-
+ "\n".join(
94-
" ".join(templates[f] % get_display_value(tup, f, idx) for f in columns) for idx, tup in enumerate(tuples)
95-
)
81+
+ "\n".join(" ".join(templates[f] % get_display_value(tup, f, idx) for f in columns) for idx, tup in enumerate(tuples))
9682
+ ("\n ...\n" if has_more else "\n")
9783
+ (" (Total: %d)\n" % len(rel) if config["display.show_tuple_count"] else "")
9884
)
@@ -206,9 +192,7 @@ def get_html_display_value(tup, name, idx):
206192
ellipsis="<p>...</p>" if has_more else "",
207193
body="</tr><tr>".join(
208194
[
209-
"\n".join(
210-
["<td>%s</td>" % get_html_display_value(tup, name, idx) for name in heading.names]
211-
)
195+
"\n".join(["<td>%s</td>" % get_html_display_value(tup, name, idx) for name in heading.names])
212196
for idx, tup in enumerate(tuples)
213197
]
214198
),

0 commit comments

Comments
 (0)