import json from pathlib import Path ZERO_WIDTH_SPACE = "\u200b" def remove_weird_unicode(line: str) -> str: """Strip weird unicode characters from line.""" # original has some weird unicode characters that we just need to kick out. # AFAICT this is a data prep issue, not an artist name issue. replacements = {ZERO_WIDTH_SPACE: ""} return line.translate({ord(k): v for k, v in replacements.items()}) # TODO: for some reason modal doesn't like to include ".txt" file when installing with open(Path(__file__).parent / "assets/top_artists.json.py") as f: top_artists_to_styles = json.load(f) TOP_ARTISTS = [remove_weird_unicode(artist.strip()) for artist in top_artists_to_styles]