Ejemplo n.º 1
0
 def test_pickle_diff_str(self):
     dumped = Examples.pickle_seria.dumps(Examples.difference)
     loaded = Examples.pickle_seria.loads(dumped)
     self.assertEqual(loaded(2, 8), Examples.difference(2, 8))
     self.assertEqual(loaded(17.2, 13.5), Examples.difference(17.2, 13.5))
     self.assertNotEqual(loaded(10, 8), Examples.difference(1, 5))
     self.assertRaises(TypeError, lambda: loaded("pickle", "error"))
Ejemplo n.º 2
0
 def test_json_diff_file(self):
     Examples.json_seria.dump(Examples.difference)
     loaded = Examples.json_seria.load()
     self.assertEqual(loaded(3, -5), Examples.difference(3, -5))
     self.assertEqual(loaded(12.1, 2.6), Examples.difference(12.1, 2.6))
     self.assertNotEqual(loaded(10, 8), Examples.difference(1, 5))
     self.assertRaises(TypeError, lambda: loaded("json", "error"))
Ejemplo n.º 3
0
 def test_json_diff_str(self):
     dumped = Examples.json_seria.dumps(Examples.difference)
     loaded = Examples.json_seria.loads(dumped)
     self.assertEqual(loaded(3, 45), Examples.difference(3, 45))
     self.assertEqual(loaded(14.2, 33.5), Examples.difference(14.2, 33.5))
     self.assertNotEqual(loaded(30, 4), Examples.difference(31, 25))
     self.assertRaises(TypeError, lambda: loaded("json", "error"))
Ejemplo n.º 4
0
 def test_pickle_triple_str(self):
     dumped = Examples.json_seria.dumps(Examples.triple)
     loaded = Examples.json_seria.loads(dumped)
     self.assertEqual(loaded(2), Examples.triple(2))
     self.assertEqual(loaded([1, 2, "check"]), Examples.triple([1, 2, "check"]))
     self.assertNotEqual(loaded(3), Examples.triple(1))
     self.assertEqual(loaded("ha"), "hahaha")
Ejemplo n.º 5
0
 def test_pickle_diff_file(self):
     Examples.pickle_seria.dump(Examples.difference)
     loaded = Examples.pickle_seria.load()
     self.assertEqual(loaded(16, -5), Examples.difference(16, -5))
     self.assertEqual(loaded(11, 2.6), Examples.difference(11, 2.6))
     self.assertNotEqual(loaded(10, 8), Examples.difference(1, 5))
     self.assertRaises(TypeError, lambda: loaded("pickle", "error"))
Ejemplo n.º 6
0
 def test_pickle_composite_file(self):
     Examples.json_seria.dump(Examples.composite)
     loaded = Examples.json_seria.load()
     self.assertEqual(loaded(2), Examples.composite(2))
     self.assertEqual(loaded([1, 2, "check"]), Examples.composite([1, 2, "check"]))
     self.assertNotEqual(loaded(3), Examples.composite(1))
     self.assertEqual(loaded("yes"), Examples.composite("yes"))
Ejemplo n.º 7
0
 def test_pickle_composite_str(self):
     dumped = Examples.json_seria.dumps(Examples.composite)
     loaded = Examples.json_seria.loads(dumped)
     self.assertEqual(loaded(2), Examples.composite(2))
     self.assertEqual(loaded([1, 2, "check"]), Examples.composite([1, 2, "check"]))
     self.assertNotEqual(loaded(3), Examples.composite(1))
     self.assertEqual(loaded("yes"), "yesyesyesyes")
Ejemplo n.º 8
0
 def test_json_sum_str(self):
     dumped = Examples.json_seria.dumps(Examples.summing)
     loaded = Examples.json_seria.loads(dumped)
     self.assertEqual(loaded(2, 8), Examples.summing(2, 8))
     self.assertEqual(loaded(17.2, 13.5), Examples.summing(17.2, 13.5))
     self.assertNotEqual(loaded(10, 8), Examples.summing(1, 5))
     self.assertRaises(TypeError, lambda: loaded("json", "error"))
Ejemplo n.º 9
0
 def test_yaml_sum_file(self):
     Examples.yaml_seria.dump(Examples.summing)
     loaded = Examples.yaml_seria.load()
     self.assertEqual(loaded(16, -5), Examples.summing(16, -5))
     self.assertEqual(loaded(11, 2.6), Examples.summing(11, 2.6))
     self.assertNotEqual(loaded(10, 8), Examples.summing(1, 5))
     self.assertRaises(TypeError, lambda: loaded("yaml", "error"))
