Skip to content

Commit

Permalink
Change to generate a signature value of Constraint.pattern as a raw s…
Browse files Browse the repository at this point in the history
…tring
  • Loading branch information
yugokato committed Sep 26, 2024
1 parent e194158 commit 3944baa
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def get_type_annotation_as_str(tp: Any) -> str:
elif isinstance(tp, (Alias, Format)):
return f"{type(tp).__name__}({repr(tp.value)})"
elif isinstance(tp, Constraint):
const = ", ".join(f"{k}={repr(v)}" for k, v in asdict(tp).items() if v is not None)
const = ", ".join(
f'{k}={("r" + repr(v) if k == "pattern" else repr(v))}' for k, v in asdict(tp).items() if v is not None
)
return f"{type(tp).__name__}({const})"
elif tp is NoneType:
return "None"
Expand Down

0 comments on commit 3944baa

Please sign in to comment.