This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import baron | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/users/ppx/python/baron-master/baron3/baron.py", line 10, in <module> | |
from grammator import generate_parse | |
File "/users/ppx/python/baron-master/baron3/grammator.py", line 2, in <module> | |
from parser import BaronParserGenerator | |
File "/users/ppx/python/baron-master/baron3/parser.py", line 4, in <module> | |
import tempfile | |
File "/celestite/projects/cso-cpcc/Python/lib/python3.3/tempfile.py", line 30, in <module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import baron | |
def test_file(path): | |
with open(path, 'r') as f: | |
content = f.read() | |
valid = content == baron.dumps(baron.parse(content)) | |
print(path,' is valid? ',valid) | |
def main(): | |
test_file('baron-master/baron2/parser.py') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
======================================== test session starts ========================================= | |
platform linux -- Python 3.3.0 -- py-1.4.20 -- pytest-2.5.2 | |
collected 792 items | |
tests/test_base.py . | |
tests/test_dumper.py ............................................................................................................................. | |
tests/test_formatting_grouper.py ............................................................................................................................................................................... | |
tests/test_grammator.py .................................. | |
tests/test_grammator_control_structures.py .................... | |
tests/test_grammator_data_structures.py ................................... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python3 test-readprofile.py | |
Tue Apr 8 17:35:52 2014 test-profile | |
140495070 function calls (140454591 primitive calls) in 1561.324 seconds | |
Ordered by: internal time | |
List reduced from 442 to 10 due to restriction <10> | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
2679 1312.656 0.490 1547.644 0.578 /users/ppx/python/baron-master/baron/utils.py:61(grab_string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> r = RedBaron("c = 2 = 1") | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/users/ppx/python/redbaron-master/redbaron.py", line 491, in __init__ | |
self.data = [to_node(x, parent=self, on_attribute="root") for x in baron.parse(source_code)] | |
File "/users/ppx/python/baron-master/baron/baron.py", line 41, in parse | |
print_function_finder.visit(python_ast_parse(source_code)) | |
File "/celestite/projects/cso-cpcc/Python/lib/python3.3/ast.py", line 35, in parse | |
return compile(source, filename, mode, PyCF_ONLY_AST) | |
File "<unknown>", line 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/test_dumper.py b/tests/test_dumper.py | |
index f85b9bb..c03462f 100644 | |
--- a/tests/test_dumper.py | |
+++ b/tests/test_dumper.py | |
@@ -69,11 +69,11 @@ def test_from_import_special_notation(): | |
def test_print_empty(): | |
- check_dumps("print") | |
+ check_dumps("print()") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From df9fce4f690766dfa60ff072f04b3ea0ad5164fc Mon Sep 17 00:00:00 2001 | |
From: Pierre Penninckx | |
Date: Mon, 7 Apr 2014 17:57:42 +0200 | |
Subject: [PATCH 1/3] make it interpretable by python3 | |
Nearly untouched output by running 2to3 on all baron's sources. | |
--- | |
baron/__init__.py | 8 +- | |
baron/baron.py | 16 +-- | |
baron/dumper.py | 4 +- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tests/test_base.py F | |
================================================================================================= FAILURES ================================================================================================= | |
_____________________________________________________________________________________________ test_dummy_parse _____________________________________________________________________________________________ | |
def test_dummy_parse(): | |
> parse("pouet") | |
tests/test_base.py:5: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rendering_dictionnary = { | |
"assignment": [ | |
("key", "target" ), | |
("list", "first_formatting" ), | |
("key", "operator" ), # ceci devrait être optionnel | |
("constant", "=" ), | |
("list", "second_formatting"), | |
("key", "value" ) | |
], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from baron.rendering_dictionnary import rendering_dictionnary as d | |
from baron.dumper import dumps | |
import json | |
class Position: | |
def __init__(self, line, column): | |
self.line = line | |
self.column = column |
OlderNewer