Ejemplo n.º 10
0
 def test_toml_triple_str(self):
     dumped = Examples.json_seria.dumps(Examples.triple)
     loaded = Examples.json_seria.loads(dumped)
     self.assertEqual(loaded(2), Examples.triple(2))
     self.assertEqual(loaded(17.2), Examples.triple(17.2))
     self.assertNotEqual(loaded(3), Examples.triple(1))
     self.assertEqual(loaded("str"), Examples.triple("str"))
Ejemplo n.º 11
0
 def test_toml_sum_file(self):
     Examples.toml_seria.dump(Examples.summing)
     loaded = Examples.toml_seria.load()
     self.assertEqual(loaded(-124, 11), Examples.summing(-124, 11))
     self.assertEqual(loaded(11.2, 2.6), Examples.summing(11.2, 2.6))
     self.assertNotEqual(loaded(1, 8), Examples.summing(1, 0))
     self.assertRaises(TypeError, lambda: loaded("toml", "error"))
Ejemplo n.º 12
0
 def test_pickle_triple_file(self):
     Examples.json_seria.dump(Examples.triple)
     loaded = Examples.json_seria.load()
     self.assertEqual(loaded(2), Examples.triple(2))
     self.assertEqual(loaded([1, 2, "check"]), Examples.triple([1, 2, "check"]))
     self.assertNotEqual(loaded(3), Examples.triple(1))
     self.assertEqual(loaded("ha"), Examples.triple("ha"))
Ejemplo n.º 13
0
 def test_yaml_diff_str(self):
     dumped = Examples.yaml_seria.dumps(Examples.difference)
     loaded = Examples.yaml_seria.loads(dumped)
     self.assertEqual(loaded(2, 8), Examples.difference(2, 8))
     self.assertEqual(loaded(13.2, 13), Examples.difference(13.2, 13))
     self.assertNotEqual(loaded(10, 8), Examples.difference(1.6, 5))
     self.assertRaises(TypeError, lambda: loaded("yaml", "error"))
Ejemplo n.º 14
0
 def test_toml_diff_file(self):
     Examples.toml_seria.dump(Examples.difference)
     loaded = Examples.toml_seria.load()
     self.assertEqual(loaded(-12, 11), Examples.difference(-12, 11))
     self.assertEqual(loaded(1.2, 6.6), Examples.difference(1.2, 6.6))
     self.assertNotEqual(loaded(1, 8), Examples.difference(1, 0))
     self.assertRaises(TypeError, lambda: loaded("toml", "error"))
Ejemplo n.º 15
0
 def test_toml_scholarship_str(self):
     dumped = Examples.toml_seria.dumps(Examples.Scholarship)
     loaded = Examples.toml_seria.loads(dumped)
     parsed_obj = loaded("Anton")
     fig_obj = Examples.Scholarship("Lesha")
     self.assertEqual(parsed_obj.base(), fig_obj.base())
     self.assertEqual(parsed_obj.coefficient, fig_obj.coefficient)
     parsed_obj.coefficient = 1.6
     fig_obj.coefficient = 1.6
     self.assertEqual(parsed_obj.base(), fig_obj.base())
Ejemplo n.º 16
0
 def test_yaml_figure_file(self):
     Examples.yaml_seria.dump(Examples.Figure)
     loaded = Examples.yaml_seria.load()
     parsed_obj = loaded("ellipse")
     fig_obj = Examples.Figure("circle")
     self.assertEqual(parsed_obj.square(), fig_obj.square())
     self.assertEqual(parsed_obj.radius, fig_obj.radius)
     parsed_obj.radius = 10
     fig_obj.radius = 10
     self.assertEqual(parsed_obj.square(), fig_obj.square())
Ejemplo n.º 17
0
 def test_toml_figure_str(self):
     dumped = Examples.toml_seria.dumps(Examples.Figure)
     loaded = Examples.toml_seria.loads(dumped)
     parsed_obj = loaded("ellipse")
     fig_obj = Examples.Figure("circle")
     self.assertEqual(parsed_obj.square(), fig_obj.square())
     self.assertEqual(parsed_obj.radius, fig_obj.radius)
     parsed_obj.radius = 10
     fig_obj.radius = 10
     self.assertEqual(parsed_obj.square(), fig_obj.square())
Ejemplo n.º 18
0
 def test_yaml_scholarship_file(self):
     Examples.yaml_seria.dump(Examples.Scholarship)
     loaded = Examples.yaml_seria.load()
     parsed_obj = loaded("Anton")
     fig_obj = Examples.Scholarship("Lesha")
     self.assertEqual(parsed_obj.base(), fig_obj.base())
     self.assertEqual(parsed_obj.coefficient, fig_obj.coefficient)
     parsed_obj.coefficient = 1.6
     fig_obj.coefficient = 1.6
     self.assertEqual(parsed_obj.base(), fig_obj.base())
