Skip to content

Commit

Permalink
Avoid wrong function name in warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Oct 10, 2023
1 parent ca7b134 commit 4238a8a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/wireviz/wv_graphviz.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import re
import warnings
from itertools import zip_longest
from typing import Any, List, Optional, Tuple, Union

Expand Down Expand Up @@ -580,15 +581,9 @@ def typecheck(name: str, value: Any, expect: type) -> None:
f'( +)?{attr}=("[^"]*"|[^] ]*)(?(1)| *)', "", entry
)
if n_subs < 1:
print(
"Harness.create_graph() warning: "
f"{attr} not found in {keyword}!"
)
warnings.warn(f"tweak: {attr} not found in {keyword}!")
elif n_subs > 1:
print(
"Harness.create_graph() warning: "
f"{attr} removed {n_subs} times in {keyword}!"
)
warnings.warn(f"tweak: {attr} removed {n_subs} times in {keyword}!")
continue

if len(value) == 0 or " " in value:
Expand All @@ -601,10 +596,7 @@ def typecheck(name: str, value: Any, expect: type) -> None:
# If attr not found, then append it
entry = re.sub(r"\]$", f" {attr}={value}]", entry)
elif n_subs > 1:
print(
"Harness.create_graph() warning: "
f"{attr} overridden {n_subs} times in {keyword}!"
)
warnings.warn(f"tweak: {attr} overridden {n_subs} times in {keyword}!")

dot.body[i] = entry

Expand Down

0 comments on commit 4238a8a

Please sign in to comment.