Skip to content

Commit

Permalink
Replace re.sub() with str.replace()
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 20, 2025
1 parent 46797f4 commit 353b1d7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/em_keyboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import argparse
import os
import re
import sys

from em_keyboard import _version
Expand Down Expand Up @@ -80,8 +79,7 @@ def do_find(lookup: EmojiDict, terms: tuple[str, ...]) -> list[tuple[str, str]]:

def clean_name(name: str) -> str:
"""Clean emoji name replacing specials chars by underscore"""
special_chars = "[-. ]" # square brackets are part of the regex
return re.sub(special_chars, "_", name).lower()
return name.replace("-", "_").replace(".", "_").replace(" ", "_").lower()


def cli() -> None:
Expand Down

0 comments on commit 353b1d7

Please sign in to comment.