@@ -180,7 +180,7 @@ def get_layout(algorithm: str) -> dict:
180
180
if node_type == "file" :
181
181
# File nodes
182
182
full_path = G .nodes [node ].get ("full_path" , node )
183
- connected_tables = [ n for n in G .neighbors (node )]
183
+ connected_tables = list ( G .neighbors (node ))
184
184
hover_text = f"<b>File:</b> { full_path } <br>"
185
185
hover_text += f"<b>Tables Used:</b> { len (connected_tables )} <br>"
186
186
hover_text += "<br>" .join (f"- { table } " for table in connected_tables )
@@ -190,7 +190,7 @@ def get_layout(algorithm: str) -> dict:
190
190
table_count = len (connected_tables )
191
191
max_tables = max (
192
192
[
193
- len ([n for n in G .neighbors (node )])
193
+ len ([list ( G .neighbors (node ) )])
194
194
for node in G .nodes ()
195
195
if G .nodes [node ].get ("type" ) == "file"
196
196
],
@@ -281,7 +281,7 @@ def get_layout(algorithm: str) -> dict:
281
281
edge_trace = go .Scatter (
282
282
x = edge_x ,
283
283
y = edge_y ,
284
- line = dict ( width = 1 , color = " rgba(150, 150, 150, 0.5)") ,
284
+ line = { " width" : 1 , " color" : " rgba(150, 150, 150, 0.5)"} ,
285
285
hoverinfo = "none" ,
286
286
mode = "lines" ,
287
287
showlegend = False ,
@@ -307,15 +307,15 @@ def get_layout(algorithm: str) -> dict:
307
307
textposition = "top center" ,
308
308
hovertext = [data ["hover_text" ] for data in file_nodes .values ()],
309
309
hoverinfo = "text" ,
310
- marker = dict (
311
- symbol = file_symbol ,
312
- size = [data ["size" ] for data in file_nodes .values ()],
313
- color = [data ["color" ] for data in file_nodes .values ()]
310
+ marker = {
311
+ " symbol" : file_symbol ,
312
+ " size" : [data ["size" ] for data in file_nodes .values ()],
313
+ " color" : [data ["color" ] for data in file_nodes .values ()]
314
314
if color_gradient
315
315
else "rgba(31, 119, 180, 0.8)" ,
316
- line = dict ( width = 1 , color = " rgba(31, 119, 180, 1)") ,
317
- ) ,
318
- textfont = dict ( size = text_font_size ) ,
316
+ " line" : { " width" : 1 , " color" : " rgba(31, 119, 180, 1)"} ,
317
+ } ,
318
+ textfont = { " size" : text_font_size } ,
319
319
)
320
320
traces .append (file_trace )
321
321
@@ -333,15 +333,15 @@ def get_layout(algorithm: str) -> dict:
333
333
textposition = "top center" ,
334
334
hovertext = [data ["hover_text" ] for data in regular_table_nodes .values ()],
335
335
hoverinfo = "text" ,
336
- marker = dict (
337
- symbol = table_symbol ,
338
- size = [data ["size" ] for data in regular_table_nodes .values ()],
339
- color = [data ["color" ] for data in regular_table_nodes .values ()]
336
+ marker = {
337
+ " symbol" : table_symbol ,
338
+ " size" : [data ["size" ] for data in regular_table_nodes .values ()],
339
+ " color" : [data ["color" ] for data in regular_table_nodes .values ()]
340
340
if color_gradient
341
341
else "rgba(255, 127, 14, 0.8)" ,
342
- line = dict ( width = 1 , color = " rgba(255, 127, 14, 1)") ,
343
- ) ,
344
- textfont = dict ( size = text_font_size ) ,
342
+ " line" : { " width" : 1 , " color" : " rgba(255, 127, 14, 1)"} ,
343
+ } ,
344
+ textfont = { " size" : text_font_size } ,
345
345
)
346
346
traces .append (regular_table_trace )
347
347
@@ -356,15 +356,15 @@ def get_layout(algorithm: str) -> dict:
356
356
textposition = "top center" ,
357
357
hovertext = [data ["hover_text" ] for data in common_table_nodes .values ()],
358
358
hoverinfo = "text" ,
359
- marker = dict (
360
- symbol = table_symbol ,
361
- size = [data ["size" ] for data in common_table_nodes .values ()],
362
- color = [data ["color" ] for data in common_table_nodes .values ()]
359
+ marker = {
360
+ " symbol" : table_symbol ,
361
+ " size" : [data ["size" ] for data in common_table_nodes .values ()],
362
+ " color" : [data ["color" ] for data in common_table_nodes .values ()]
363
363
if color_gradient
364
364
else "rgba(214, 39, 40, 0.8)" ,
365
- line = dict ( width = 2 , color = " rgba(214, 39, 40, 1)") ,
366
- ) ,
367
- textfont = dict ( size = text_font_size ) ,
365
+ " line" : { " width" : 2 , " color" : " rgba(214, 39, 40, 1)"} ,
366
+ } ,
367
+ textfont = { " size" : text_font_size } ,
368
368
)
369
369
traces .append (common_table_trace )
370
370
@@ -376,12 +376,12 @@ def get_layout(algorithm: str) -> dict:
376
376
377
377
# Add text toggle buttons if requested
378
378
if show_text_buttons :
379
- text_buttons = dict (
380
- type = "buttons" ,
381
- direction = "right" ,
382
- buttons = [
383
- dict (
384
- args = [
379
+ text_buttons = {
380
+ " type" : "buttons" ,
381
+ " direction" : "right" ,
382
+ " buttons" : [
383
+ {
384
+ " args" : [
385
385
{
386
386
"mode" : [
387
387
"lines" ,
@@ -393,50 +393,50 @@ def get_layout(algorithm: str) -> dict:
393
393
else ["lines" , "markers+text" , "markers+text" ]
394
394
}
395
395
],
396
- label = "Show All Text" ,
397
- method = "restyle" ,
398
- ) ,
399
- dict (
400
- args = [
396
+ " label" : "Show All Text" ,
397
+ " method" : "restyle" ,
398
+ } ,
399
+ {
400
+ " args" : [
401
401
{
402
402
"mode" : ["lines" , "markers" , "markers" , "markers" ]
403
403
if len (traces ) == 4
404
404
else ["lines" , "markers" , "markers" ]
405
405
}
406
406
],
407
- label = "Hide All Text" ,
408
- method = "restyle" ,
409
- ) ,
410
- dict (
411
- args = [
407
+ " label" : "Hide All Text" ,
408
+ " method" : "restyle" ,
409
+ } ,
410
+ {
411
+ " args" : [
412
412
{
413
413
"mode" : ["lines" , "markers+text" , "markers" , "markers" ]
414
414
if len (traces ) == 4
415
415
else ["lines" , "markers+text" , "markers" ]
416
416
}
417
417
],
418
- label = "Files Text Only" ,
419
- method = "restyle" ,
420
- ) ,
421
- dict (
422
- args = [
418
+ " label" : "Files Text Only" ,
419
+ " method" : "restyle" ,
420
+ } ,
421
+ {
422
+ " args" : [
423
423
{
424
424
"mode" : ["lines" , "markers" , "markers+text" , "markers+text" ]
425
425
if len (traces ) == 4
426
426
else ["lines" , "markers" , "markers+text" ]
427
427
}
428
428
],
429
- label = "Tables Text Only" ,
430
- method = "restyle" ,
431
- ) ,
429
+ " label" : "Tables Text Only" ,
430
+ " method" : "restyle" ,
431
+ } ,
432
432
],
433
- pad = {"r" : 10 , "t" : 10 },
434
- showactive = True ,
435
- x = 0.5 ,
436
- xanchor = "center" ,
437
- y = 1.15 ,
438
- yanchor = "top" ,
439
- )
433
+ " pad" : {"r" : 10 , "t" : 10 },
434
+ " showactive" : True ,
435
+ "x" : 0.5 ,
436
+ " xanchor" : "center" ,
437
+ "y" : 1.15 ,
438
+ " yanchor" : "top" ,
439
+ }
440
440
updatemenus .append (text_buttons )
441
441
442
442
# Add layout change buttons if requested
@@ -502,21 +502,25 @@ def get_layout(algorithm: str) -> dict:
502
502
]
503
503
504
504
# Create button
505
- button = dict (args = args , label = layout_name .capitalize (), method = "update" )
505
+ button = {
506
+ "args" : args ,
507
+ "label" : layout_name .capitalize (),
508
+ "method" : "update" ,
509
+ }
506
510
layout_buttons .append (button )
507
511
508
512
# Add layout button menu
509
- layout_menu = dict (
510
- type = "buttons" ,
511
- direction = "right" ,
512
- buttons = layout_buttons ,
513
- pad = {"r" : 10 , "t" : 10 },
514
- showactive = True ,
515
- x = 0.5 ,
516
- xanchor = "center" ,
517
- y = 1.08 if show_text_buttons else 1.15 ,
518
- yanchor = "top" ,
519
- )
513
+ layout_menu = {
514
+ " type" : "buttons" ,
515
+ " direction" : "right" ,
516
+ " buttons" : layout_buttons ,
517
+ " pad" : {"r" : 10 , "t" : 10 },
518
+ " showactive" : True ,
519
+ "x" : 0.5 ,
520
+ " xanchor" : "center" ,
521
+ "y" : 1.08 if show_text_buttons else 1.15 ,
522
+ " yanchor" : "top" ,
523
+ }
520
524
updatemenus .append (layout_menu )
521
525
522
526
# Set top margin based on buttons
@@ -532,26 +536,30 @@ def get_layout(algorithm: str) -> dict:
532
536
f"SQL Dependency Graph ({ len (sql_profiles )} files, "
533
537
f"{ len (table_usage )} tables)"
534
538
),
535
- title_font = dict ( size = 16 ) ,
539
+ title_font = { " size" : 16 } ,
536
540
showlegend = True ,
537
- legend = dict (
538
- yanchor = "top" , y = 0.99 , xanchor = "left" , x = 0.01 , itemsizing = "constant"
539
- ),
541
+ legend = {
542
+ "yanchor" : "top" ,
543
+ "y" : 0.99 ,
544
+ "xanchor" : "left" ,
545
+ "x" : 0.01 ,
546
+ "itemsizing" : "constant" ,
547
+ },
540
548
updatemenus = updatemenus if updatemenus else None ,
541
549
hovermode = "closest" ,
542
- margin = dict ( b = 20 , l = 5 , r = 5 , t = top_margin ) ,
550
+ margin = { "b" : 20 , "l" : 5 , "r" : 5 , "t" : top_margin } ,
543
551
annotations = [
544
- dict (
545
- showarrow = False ,
546
- text = "Size indicates usage frequency" ,
547
- xref = "paper" ,
548
- yref = "paper" ,
549
- x = 0.01 ,
550
- y = 0.01 ,
551
- )
552
+ {
553
+ " showarrow" : False ,
554
+ " text" : "Size indicates usage frequency" ,
555
+ " xref" : "paper" ,
556
+ " yref" : "paper" ,
557
+ "x" : 0.01 ,
558
+ "y" : 0.01 ,
559
+ }
552
560
],
553
- xaxis = dict ( showgrid = False , zeroline = False , showticklabels = False ) ,
554
- yaxis = dict ( showgrid = False , zeroline = False , showticklabels = False ) ,
561
+ xaxis = { " showgrid" : False , " zeroline" : False , " showticklabels" : False } ,
562
+ yaxis = { " showgrid" : False , " zeroline" : False , " showticklabels" : False } ,
555
563
plot_bgcolor = "rgba(248, 248, 248, 1)" ,
556
564
paper_bgcolor = "rgba(248, 248, 248, 1)" ,
557
565
)
0 commit comments