Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
add get_config() function
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Oct 15, 2021
1 parent 3df13ae commit 35575ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

import aqt
from anki.notes import Note
from aqt import mw

ANKI21_VERSION = int(aqt.appVersion.split('.')[-1])
NUMBERS = "一二三四五六七八九十0123456789"
config = aqt.mw.addonManager.getConfig(__name__)
RE_FLAGS = re.MULTILINE | re.IGNORECASE


def get_config():
return mw.addonManager.getConfig(__name__)


def clean_furigana(expr: str) -> str:
return re.sub(r'([^ ]+)\[[^ ]+]', r'\g<1>', expr, flags=RE_FLAGS).replace(' ', '')

Expand All @@ -36,3 +40,6 @@ def is_supported_notetype(note: Note) -> bool:

this_notetype = get_notetype(note)['name']
return any(notetype.lower() in this_notetype.lower() for notetype in config["note_types"])


config = get_config()
1 change: 0 additions & 1 deletion reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from anki import hooks
from anki.utils import htmlToTextLine
from aqt import mw

from .helpers import *
from .mecab_controller import MecabController
Expand Down

0 comments on commit 35575ed

Please sign in to comment.