Skip to content

Commit

Permalink
optimize single codepoint is normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
Carbon225 committed Oct 30, 2023
1 parent d58162b commit f50632c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ens_normalize/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,9 @@ def is_ens_normalized(name: str) -> bool:
Checks if the input string is already ENS normalized
(i.e. `ens_normalize(name) == name`).
"""
if len(name) == 1 and ord(name) in NORMALIZATION.valid:
# single codepoint optimization
return True
return ens_process(name, do_normalize=True).normalized == name


Expand Down

0 comments on commit f50632c

Please sign in to comment.