From 934f6534f171980b01d05eab7744b7f2fef0d40a Mon Sep 17 00:00:00 2001 From: stephenmk Date: Sat, 22 Apr 2023 21:01:52 -0500 Subject: [PATCH] Rename util.py -> expressions.py --- bot/entries/jitenon.py | 4 ++-- bot/{util.py => expressions.py} | 5 +---- bot/yomichan/glossary/gloss.py | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) rename bot/{util.py => expressions.py} (86%) diff --git a/bot/entries/jitenon.py b/bot/entries/jitenon.py index 36f397b..f9f2a1a 100644 --- a/bot/entries/jitenon.py +++ b/bot/entries/jitenon.py @@ -2,7 +2,7 @@ import re from datetime import datetime, date from bs4 import BeautifulSoup -import bot.util as Util +import bot.expressions as Expressions class JitenonEntry: @@ -77,7 +77,7 @@ class JitenonEntry: return [m.group(1)] m = re.search(r"^[ぁ-ヿ、]+([ぁ-ヿ、])[ぁ-ヿ、]+$", yomikata) if m: - return Util.expand_shouryaku(yomikata) + return Expressions.expand_shouryaku(yomikata) m = re.search(r"^([ぁ-ヿ、]+)(([ぁ-ヿ/\s、]+))$", yomikata) if m: yomikatas = [m.group(1)] diff --git a/bot/util.py b/bot/expressions.py similarity index 86% rename from bot/util.py rename to bot/expressions.py index ba63084..ba39db6 100644 --- a/bot/util.py +++ b/bot/expressions.py @@ -4,10 +4,7 @@ import re def expand_shouryaku(shouryaku): """Return a list of words described by a 省略 notation. eg. "有(り)合(わ)せ" -> [ - "有り合わせ", - "有合わせ", - "有り合せ", - "有合せ" + "有り合わせ", "有合わせ", "有り合せ", "有合せ" ] """ groups = re.findall(r"([^(]*)((([^(]+)))?", shouryaku) diff --git a/bot/yomichan/glossary/gloss.py b/bot/yomichan/glossary/gloss.py index 5080f43..1a0e743 100644 --- a/bot/yomichan/glossary/gloss.py +++ b/bot/yomichan/glossary/gloss.py @@ -1,3 +1,4 @@ +import re from css_parser import parseStyle