Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 3, 2023
1 parent 9fdb76e commit 2cf8c7a
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/mqt/qmap/visualization/visualize_search_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,10 @@ def _visualize_search_graph_check_parameters(
if ColorValidator.perform_validate_coerce(search_edges_color, allow_number=False) is None:
raise TypeError(ColorValidator("search_edges_color", "visualize_search_graph").description())

if (
search_edges_dash not in ["solid", "dot", "dash", "longdash", "dashdot", "longdashdot"] and
not (
re.match(r"^(\d+(\s*\d+)*)$", search_edges_dash) or
re.match(r"^(\d+px(\s*\d+px)*)$", search_edges_dash) or
re.match(r"^(\d+%(\s*\d+%)*)$", search_edges_dash)
)
if search_edges_dash not in ["solid", "dot", "dash", "longdash", "dashdot", "longdashdot"] and not (
re.match(r"^(\d+(\s*\d+)*)$", search_edges_dash)

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '9' and containing many repetitions of '9'.
or re.match(r"^(\d+px(\s*\d+px)*)$", search_edges_dash)
or re.match(r"^(\d+%(\s*\d+%)*)$", search_edges_dash)
):
msg = (
'search_edges_dash must be one of "solid", "dot", "dash", "longdash", "dashdot", "longdashdot" or a string containing a dash length list in '
Expand Down Expand Up @@ -1201,13 +1198,10 @@ def _visualize_search_graph_check_parameters(
if ColorValidator.perform_validate_coerce(stems_color, allow_number=False) is None:
raise TypeError(ColorValidator("stems_color", "visualize_search_graph").description())

if (
stems_dash not in ["solid", "dot", "dash", "longdash", "dashdot", "longdashdot"] and
not (
re.match(r"^(\d+(\s*\d+)*)$", stems_dash) or
re.match(r"^(\d+px(\s*\d+px)*)$", stems_dash) or
re.match(r"^(\d+%(\s*\d+%)*)$", stems_dash)
)
if stems_dash not in ["solid", "dot", "dash", "longdash", "dashdot", "longdashdot"] and not (
re.match(r"^(\d+(\s*\d+)*)$", stems_dash)

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '9' and containing many repetitions of '9'.
or re.match(r"^(\d+px(\s*\d+px)*)$", stems_dash)
or re.match(r"^(\d+%(\s*\d+%)*)$", stems_dash)
):
msg = (
'stems_dash must be one of "solid", "dot", "dash", "longdash", "dashdot", "longdashdot" or a string containing a dash length list in '
Expand Down Expand Up @@ -2125,7 +2119,7 @@ def update_layer(new_layer: int) -> None:
layer_slider = interactive(
update_layer,
new_layer=IntSlider(
min=0, max=number_of_layers-1, step=1, value=0, description="Layer:", layout=Layout(width=f"{width-80}px")
min=0, max=number_of_layers - 1, step=1, value=0, description="Layer:", layout=Layout(width=f"{width-80}px")
),
)

Expand Down

0 comments on commit 2cf8c7a

Please sign in to comment.