Ejemplo n.º 19
0
 def test_yaml_calc_file(self):
     Examples.yaml_seria.dump(Examples.calculate)
     loaded = Examples.yaml_seria.load()
     self.assertEqual(loaded(2), Examples.calculate(2))
     self.assertEqual(loaded(-4), Examples.calculate(-4))
     self.assertRaises(TypeError, lambda: loaded("2"))
Ejemplo n.º 20
0
 def test_yaml_calc_str(self):
     dumped = Examples.yaml_seria.dumps(Examples.calculate)
     loaded = Examples.yaml_seria.loads(dumped)
     self.assertEqual(loaded(2), Examples.calculate(2))
     self.assertEqual(loaded(-4), Examples.calculate(-4))
     self.assertRaises(TypeError, lambda: loaded("2"))
Ejemplo n.º 21
0

model = load_model('search_engine/show_example.h5') #

tokenizer = Tokenizer()

with open('search_engine/Word_Index.json', encoding='utf8') as json_file: #
    word_index = json.load(json_file)
    tokenizer.word_index = word_index

Input = sys.argv[1]

num = predict(Input)

#print(num)
examples = Examples.Examples()


if num == 1:
    sql = examples.ex1(Input)
elif num == 2:
    sql = examples.ex2(Input)
elif num == 3:
    sql = examples.ex3(Input)
elif num == 4:
    sql = examples.ex4(Input)
elif num == 5:
    sql = examples.ex5(Input)
elif num == 6:
    sql = examples.ex6(Input)
Ejemplo n.º 22
0
 def test_toml_calc_file(self):
     Examples.toml_seria.dump(Examples.calculate)
     loaded = Examples.toml_seria.load()
     self.assertEqual(loaded(1.2), Examples.calculate(1.2))
     self.assertEqual(loaded(0.2), Examples.calculate(0.2))
     self.assertRaises(TypeError, lambda: loaded("1.2"))
Ejemplo n.º 23
0
 def test_toml_calc_str(self):
     dumped = Examples.toml_seria.dumps(Examples.calculate)
     loaded = Examples.toml_seria.loads(dumped)
     self.assertEqual(loaded(1.2), Examples.calculate(1.2))
     self.assertEqual(loaded(0.2), Examples.calculate(0.2))
     self.assertRaises(TypeError, lambda: loaded("1.2"))
Ejemplo n.º 24
0
def start():
	cli = CommandLineInterface()
	if not cli.parse():
  		cli.print_usage()
  		return False;
      
	print( "*************************************************************************")
	print( "*************************************************************************")
	
	Globals.buildtools_directory_ = os.getcwd()
	Globals.root_directory_ = os.path.realpath(Globals.buildtools_directory_ + "/../")
	Globals.boost_source_directory_ = os.path.realpath(Globals.root_directory_ + "/Boost")
	Globals.build_directory_ = os.path.realpath(Globals.root_directory_ + "/Build/" + Globals.operating_system_ )
	Globals.boost_directory_ = os.path.realpath(Globals.build_directory_ + "/Boost")
	
	print('--> Directory: ' + Globals.root_directory_)

	if not os.path.exists(Globals.build_directory_):
		if not os.path.exists(Globals.root_directory_ + "/Build"):
			os.mkdir(Globals.root_directory_ + "/Build")
		os.mkdir(Globals.build_directory_)
	
	print( "--> Starting " + Globals.build_target_ + " Build")
	build_target = Globals.build_target_
	if build_target == "release":
		code_builder = Release()
		return code_builder.start()
	elif build_target == "archive":	
		archive_builder = Archiver()
		return archive_builder.start()
	elif build_target == "boost":
		code_builder = Boost()
		return code_builder.start()
	elif build_target == "documentation":
		documentation_builder = Documentation()
		return documentation_builder.start()
	elif build_target == "unittests":
		unit_tests = UnitTests()
		return unit_tests.start()
	elif build_target == "examples":
		examples = Examples()
		return examples.start()
	elif build_target == "clean":
		cleaner = Cleaner()
		return cleaner.clean()
	elif build_target == "rlibrary":
		rlibrary = RLibrary()
		return rlibrary.start()
	elif build_target == "rinstall":
		Globals.install_r_library = "true"
		rlibrary = RLibrary()
		return rlibrary.start()
	elif build_target == "installer":
		installer = Installer()
		return installer.start()
#	elif build_target == "deb":
#		deb_builder = DebBuilder()
#		return deb_builder.start(build_parameters)
	elif build_target == "version":
		version = Version()
		return version.create_version_header()
	return False # Default return from this, we didn't find a run mode
 def reload(self):
     Configuration.load_processor()
     html = MarkdownEditor.process_markdown(
         Examples.get_preview_markdown(Configuration.OPTIONS["processor"])
         )
     self.preview.show_preview(html)