ReForma 0.28__tar.gz → 0.30__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ReForma
3
- Version: 0.28
3
+ Version: 0.30
4
4
  Summary: Python bindings for the RePA/ReForma probabilistic automaton tool
5
5
  Author-email: Joshua Dourado <joshuadourado@ua.pt>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ReForma
3
- Version: 0.28
3
+ Version: 0.30
4
4
  Summary: Python bindings for the RePA/ReForma probabilistic automaton tool
5
5
  Author-email: Joshua Dourado <joshuadourado@ua.pt>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ReForma"
7
- version = "0.28"
7
+ version = "0.30"
8
8
  description = "Python bindings for the RePA/ReForma probabilistic automaton tool"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -360,8 +360,10 @@ class ReForma:
360
360
  raw = self._bridge.list_transitions(self._model.source, self._history)
361
361
  next_state = self._parse_simulation(raw)
362
362
 
363
+ resolved_states = next_state.current_states if next_state.current_states else self._state.current_states
364
+
363
365
  self._state = SimulationState(
364
- current_states=next_state.current_states,
366
+ current_states=resolved_states,
365
367
  enabled=next_state.enabled,
366
368
  variables=next_state.variables,
367
369
  can_undo=len(self._history) > 0,
@@ -872,11 +874,11 @@ class ReForma:
872
874
  import re
873
875
 
874
876
  for line in lines:
875
- if line.startswith("Estado Atual:"):
877
+ if line.startswith("Estado Atual:") or line.startswith("Current State:"):
876
878
  st_parts = line.split(":", 1)[1].strip()
877
879
  current_states = [s.strip() for s in st_parts.split(",")]
878
880
 
879
- elif line.startswith("Variaveis:"):
881
+ elif line.startswith("Variaveis:") or line.startswith("Variables:"):
880
882
  var_parts = line.split(":", 1)[1].strip()
881
883
  matches = re.finditer(r"([a-zA-Z0-9_]+)\s*=\s*(?:VInt\(\s*([^,)]+)|VFloat\(\s*([^,)]+)|VBool\(\s*([^,)]+)|([^,]+))", var_parts)
882
884
 
@@ -894,7 +896,7 @@ class ReForma:
894
896
  variables[k] = val_str
895
897
 
896
898
  m = re.match(
897
- r"\s*-\s*\[(.+?)\]\s+de\s+(\S+)\s+para\s+(\S+)\s+\(P=([\d.,]+)\)",
899
+ r"\s*-\s*\[(.+?)\]\s+(?:de|from)\s+(\S+)\s+(?:para|to)\s+(\S+)\s+\(P=([\d.,]+)\)",
898
900
  line,
899
901
  )
900
902
  if m:
@@ -99,13 +99,15 @@ class JarBridge:
99
99
  Run: java -jar <jar> <args...>
100
100
  Returns stdout. Raises JarError on non-zero exit.
101
101
  """
102
- cmd = [self.java_bin, "-jar", self.jar_path, *args]
102
+ # Forçamos o Java a usar UTF-8 no Windows
103
+ cmd = [self.java_bin, "-Dfile.encoding=UTF-8", "-jar", self.jar_path, *args]
103
104
  result = subprocess.run(
104
105
  cmd,
105
106
  input=stdin_data,
106
107
  capture_output=True,
107
108
  text=True,
108
109
  encoding="utf-8",
110
+ errors="replace"
109
111
  )
110
112
  if result.returncode != 0:
111
113
  raise JarError(
@@ -179,12 +181,13 @@ class JarBridge:
179
181
  Reads and returns the content of this output file.
180
182
  JAR progress/logs go to stderr — ignored here.
181
183
  """
182
- cmd = [self.java_bin, "-jar", self.jar_path, *args]
184
+ cmd = [self.java_bin, "-Dfile.encoding=UTF-8", "-jar", self.jar_path, *args]
183
185
  result = subprocess.run(
184
186
  cmd,
185
187
  capture_output=True,
186
188
  text=True,
187
189
  encoding="utf-8",
190
+ errors="replace"
188
191
  )
189
192
  if result.returncode != 0:
190
193
  raise JarError(
@@ -196,7 +199,7 @@ class JarBridge:
196
199
  f"JAR did not generate the expected output file: {out_path}\n"
197
200
  f"stderr: {result.stderr.strip()}"
198
201
  )
199
- with open(out_path, "r", encoding="utf-8") as f:
202
+ with open(out_path, "r", encoding="utf-8", errors="replace") as f:
200
203
  return f.read()
201
204
 
202
205
  def merge_models(self, sourceA: str, sourceB: str, op_type: str, agg: str) -> str:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes