How to use default_node method in lisa

Best Python code snippet using lisa_python

appendix2.py

Source:appendix2.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2import urllib3import urllib24from urllib2 import URLError, HTTPError5import json 6import pdb7import os8import sys9from bs4 import BeautifulSoup10import re11p = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))12sys.path.insert(0, p)13sys.path.insert(0,p+"/sources")14os.environ['DJANGO_SETTINGS_MODULE'] = "sefaria.settings"15from local_settings import *16sys.path.append(p+"/data_utilities")17from data_utilities.dibur_hamatchil_matcher import *18from functions import *19sys.path.insert(0, SEFARIA_PROJECT_PATH)20from sefaria.model import *21from sefaria.model.schema import AddressTalmud22root = SchemaNode()23root.add_title("Sefer Mitzvot Gadol", "en", primary=True)24root.add_title("SeMaG", "en")25root.add_title(u"ספר מצוות גדול", "he", primary=True)26root.add_title(u'סמ"ג', 'he')27root.key = "smg"28vol1 = SchemaNode()29vol1.key = 'vol1'30vol1.add_title("Volume One", "en", primary=True)31vol1.add_title(u"חלק הלאוין", "he", primary=True)32intro = JaggedArrayNode()33intro.key = "intropt1"34intro.addressTypes = ["Integer"]35intro.sectionNames = ["Paragraph"]36intro.depth = 137intro.add_title("Introduction", "en", primary=True)38intro.add_title(u"הקדמת המחבר", "he", primary=True)39vol1.append(intro)40remazim = JaggedArrayNode()41remazim.key = "remazimpt1"42remazim.addressTypes = ["Integer"]43remazim.sectionNames = ["Paragraph"]44remazim.depth = 145remazim.add_title("Remazim", "en", primary=True)46remazim.add_title(u"רמזים", "he", primary=True)47vol1.append(remazim)48default_node = JaggedArrayNode()49default_node.depth = 250default_node.sectionNames = ["Negative Mitzvah", "Paragraph"]51default_node.addressTypes = ["Integer", "Integer"]52default_node.default = True53default_node.key = "default"54vol1.append(default_node)55vol2 = SchemaNode()56vol2.key = 'vol2'57vol2.add_title("Volume Two", "en", primary=True)58vol2.add_title(u"חלק העשין", "he", primary=True)59intro = JaggedArrayNode()60intro.key = "intropt2"61intro.addressTypes = ["Integer"]62intro.sectionNames = ["Paragraph"]63intro.depth = 164intro.add_title("Introduction", "en", primary=True)65intro.add_title(u"הקדמת המחבר", "he", primary=True)66vol2.append(intro)67remazim = JaggedArrayNode()68remazim.key = "remazimpt2"69remazim.addressTypes = ["Integer"]70remazim.sectionNames = ["Paragraph"]71remazim.depth = 172remazim.add_title("Remazim", "en", primary=True)73remazim.add_title(u"רמזים", "he", primary=True)74vol2.append(remazim)75default_node = JaggedArrayNode()76default_node.depth = 277default_node.sectionNames = ["Positive Mitzvah", "Paragraph"]78default_node.addressTypes = ["Integer", "Integer"]79default_node.default = True80default_node.key = "default"81vol2.append(default_node)82heb_nodes = [u"הלכות עירובין", u"הלכות אבילות", u"הלכות תשעה באב", u"הלכות מגילה", u"הלכות חנוכה"]83eng_nodes = ["Laws of Eruvin", "Laws of Mourning", "Laws of Tisha B'Av", "Laws of Megillah", "Laws of Chanukah"]84for count, heb_node in enumerate(heb_nodes):85 node = JaggedArrayNode()86 node.depth = 187 node.sectionNames = ["Paragraph"]88 node.addressTypes = ["Integer"]89 node.key = eng_nodes[count]90 node.add_title(heb_node, "he", primary=True)91 node.add_title(eng_nodes[count], "en", primary=True)92 vol2.append(node)93def addMitzvah(mitzvah, text):94 if not isGematria(mitzvah):95 print 'not gematria!'96 pdb.set_trace()97 current_mitzvah = getGematria(mitzvah)98 if current_mitzvah in text:99 print "double mitzvah"100 pdb.set_trace()101 return current_mitzvah102smag = open("appendix.txt",'r')103tag = re.compile('@\d+')104text = {}105prev_line=""106msg=""107root.append(vol1)108root.append(vol2)109root.validate()110index = {111 "title": "Sefer Mitzvot Gadol",112 "categories": ["Halakhah"],113 "schema": root.serialize()114 }...

