• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python schema.JaggedArrayNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sefaria.model.schema.JaggedArrayNode的典型用法代码示例。如果您正苦于以下问题:Python JaggedArrayNode类的具体用法?Python JaggedArrayNode怎么用?Python JaggedArrayNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了JaggedArrayNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:JonMosenkis,项目名称:Sefaria-Project,代码行数:27,代码来源:node_test.py


示例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()
开发者ID:JonMosenkis,项目名称:Sefaria-Project,代码行数:30,代码来源:node_test.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:ls_functions.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:eee_functions.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:rasag_commentary_index_record.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:rasag_commentary_index_record.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:ralbag_esther_functions.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:rb_yonah_functions.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:ralbag_esther_functions.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:rasag_commentary_index_record.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:ls_functions.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:10,代码来源:rasag_commentary_index_record.py


示例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
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:10,代码来源:rasag_commentary_index_record.py


示例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)
开发者ID:JonMosenkis,项目名称:Sefaria-Project,代码行数:10,代码来源:node_test.py


示例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()
        }
开发者ID:,项目名称:,代码行数:11,代码来源:


示例16: create_book_ja_node

def create_book_ja_node(english_book_name, hebrew_book_name):
    en_name = english_book_name[0]
    he_name = hebrew_book_name[0]
    book_node = JaggedArrayNode()
    book_node.key = en_name
    book_node.add_title(en_name, 'en', primary=True)
    book_node.add_title(he_name, 'he', primary=True)
    book_node.depth = 3
    book_node.addressTypes = ["Integer", "Integer", "Integer"]
    book_node.sectionNames = ["Chapter", "Verse", "Comment"]
    book_node.toc_zoom = 2
    return book_node
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:12,代码来源:updated_structure_function.py


示例17: create_mitzvah_node

def create_mitzvah_node(en_name, he_name):
    mitzvah = JaggedArrayNode()
    mitzvah.add_title(en_name, 'en', primary=True)
    mitzvah.add_title(he_name, 'he', primary=True)
    mitzvah.key = en_name
    mitzvah.depth = 2
    mitzvah.addressTypes = ["Integer", "Integer"]
    mitzvah.sectionNames = ["Mitzvah", "Comment"]
    return mitzvah
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:ls_functions.py


示例18: create_schema

def create_schema():
    rif_on_nedarim = JaggedArrayNode()
    rif_on_nedarim.add_title('Rif_Nedarim', 'en', primary=True)
    rif_on_nedarim.add_title(u'רי"ף נדרים', 'he', primary=True)
    rif_on_nedarim.key = 'Rif_Nedarim'
    rif_on_nedarim.depth = 2
    rif_on_nedarim.addressTypes = ["Talmud", "Integer"]
    rif_on_nedarim.sectionNames = ["Daf", "Line"]
    return rif_on_nedarim
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:rif_nedarim_functions.py


示例19: create_jagged_array_nodes

def create_jagged_array_nodes(en_name, he_name):
    book_node = JaggedArrayNode()
    book_node.key = en_name
    book_node.add_title(en_name, 'en', primary=True)
    book_node.add_title(he_name, 'he', primary=True)
    book_node.depth = 2
    book_node.addressTypes = ["Integer", "Integer"]
    book_node.sectionNames = ["Chapter", "Verse"]
    return book_node
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:tjh_functions.py


示例20: create_commentary_node

def create_commentary_node():
    commentary = JaggedArrayNode()
    commentary.default = True
    commentary.key = 'default'
    commentary.depth = 3
    commentary.addressTypes = ["Integer", "Integer", "Integer"]
    commentary.sectionNames = ["Perek", "Pasuk", "Comment"]
    commentary.toc_zoom = 2
    return commentary
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:9,代码来源:eee_functions.py



注:本文中的sefaria.model.schema.JaggedArrayNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python library.get_refs_in_string函数代码示例发布时间:2022-05-27
下一篇:
Python schema.AddressTalmud类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap