44import webbrowser
55from functools import reduce
66from pathlib import Path
7+ from typing import Optional
78
89qgraph_css = """
910:root {
@@ -326,8 +327,8 @@ def get_child_timings(top_node: object, query_timings: object, depth: int = 0) -
326327
327328def get_f7fff0_shade_hex (fraction : float ) -> str :
328329 """Returns a shade between very light (#f7fff0) and a slightly darker green-yellow,
329- depending on the fraction (0..1)
330- """
330+ depending on the fraction (0..1).
331+ """ #noqa: D205
331332 fraction = max (0 , min (1 , fraction ))
332333
333334 # Define RGB for light and dark end
@@ -550,7 +551,7 @@ def generate_ipython(json_input: str) -> str: # noqa: D103
550551
551552def generate_style_html (graph_json : str , include_meta_info : bool ) -> None : # noqa: D103, FBT001
552553 treeflex_css = '<link rel="stylesheet" href="https://unpkg.com/treeflex/dist/css/treeflex.css">\n '
553- libraries = '<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">\n '
554+ libraries = '<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">\n ' # noqa: E501
554555 return {"treeflex_css" : treeflex_css , "duckdb_css" : qgraph_css , "libraries" : libraries , "chart_script" : "" }
555556
556557
@@ -561,7 +562,7 @@ def gather_timing_information(json: str, query_timings: object) -> None: # noqa
561562 get_child_timings (json ["children" ][0 ], query_timings )
562563
563564
564- def translate_json_to_html (input_file : str = None , input_text : str = None , output_file : str = "profile.html" ) -> None : # noqa: D103
565+ def translate_json_to_html (input_file : Optional [ str ] = None , input_text : Optional [ str ] = None , output_file : str = "profile.html" ) -> None : # noqa: D103, E501
565566 query_timings = AllTimings ()
566567 if input_text is not None :
567568 text = input_text
@@ -590,7 +591,7 @@ def translate_json_to_html(input_file: str = None, input_text: str = None, outpu
590591 ${DUCKDB_CSS}
591592 </style>
592593</head>
593- <body>
594+ <body>
594595 <div class="container">
595596 <header>
596597 <img src="https://raw.githubusercontent.com/duckdb/duckdb/refs/heads/main/logo/DuckDB_Logo-horizontal.svg" alt="DuckDB Logo">
@@ -606,7 +607,7 @@ def translate_json_to_html(input_file: str = None, input_text: str = None, outpu
606607 ${TREE}
607608</body>
608609</html>
609- """
610+ """ # noqa: E501
610611 html = html .replace ("${TREEFLEX_CSS}" , html_output ["treeflex_css" ])
611612 html = html .replace ("${DUCKDB_CSS}" , html_output ["duckdb_css" ])
612613 html = html .replace ("${METRIC_GRID}" , highlight_metric_grid )
0 commit comments