Full Screen

Full Screen

test_helpers.py

Source:test_helpers.py Github

copy

Full Screen

...55 # but the default can be changed when the node is added back56 helpers.save_node(node1)57 default_node = helpers.get_node()58 self.assertEqual(default_node.name, "node2")59 helpers.set_default_node("node1")60 default_node = helpers.get_node()61 self.assertEqual(default_node.name, "node1")62 # all nodes can be retrieved63 nodes = helpers.get_nodes()64 self.assertEqual(len(nodes), 2)65 self.assertTrue(nodes[0].name in ["node1", "node2"])66 self.assertTrue(nodes[1].name in ["node1", "node2"])67 def test_lists_all_nodes(self):68 pass69 def test_delete_node(self):70 # nodes can be deleted by object or name71 node1 = TcpNode("node1", "https://localhost:8088",72 "node1_key")73 node2 = TcpNode("node2", "https://localhost:8089",...

Full Screen

Full Screen

samplers.py

Source:samplers.py Github

copy

Full Screen

1import tensorflow as tf2from tf_euler.python import euler_ops345vanilla_sample_fanout = euler_ops.sample_fanout678def sample_sim_cor_fanout(nodes, edge_types, counts, default_node=-1):9 neighbors_list = [tf.reshape(nodes, [-1])]10 for hop_edge_types, count in zip(edge_types, counts):11 sim_edge_type = cor_edge_type = None12 if len(hop_edge_types) == 2:13 sim_edge_type, cor_edge_type = hop_edge_types14 elif len(hop_edge_types) == 1:15 sim_edge_type = cor_edge_type = hop_edge_types[0]16 sim_neighbors, _, _ = euler_ops.sample_neighbor(17 neighbors_list[-1], [sim_edge_type], count, default_node=default_node)18 cor_neighbors, _, _ = euler_ops.sample_neighbor(19 neighbors_list[-1], [cor_edge_type], count, default_node=default_node)20 sim_neighbors = tf.reshape(sim_neighbors, [-1])21 cor_neighbors = tf.reshape(cor_neighbors, [-1])22 neighbors = tf.concat([sim_neighbors, cor_neighbors], axis=-1)23 neighbors_list.append(neighbors)24 return [neighbors_list]252627def sample_patterned_metapaths(nodes, patterns, count_per_path, default_node=-1):28 all_neighbors = []29 for meta_pattern in patterns:30 pattern_neighbors = nodes31 last_neighbors = tf.reshape(nodes, [-1])32 counts = [int(count_per_path // len(meta_pattern))] + [1] * (len(meta_pattern) - 1)33 for hop_edge_types, count in zip(meta_pattern, counts):34 neighbors, _, _ = euler_ops.sample_neighbor(35 last_neighbors, [hop_edge_types], count, default_node=default_node)36 last_neighbors = tf.reshape(neighbors, [-1])37 neighbors = tf.reshape(neighbors, [-1, counts[0]])38 pattern_neighbors = tf.concat([pattern_neighbors, neighbors], axis=-1)39 all_neighbors.append(pattern_neighbors)40 all_nodes = [nodes] * len(patterns)41 return all_nodes, all_neighbors ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful