Пример #1
0
 def test_nor(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line(
         "If Tommy is nobody nor Billy is nobody\n")
     self.assertEqual(py_line, "if not Tommy == False or Billy == False:\n")
Пример #2
0
 def test_divide_numbers(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put 1 over 3 into my pocket\n')
     self.assertEqual(py_line, 'my_pocket = 1 / 3\n')
Пример #3
0
 def test_decrement(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Knock the hate down\n')
     self.assertEqual(py_line, 'the_hate -= 1\n')
Пример #4
0
 def test_subtract_numbers(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put 1 minus 3 into my pocket\n')
     self.assertEqual(py_line, 'my_pocket = 1 - 3\n')
Пример #5
0
 def test_multiply_numbers(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put 1 times 3 into my pocket\n')
     self.assertEqual(py_line, 'my_pocket = 1 * 3\n')
Пример #6
0
 def test_put_into_poetic_assigns_variable(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put a flower into the vase\n')
     self.assertEqual(py_line, 'the_vase = a_flower\n')
Пример #7
0
 def test_put_into_numeric(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put 3.14 into PI\n')
     self.assertEqual(py_line, 'PI = 3.14\n')
Пример #8
0
 def test_is_numeric(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Seven is 11\n')
     self.assertEqual(py_line, 'Seven = 11\n')
Пример #9
0
 def test_is_numeric_with_dot(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('X is 1.23\n')
     self.assertEqual(py_line, 'X = 1.23\n')
Пример #10
0
 def test_proper_variables(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line(
         "Master Of The Universe is nothing\n")
     self.assertEqual(py_line, "Master_Of_The_Universe = False\n")
Пример #11
0
        logger.info("Received modified event - %s." % event.src_path)
        # TODO check its the right file ??

        for func in watches:
            sFuncPath = os.path.abspath(func)
            sSrcPath = os.path.abspath(event.src_path)
            #print(sFuncPath, sSrcPath)
            if sFuncPath == sSrcPath:
                watches[func]()


some = FileSystemEventHandler()
some.on_any_event = dosomat
observer.schedule(some, ".")

transpiler = Transpiler()


def extract(dct, namespace=None):
    if not namespace: namespace = globals()
    namespace.update(dct)


def rockstar(text, namespace=None, printname=None):
    if (os.path.isfile(text)):
        rsf(text, namespace, printname)
    else:
        rs(text, namespace, printname)


def _rsf(filename, namespace=None, printname=None):
Пример #12
0
 def test_compund_addition_assignment(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line("Let X be with 10\n")
     self.assertEqual(py_line, "X += 10\n")
Пример #13
0
 def test_add_poetic(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line(
         "Put this with that into my pocket\n")
     self.assertEqual(py_line, "my_pocket = this + that\n")
Пример #14
0
 def test_add_numbers(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line("Put 1 plus 3 into my pocket\n")
     self.assertEqual(py_line, "my_pocket = 1 + 3\n")
Пример #15
0
 def test_let_be_string(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Let the letter be "R"\n')
     self.assertEqual(py_line, 'the_letter = "R"\n')
Пример #16
0
 def test_is_poetic_with_dot(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('My dreams were ice. A life unfulfilled; wakin\' everybody up, taking booze and pills\n')
     self.assertEqual(py_line, 'my_dreams = 3.1415926535\n')
Пример #17
0
 def test_put_into_bool(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put nothing into my hand\n')
     self.assertEqual(py_line, 'my_hand = False\n')
Пример #18
0
 def test_is_poetic_and_numeric(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Car is 4 W D\n')
     self.assertEqual(py_line, 'Car = 411\n')
Пример #19
0
 def test_is_bool(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Life is ok\n')
     self.assertEqual(py_line, 'Life = True\n')
Пример #20
0
 def test_is_poetic_keyword(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Tommy was without\n')
     self.assertEqual(py_line, 'Tommy = 7\n')
Пример #21
0
 def test_put_into_string(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put "letter" into the envelope\n')
     self.assertEqual(py_line, 'the_envelope = "letter"\n')
Пример #22
0
 def test_is_string(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Message is "Hello"\n')
     self.assertEqual(py_line, 'Message = "Hello"\n')
Пример #23
0
 def test_subtract_poetic(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put this without that into my pocket\n')
     self.assertEqual(py_line, 'my_pocket = this - that\n')
Пример #24
0
 def test_let_be_bool(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Let my beer be empty\n')
     self.assertEqual(py_line, 'my_beer = False\n')
Пример #25
0
 def test_multiply_poetic(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put this of that into my pocket\n')
     self.assertEqual(py_line, 'my_pocket = this * that\n')
Пример #26
0
 def test_let_be_poetic(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Let Stuart be a yellow Minion\n')
     self.assertEqual(py_line, 'Stuart = 166\n')
Пример #27
0
 def test_divide_poetic(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Put this over that into my pocket\n')
     self.assertEqual(py_line, 'my_pocket = this / that\n')
Пример #28
0
 def test_let_be_numeric(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Let One be 0\n')
     self.assertEqual(py_line, 'One = 0\n')
Пример #29
0
 def test_increment(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line('Build my money up\n')
     self.assertEqual(py_line, 'my_money += 1\n')
Пример #30
0
 def test_aint(self):
     transpiler = Transpiler()
     py_line = transpiler.transpile_line("If Tommy ain't nobody\n")
     self.assertEqual(py_line, "if Tommy != False:\n")