We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30440dd commit ca6e4eeCopy full SHA for ca6e4ee
python150k/preprocess.py
@@ -316,14 +316,20 @@ def retrieve_functions_docstrings(
316
317
318
def convert_tokens_to_ast(functions):
319
+ global error_counter
320
ast_tokens = []
321
for function in functions:
322
if len(function) == 0:
323
# Happens after returned TokenError
324
# Empty function should be skipped
325
continue
- ast_fun_tokens = json.loads(parse_python3.parse_file(function, "code"))
326
- ast_fun_sequential = get_dfs(convert(ast_fun_tokens))
+ # One more option to get an error
327
+ try:
328
+ ast_fun_tokens = json.loads(parse_python3.parse_file(function, "code"))
329
+ ast_fun_sequential = get_dfs(convert(ast_fun_tokens))
330
+ except SyntaxError:
331
+ error_counter += 1
332
+ continue
333
ast_tokens.append(ast_fun_sequential)
334
return ast_tokens
335
0 commit comments