本文整理汇总了Python中mnemonic.Mnemonic._get_directory方法的典型用法代码示例。如果您正苦于以下问题:Python Mnemonic._get_directory方法的具体用法?Python Mnemonic._get_directory怎么用?Python Mnemonic._get_directory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mnemonic.Mnemonic
的用法示例。
在下文中一共展示了Mnemonic._get_directory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mnemonic import Mnemonic [as 别名]
# 或者: from mnemonic.Mnemonic import _get_directory [as 别名]
def __init__(self, language='english'):
self.radix = 2048
self.stellar_account_path_format = "m/44'/148'/%d'"
self.first_hardened_index = 0x80000000
self.seed_modifier = b"ed25519 seed"
if language == 'chinese':
with io.open('%s/%s.txt' % (self._get_directory(), language), 'r', encoding="utf8") as f:
self.wordlist = [w.strip() for w in f.readlines()]
else:
with io.open('%s/%s.txt' % (Mnemonic._get_directory(), language),
'r', encoding="utf8") as f:
self.wordlist = [w.strip() for w in f.readlines()]
if len(self.wordlist) != self.radix:
raise ConfigurationError(
'Wordlist should contain %d words, but it contains %d words.' % (self.radix, len(self.wordlist)))
示例2: list_languages
# 需要导入模块: from mnemonic import Mnemonic [as 别名]
# 或者: from mnemonic.Mnemonic import _get_directory [as 别名]
def list_languages(cls):
lang = [f.split('.')[0] for f in os.listdir(cls._get_directory()) if f.endswith('.txt')]
lang += [f.split('.')[0] for f in os.listdir(Mnemonic._get_directory()) if f.endswith('.txt')]
return lang