本文整理汇总了Python中sefaria.model.schema.JaggedArrayNode类的典型用法代码示例。如果您正苦于以下问题:Python JaggedArrayNode类的具体用法?Python JaggedArrayNode怎么用?Python JaggedArrayNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JaggedArrayNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_default_chain
def test_default_chain(self):
s = SchemaNode()
s.key = "root"
s.add_title("root", "en", primary=True)
s.add_title("alt root", "en")
s2 = SchemaNode()
s2.key = "default"
s2.default = True
s2.append_to(s)
j = JaggedArrayNode()
j.key = "default"
j.depth = 1
j.default = True
j.sectionNames = ["Foo"]
j.addressTypes = ["Integer"]
j.append_to(s2)
s.validate()
assert s.has_numeric_continuation()
assert s2.has_numeric_continuation()
assert j.has_numeric_continuation()
assert not s.has_titled_continuation()
assert not s2.has_titled_continuation()
assert not j.has_titled_continuation()
示例2: test_jaggedarray_fields
def test_jaggedarray_fields(self):
j = JaggedArrayNode()
j.add_title(u"title1", "en", primary=True)\
.add_title(u"ייי", "he", primary=True)\
.add_title(u"title2", "en")\
.add_title(u"ייכי", "he")
j.depth = 1
j.sectionNames = ["Foo"]
j.addressTypes = ["Integer"]
j.key = "bob"
j.validate()
for f in ["depth", "sectionNames", "addressTypes", "key"]:
t = copy.deepcopy(j)
delattr(t, f)
with pytest.raises(IndexSchemaError):
t.validate()
t = copy.deepcopy(j)
t.sectionNames += ["foob"]
with pytest.raises(IndexSchemaError):
t.validate()
t = copy.deepcopy(j)
t.addressTypes += ["Integer"]
with pytest.raises(IndexSchemaError):
t.validate()
示例3: create_shorash_node
def create_shorash_node():
shorash = JaggedArrayNode()
shorash.add_title('Shorashim', 'en', primary=True)
shorash.add_title(u'שורשים', 'he', primary=True)
shorash.key = 'Shorashim'
shorash.depth = 2
shorash.addressTypes = ["Integer", "Integer"]
shorash.sectionNames = ["Shoresh", "Comment"]
return shorash
示例4: create_intro_node
def create_intro_node():
intro = JaggedArrayNode()
intro.add_title('Introduction', 'en', primary=True)
intro.add_title(u'הקדמה', 'he', primary=True)
intro.key = 'Introduction'
intro.depth = 1
intro.addressTypes = ["Integer"]
intro.sectionNames = ["Comment"]
return intro
示例5: create_positive_commandments_node
def create_positive_commandments_node():
positive_commandments = JaggedArrayNode()
positive_commandments.add_title('Positive Commandments', 'en', primary=True)
positive_commandments.add_title(u'מנין עשה', 'he', primary=True)
positive_commandments.key = 'Positive Commandments'
positive_commandments.depth = 2
positive_commandments.addressTypes = ["Integer", "Integer"]
positive_commandments.sectionNames = ["Mitzvah", "Comment"]
return positive_commandments
示例6: create_shorash_node
def create_shorash_node():
intro_node = JaggedArrayNode()
intro_node.add_title('Shorashim', "en", primary=True)
intro_node.add_title(u'שורשים', "he", primary=True)
intro_node.key = 'Shorashim'
intro_node.depth = 2
intro_node.addressTypes = ["Integer", "Integer"]
intro_node.sectionNames = ["Shorash", "Comment"]
return intro_node
示例7: create_intro_nodes
def create_intro_nodes():
intro_node = JaggedArrayNode()
intro_node.add_title('Introduction', "en", primary=True)
intro_node.add_title(u'הצעה', "he", primary=True)
intro_node.key = 'Introduction'
intro_node.depth = 1
intro_node.addressTypes = ["Integer"]
intro_node.sectionNames = ["Comment"]
return intro_node
示例8: create_schema
def create_schema():
rb_schema = JaggedArrayNode()
rb_schema.add_title('Rabbeinu Yonah on Pirkei Avot', 'en', primary=True)
rb_schema.add_title(u'רבינו יונה על פרקי אבות', 'he', primary=True)
rb_schema.key = 'Rabbeinu Yonah on Pirkei Avot'
rb_schema.depth = 3
rb_schema.addressTypes = ["Integer", "Integer", "Integer"]
rb_schema.sectionNames = ["Perek", "Mishna", "Comment"]
return rb_schema
示例9: create_toalot_node
def create_toalot_node():
toalot = JaggedArrayNode()
toalot.add_title('Benefits', "en", primary=True)
toalot.add_title(u'תועלות', "he", primary=True)
toalot.key = 'Benefits'
toalot.depth = 1
toalot.addressTypes = ["Integer"]
toalot.sectionNames = ["Comment"]
return toalot
示例10: create_negative_commandments_node
def create_negative_commandments_node():
negative_commandments = JaggedArrayNode()
negative_commandments.add_title('Negative Commandments', 'en', primary=True)
negative_commandments.add_title(u'מנין לא תעשה', 'he', primary=True)
negative_commandments.key = 'Negative Commandments'
negative_commandments.depth = 2
negative_commandments.addressTypes = ["Integer", "Integer"]
negative_commandments.sectionNames = ["Mitzvah", "Comment"]
return negative_commandments
示例11: create_schema
def create_schema():
ls_schema = JaggedArrayNode()
ls_schema.add_title('Lechem Shamayim on Pirkei Avot', 'en', primary=True)
ls_schema.add_title(u'לחם שמים על פרקי אבות', 'he', primary=True)
ls_schema.key = 'Lechem Shamayim on Pirkei Avot'
ls_schema.depth = 3
ls_schema.addressTypes = ["Integer", "Integer", "Integer"]
ls_schema.sectionNames = ["Perek", "Mishna", "Comment"]
return ls_schema
示例12: chapter_nine
def chapter_nine(number):
hebrew_letter = util.numToHeb(number)
chapter = JaggedArrayNode()
chapter.add_title('Chapter {}'.format(number), "en", primary=True)
chapter.add_title(u'{} {}'.format(u'סימן', hebrew_letter), "he", primary=True)
chapter.key = 'Chapter {}'.format(number)
chapter.depth = 2
chapter.addressTypes = ["Integer", "Integer"]
chapter.sectionNames = ["Section", "Mitzvah"]
return chapter
示例13: regular_chapter_nodes
def regular_chapter_nodes(number):
hebrew_letter = util.numToHeb(number)
chapter = JaggedArrayNode()
chapter.add_title('Chapter {}'.format(number), "en", primary=True)
chapter.add_title(u'{} {}'.format(u'סימן',hebrew_letter), "he", primary=True)
chapter.key = 'Chapter {}'.format(number)
chapter.depth = 1
chapter.addressTypes = ["Integer"]
chapter.sectionNames = ["Comment"]
return chapter
示例14: test_duplicate_primary
def test_duplicate_primary(self):
with pytest.raises(IndexSchemaError):
j = JaggedArrayNode()
j.add_title(u"title1", "en", primary=True)
j.add_title(u"title2", "en", primary=True)
with pytest.raises(IndexSchemaError):
j = JaggedArrayNode()
j.add_title(u"ייי", "he", primary=True)
j.add_title(u"ייעי", "he", primary=True)
示例15: get_base_index
def get_base_index(en_title, he_title):
node = JaggedArrayNode()
node.add_primary_titles(en_title, he_title)
node.add_structure(['Chapter', 'Halakhah'])
node.validate()
return {
'title': en_title,
'categories': ["Masechtot Ketanot"],
'schema': node.serialize()
}