Skip to content

Commit

Permalink
Hotfix def-in-def return
Browse files Browse the repository at this point in the history
Cuando hay funciones definidas adentro de funciones
el parser falla porque toma el primer return como parte
de las definiciones de funciones.

Un parser más robusto usaría el AST, pero eso no está implementado.
Por ahora, el hotfix solo toma 'returns' que tengan un solo nivel
de indentación (asume que un nivel son 4 espacios).
  • Loading branch information
joangq committed Jun 13, 2024
1 parent 674b124 commit 1bc05b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data_transformers/consumer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse_source(source_code: str):
definitions = definitions[1:-1].map(str.rstrip)

convert_indices = definitions.which(has('@transformer.convert'))
return_indices = definitions.which(has('return'))
return_indices = definitions.which(lambda x: ' return' in x and not x.startswith(' '))

definitions_indices = convert_indices.zip(return_indices)

Expand Down

0 comments on commit 1bc05b9

Please sign in to comment.