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 6e3e29b commit 28188e3
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 @@ -18,7 +18,6 @@
import argparse
import json
import os
import re
import sys

from em_keyboard import _version
Expand Down Expand Up @@ -79,8 +78,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 28188e3

Please sign in to comment.