Skip to content

Instantly share code, notes, and snippets.

@ibizaman
Created April 13, 2014 13:27
Show Gist options
  • Select an option

  • Save ibizaman/10584113 to your computer and use it in GitHub Desktop.

Select an option

Save ibizaman/10584113 to your computer and use it in GitHub Desktop.
tests/test_base.py F
================================================================================================= FAILURES =================================================================================================
_____________________________________________________________________________________________ test_dummy_parse _____________________________________________________________________________________________
def test_dummy_parse():
> parse("pouet")
tests/test_base.py:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
source_code = 'pouet\n', print_function = False
def parse(source_code, print_function=None):
if print_function is None:
print_function_finder = PrintFunctionImportFinder()
print_function_finder.visit(python_ast_parse(source_code))
print_function = print_function_finder.print_function
if source_code and source_code[-1] != "\n":
source_code += "\n"
to_return = _parse(tokenize(source_code, print_function), print_function)
> if to_return[-1]["type"] == "endl" and not to_return[-1]["formatting"]:
E TypeError: 'NoneType' object is not subscriptable
baron/baron.py:48: TypeError
--------------------------------------------------------------------------------------------- Captured stderr ----------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/vagrant/baron/baron/baron.py", line 23, in _parse
return parser(tokens)
File "/vagrant/baron/baron/grammator.py", line 694, in parse
tokens = map(lambda x: BaronToken(*x) if x else x, tokens) + [None]
TypeError: unsupported operand type(s) for +: 'map' and 'list'
unsupported operand type(s) for +: 'map' and 'list'
It is not normal that you see this error, it means that Baron has failed to parse valide python code. It would be kind if you can extract the snippet of your code that make Baron fails and open a bug here: https://github.com/Psycojoker/baron/issues
Sorry for the inconvinience.
========================================================================================= 1 failed in 0.43 seconds =========================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment