mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
unihandecode: introduce borg to reduce memory consumption
This commit is contained in:
parent
9fea301a6f
commit
71d91089b6
@ -163,6 +163,14 @@ class H2a (object):
|
||||
u"\u3093\u304a":"n'o",
|
||||
}
|
||||
|
||||
# this class is Borg
|
||||
_shared_state = {}
|
||||
|
||||
def __new__(cls, *p, **k):
|
||||
self = object.__new__(cls, *p, **k)
|
||||
self.__dict__ = cls._shared_state
|
||||
return self
|
||||
|
||||
def isHiragana(self, char):
|
||||
return ( 0x3040 < ord(char) and ord(char) < 0x3094)
|
||||
|
||||
|
@ -15,6 +15,14 @@ class jisyo (object):
|
||||
kanadict = None
|
||||
jisyo_table = {}
|
||||
|
||||
# this class is Borg
|
||||
_shared_state = {}
|
||||
|
||||
def __new__(cls, *p, **k):
|
||||
self = object.__new__(cls, *p, **k)
|
||||
self.__dict__ = cls._shared_state
|
||||
return self
|
||||
|
||||
def __init__(self):
|
||||
if self.kanwadict is None:
|
||||
dictpath = resources.get_path(os.path.join('localization','pykakasi','kanwadict2.db'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user