Python lib2to3.pygram.python_grammar_no_print_statement() Examples
The following are 30
code examples of lib2to3.pygram.python_grammar_no_print_statement().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
lib2to3.pygram
, or try the search function
.
Example #1
Source File: __init__.py From retype with MIT License | 6 votes |
def lib2to3_parse(src_txt): """Given a string with source, return the lib2to3 Node.""" grammar = pygram.python_grammar_no_print_statement drv = driver.Driver(grammar, pytree.convert) if src_txt[-1] != "\n": nl = "\r\n" if "\r\n" in src_txt[:1024] else "\n" src_txt += nl try: result = drv.parse_string(src_txt, True) except ParseError as pe: lineno, column = pe.context[1] lines = src_txt.splitlines() try: faulty_line = lines[lineno - 1] except IndexError: faulty_line = "<line number missing in source>" raise ValueError(f"Cannot parse: {lineno}:{column}: {faulty_line}") from None if isinstance(result, Leaf): result = Node(syms.file_input, [result]) return result
Example #2
Source File: test_fixers.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #3
Source File: test_refactor.py From datafari with Apache License 2.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #4
Source File: test_fixers.py From datafari with Apache License 2.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #5
Source File: test_refactor.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #6
Source File: test_fixers.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #7
Source File: test_refactor.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #8
Source File: test_fixers.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #9
Source File: test_refactor.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertTrue(rt.grammar is pygram.python_grammar_no_print_statement) self.assertTrue(rt.driver.grammar is pygram.python_grammar_no_print_statement)
Example #10
Source File: test_fixers.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #11
Source File: test_refactor.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertTrue(rt.grammar is pygram.python_grammar_no_print_statement) self.assertTrue(rt.driver.grammar is pygram.python_grammar_no_print_statement)
Example #12
Source File: test_fixers.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #13
Source File: test_refactor.py From android_universal with MIT License | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #14
Source File: test_fixers.py From android_universal with MIT License | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #15
Source File: test_refactor.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertTrue(rt.grammar is pygram.python_grammar_no_print_statement) self.assertTrue(rt.driver.grammar is pygram.python_grammar_no_print_statement)
Example #16
Source File: test_fixers.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #17
Source File: test_refactor.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertTrue(rt.grammar is pygram.python_grammar_no_print_statement) self.assertTrue(rt.driver.grammar is pygram.python_grammar_no_print_statement)
Example #18
Source File: test_fixers.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #19
Source File: test_fixers.py From oss-ftp with MIT License | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #20
Source File: test_fixers.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #21
Source File: test_refactor.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #22
Source File: test_fixers.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #23
Source File: test_refactor.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #24
Source File: test_fixers.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #25
Source File: test_refactor.py From Computable with MIT License | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertTrue(rt.grammar is pygram.python_grammar_no_print_statement) self.assertTrue(rt.driver.grammar is pygram.python_grammar_no_print_statement)
Example #26
Source File: test_fixers.py From Computable with MIT License | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #27
Source File: test_refactor.py From oss-ftp with MIT License | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #28
Source File: test_refactor.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)
Example #29
Source File: test_libfuturize_fixers.py From kgsgo-dataset-preprocessor with Mozilla Public License 2.0 | 5 votes |
def test_idempotency_print_as_function(self): self.refactor.driver.grammar = pygram.python_grammar_no_print_statement s = """print(1, 1+1, 1+1+1)""" self.unchanged(s) s = """print()""" self.unchanged(s) s = """print('')""" self.unchanged(s)
Example #30
Source File: test_refactor.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_print_function_option(self): rt = self.rt({"print_function" : True}) self.assertIs(rt.grammar, pygram.python_grammar_no_print_statement) self.assertIs(rt.driver.grammar, pygram.python_grammar_no_print_statement)