當前位置: 首頁>>代碼示例>>Python>>正文


Python schema.JaggedArrayNode類代碼示例

本文整理匯總了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()
開發者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,代碼來源:


注:本文中的sefaria.model.schema.JaggedArrayNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。