mumuki-python-runner 1.6.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0275bf8b0f0c205ce0e5ceda01999f39a417013d9490750b91cf3b88ca57e437
4
- data.tar.gz: d1ca4344541694ca5ed8ef244943f5e4fb1f8df94fac3d7cefc271c79db9608c
3
+ metadata.gz: '039cd7e8daf34032853b80ad08223b1af629432395e1036d0c141bcd2a81cb4c'
4
+ data.tar.gz: eb45b266b689d2d13a18d54a1815a6d2f1b5d255c0dea700f67a17b5a34a5b40
5
5
  SHA512:
6
- metadata.gz: 46f823c0f7034521637dd08853948ef34e114fd11be5fbd6293ad264a4318a42a764b3709f237a45b8b5ad90755ff28b9c3cbcd14af480320ffb71c60c76fa72
7
- data.tar.gz: 78517e84935997c70ab4c8ff24728caf909c9f4e1109b031f33f5ec80ecb6165557d6150bcb9dd8f399f7642bcfc4c33f8f1d6e1ea8ecc4e252b388e7953676e
6
+ metadata.gz: a154c8202c04203bfd5a577d2a70d407ebfd98f24a3050fc524f97bbcb60c724f6944fd613911869160418590a80acf9abdf0aef3dd5b3a7e41904e752cb41f7
7
+ data.tar.gz: b609e0a9fa6624bb99e1e3b5a2db1ed63d5c131af554feee56e488eb6da67fcfb41abe607a8d2ada3ef0dbd38cfd583be8503388bcb1c658408cf64281b26dbc
@@ -27,7 +27,19 @@ python
27
27
  if query.match /print *(\(| ).*|^[a-zA-Z_]\w*\s*=[^=].*|^raise\b/
28
28
  query
29
29
  else
30
- "print(string.Template(\"#{output_prefix}\${mumuki_query_result}\").safe_substitute(mumuki_query_result = #{query}))"
30
+ <<~python
31
+ __mumuki_error__ = None
32
+ try:
33
+ __mumuki_args__ = {'mumuki_query_result': eval("""#{query.gsub('"', '\"')}""")}
34
+ print(string.Template(\"#{output_prefix}\${mumuki_query_result}\").safe_substitute(**__mumuki_args__))
35
+ except SyntaxError as e:
36
+ __mumuki_error__ = SyntaxError(e.msg, ('<console>', e.lineno, e.offset, e.text))
37
+ if __mumuki_error__:
38
+ print(__mumuki_error__.text)
39
+ print(" "*(__mumuki_error__.offset - 1) + "^")
40
+ print('SyntheticMumukiSyntaxError: SyntaxError: ' + str(__mumuki_error__))
41
+ exit(1)
42
+ python
31
43
  end
32
44
  end
33
45
 
@@ -53,7 +65,7 @@ python
53
65
  end
54
66
 
55
67
  def syntax_error_regexp
56
- /\A File .*\n(?m)(?=.*(SyntaxError|IndentationError))/
68
+ /(SyntheticMumukiSyntaxError: )|(\A File .*\n(?m)(?=.*(SyntaxError|IndentationError)))/
57
69
  end
58
70
  end
59
71
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module BasePythonVersionHook
3
- VERSION = '1.6.1'
3
+ VERSION = '1.7.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-python-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-07 00:00:00.000000000 Z
11
+ date: 2020-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit