salabim 24.0.10.post7__tar.gz → 24.0.11.post0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/PKG-INFO +1 -1
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/pyproject.toml +1 -1
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim/salabim.py +33 -42
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim.egg-info/PKG-INFO +1 -1
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/README.md +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim/DejaVuSansMono.ttf +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim/LICENSE.txt +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim/__init__.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim/calibri.ttf +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim/mplus-1m-regular.ttf +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim.egg-info/SOURCES.txt +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim.egg-info/dependency_links.txt +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/salabim.egg-info/top_level.txt +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/setup.cfg +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test salabim.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_cap_now.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_componentgenerator.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_datetime.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_distributions.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_misc.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_monitor.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_process.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_queue.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_state.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_store.py +0 -0
- {salabim-24.0.10.post7 → salabim-24.0.11.post0}/tests/test_timeunit.py +0 -0
@@ -8,7 +8,7 @@ authors = [
|
|
8
8
|
{name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com"}
|
9
9
|
]
|
10
10
|
description = "salabim - discrete event simulation in Python"
|
11
|
-
version = "24.0.
|
11
|
+
version = "24.0.11-0"
|
12
12
|
readme = "README.md"
|
13
13
|
requires-python = ">=3.7"
|
14
14
|
dependencies = [
|
@@ -1,13 +1,13 @@
|
|
1
|
-
# _ _ _ ____ _ _ ___ _
|
2
|
-
# ___ __ _ | | __ _ | |__ (_) _ __ ___ |___ \ | || | / _ \ / |
|
3
|
-
# / __| / _` || | / _` || '_ \ | || '_ ` _ \ __) || || |_ | | | | | || |
|
4
|
-
# \__ \| (_| || || (_| || |_) || || | | | | | / __/ |__ _| _ | |_| | _ | || |
|
5
|
-
# |___/ \__,_||_| \__,_||_.__/ |_||_| |_| |_| |_____| |_| (_) \___/ (_)|_|
|
1
|
+
# _ _ _ ____ _ _ ___ _ _
|
2
|
+
# ___ __ _ | | __ _ | |__ (_) _ __ ___ |___ \ | || | / _ \ / |/ |
|
3
|
+
# / __| / _` || | / _` || '_ \ | || '_ ` _ \ __) || || |_ | | | | | || |
|
4
|
+
# \__ \| (_| || || (_| || |_) || || | | | | | / __/ |__ _| _ | |_| | _ | || |
|
5
|
+
# |___/ \__,_||_| \__,_||_.__/ |_||_| |_| |_| |_____| |_| (_) \___/ (_)|_||_|
|
6
6
|
# discrete event simulation
|
7
7
|
#
|
8
8
|
# see www.salabim.org for more information, the documentation and license information
|
9
9
|
|
10
|
-
__version__ = "24.0.
|
10
|
+
__version__ = "24.0.11"
|
11
11
|
|
12
12
|
import heapq
|
13
13
|
import random
|
@@ -60,9 +60,8 @@ PyDroid = sys.platform == "linux" and any("pydroid" in v for v in os.environ.val
|
|
60
60
|
PyPy = platform.python_implementation() == "PyPy"
|
61
61
|
Chromebook = "penguin" in platform.uname()
|
62
62
|
PythonInExcel = not ("__file__" in globals())
|
63
|
-
AnacondaCode=
|
63
|
+
AnacondaCode = sys.platform=="emscripten"
|
64
64
|
|
65
|
-
my_globals=globals()
|
66
65
|
|
67
66
|
def a_log(*args):
|
68
67
|
if not hasattr(a_log, "a_logfile_name"):
|
@@ -77,7 +76,7 @@ def a_log(*args):
|
|
77
76
|
class g: ...
|
78
77
|
|
79
78
|
|
80
|
-
if
|
79
|
+
if PythonInExcel or AnacondaCode:
|
81
80
|
_pie_result = []
|
82
81
|
|
83
82
|
def pie_result():
|
@@ -856,7 +855,7 @@ class Monitor:
|
|
856
855
|
stop += self.env._offset
|
857
856
|
stop_action = "b" # non inclusive
|
858
857
|
if self.env._animate:
|
859
|
-
stop=min(stop,self.env._t)
|
858
|
+
stop = min(stop, self.env._t)
|
860
859
|
else:
|
861
860
|
stop = min(stop, self.env._now - self.env._offset) # not self.now() in order to support frozen monitors
|
862
861
|
actions.append((start, "a", 0, 0))
|
@@ -891,21 +890,20 @@ class Monitor:
|
|
891
890
|
|
892
891
|
enabled = False
|
893
892
|
if self.env._animate:
|
894
|
-
_x=self._x[:]
|
895
|
-
_t=self._t[:]
|
893
|
+
_x = self._x[:]
|
894
|
+
_t = self._t[:]
|
896
895
|
if self._x:
|
897
896
|
_x.append(self._x[-1])
|
898
897
|
_t.append(self.env._t)
|
899
|
-
if isinstance(self._weight,bool):
|
900
|
-
_weight=self._weight
|
898
|
+
if isinstance(self._weight, bool):
|
899
|
+
_weight = self._weight
|
901
900
|
else:
|
902
|
-
_weight=self._weight[:]
|
901
|
+
_weight = self._weight[:]
|
903
902
|
_weight.append(self._weight[-1])
|
904
903
|
else:
|
905
|
-
_x=self._x
|
906
|
-
_t=self._t
|
907
|
-
_weight=self._weight
|
908
|
-
|
904
|
+
_x = self._x
|
905
|
+
_t = self._t
|
906
|
+
_weight = self._weight
|
909
907
|
|
910
908
|
if self.env._animate:
|
911
909
|
if self._x:
|
@@ -914,10 +912,8 @@ class Monitor:
|
|
914
912
|
try:
|
915
913
|
_weight.append(self.weight[-1])
|
916
914
|
except AttributeError:
|
917
|
-
...
|
918
|
-
for t, type, x, weight in heapq.merge(
|
919
|
-
actions, zip(self._t, itertools.repeat("c"), _x, _weight if (_weight and not self._level) else (1,) * len(_x))
|
920
|
-
):
|
915
|
+
... # ignore if bool
|
916
|
+
for t, type, x, weight in heapq.merge(actions, zip(self._t, itertools.repeat("c"), _x, _weight if (_weight and not self._level) else (1,) * len(_x))):
|
921
917
|
if new._level:
|
922
918
|
if type == "a":
|
923
919
|
enabled = True
|
@@ -10209,7 +10205,7 @@ class Environment:
|
|
10209
10205
|
self.stopped = False
|
10210
10206
|
self._paused = False
|
10211
10207
|
self.last_s0 = ""
|
10212
|
-
if
|
10208
|
+
if PythonInExcel or AnacondaCode:
|
10213
10209
|
self._blind_animation = True
|
10214
10210
|
else:
|
10215
10211
|
self._blind_animation = blind_animation
|
@@ -11504,7 +11500,7 @@ class Environment:
|
|
11504
11500
|
if self._video_pingpong:
|
11505
11501
|
self._images.extend(self._images[::-1])
|
11506
11502
|
if self._video_repeat == 1: # in case of repeat == 1, loop should not be specified (otherwise, it might show twice)
|
11507
|
-
if
|
11503
|
+
if PythonInExcel or AnacondaCode: # ***
|
11508
11504
|
with b64_file_handler(self._video_name, mode="b", result=_pie_result) as f:
|
11509
11505
|
self._images[0].save(
|
11510
11506
|
f,
|
@@ -11525,7 +11521,7 @@ class Environment:
|
|
11525
11521
|
optimize=False,
|
11526
11522
|
)
|
11527
11523
|
else:
|
11528
|
-
if
|
11524
|
+
if PythonInExcel or AnacondaCode: # ***
|
11529
11525
|
with b64_file_handler(self._video_name, mode="b", result=_pie_result) as f:
|
11530
11526
|
self._images[0].save(
|
11531
11527
|
f,
|
@@ -13114,7 +13110,7 @@ class Environment:
|
|
13114
13110
|
mode = "RGB"
|
13115
13111
|
else:
|
13116
13112
|
raise ValueError("extension " + extension + " not supported")
|
13117
|
-
if
|
13113
|
+
if PythonInExcel or AnacondaCode:
|
13118
13114
|
with b64_file_handler(str(filename), mode="b", result=_pie_result) as f:
|
13119
13115
|
format = "jpeg" if extension == ".jpg" else extension[1:]
|
13120
13116
|
self._capture_image(mode, video_mode).save(f, format=format)
|
@@ -14139,7 +14135,7 @@ class Environment:
|
|
14139
14135
|
self._print_legend(iref)
|
14140
14136
|
|
14141
14137
|
def _print_legend(self, ref):
|
14142
|
-
if
|
14138
|
+
if PythonInExcel or AnacondaCode:
|
14143
14139
|
return
|
14144
14140
|
if ref:
|
14145
14141
|
s = "line numbers prefixed by " + chr(ord("A") + ref - 1) + " refer to"
|
@@ -14157,7 +14153,7 @@ class Environment:
|
|
14157
14153
|
return self.filename_lineno_to_str(frameinfo.filename, frameinfo.lineno)
|
14158
14154
|
|
14159
14155
|
def filename_lineno_to_str(self, filename, lineno):
|
14160
|
-
if
|
14156
|
+
if PythonInExcel or AnacondaCode:
|
14161
14157
|
return "n/a"
|
14162
14158
|
if Path(filename).name == Path(__file__).name: # internal salabim address
|
14163
14159
|
return "n/a"
|
@@ -24264,7 +24260,7 @@ def _set_name(name, _nameserialize, object):
|
|
24264
24260
|
|
24265
24261
|
@functools.lru_cache()
|
24266
24262
|
def _screen_dimensions():
|
24267
|
-
if
|
24263
|
+
if PythonInExcel or AnacondaCode:
|
24268
24264
|
return 1024, 768
|
24269
24265
|
if Pythonista:
|
24270
24266
|
screen_width, screen_height = ui.get_screen_size()
|
@@ -26280,7 +26276,7 @@ def _std_fonts():
|
|
26280
26276
|
|
26281
26277
|
|
26282
26278
|
def fonts():
|
26283
|
-
if
|
26279
|
+
if PythonInExcel or AnacondaCode:
|
26284
26280
|
return []
|
26285
26281
|
if not hasattr(fonts, "font_list"):
|
26286
26282
|
fonts.font_list = []
|
@@ -26946,6 +26942,7 @@ def reset() -> None:
|
|
26946
26942
|
g.tkinter_loaded = "?"
|
26947
26943
|
g.image_container_cache = {}
|
26948
26944
|
g._default_cap_now = False
|
26945
|
+
g._captured_stdout=[]
|
26949
26946
|
|
26950
26947
|
random_seed() # always start with seed 1234567
|
26951
26948
|
|
@@ -27003,15 +27000,11 @@ Environment.{name}.__doc__ = {name}.__doc__"""
|
|
27003
27000
|
exec(f"Environment.{name}={name}")
|
27004
27001
|
|
27005
27002
|
|
27006
|
-
_captured_store = []
|
27007
|
-
|
27008
|
-
|
27009
27003
|
def clear_captured_stdout():
|
27010
27004
|
"""
|
27011
27005
|
empties the captured stdout
|
27012
27006
|
"""
|
27013
|
-
|
27014
|
-
_captured_store.clear()
|
27007
|
+
g._captured_stdout.clear()
|
27015
27008
|
|
27016
27009
|
|
27017
27010
|
def captured_stdout_as_str() -> str:
|
@@ -27023,7 +27016,7 @@ def captured_stdout_as_str() -> str:
|
|
27023
27016
|
captured stdout : str
|
27024
27017
|
"""
|
27025
27018
|
|
27026
|
-
return "".join(
|
27019
|
+
return "".join(g._captured_stdout)
|
27027
27020
|
|
27028
27021
|
|
27029
27022
|
def captured_stdout_as_file(file: Union[str, Path, "file"], mode: str = None):
|
@@ -27101,16 +27094,14 @@ class capture_stdout:
|
|
27101
27094
|
sys.stdout = self.stdout
|
27102
27095
|
|
27103
27096
|
def write(self, data):
|
27104
|
-
|
27105
|
-
_captured_store.append(data)
|
27097
|
+
g._captured_stdout.append(data)
|
27106
27098
|
if self.include_print:
|
27107
27099
|
self.stdout.write(data)
|
27108
27100
|
|
27109
27101
|
def flush(self):
|
27110
|
-
global _captured_store
|
27111
27102
|
if self.include_print:
|
27112
27103
|
self.stdout.flush()
|
27113
|
-
|
27104
|
+
g._captured_stdout.append("\n")
|
27114
27105
|
|
27115
27106
|
|
27116
27107
|
class redirect_stdout:
|
@@ -27168,7 +27159,7 @@ class redirect_stdout:
|
|
27168
27159
|
self.close()
|
27169
27160
|
|
27170
27161
|
def write(self, data):
|
27171
|
-
global
|
27162
|
+
global _captured_stdout
|
27172
27163
|
self.file.write(data)
|
27173
27164
|
if self.include_print:
|
27174
27165
|
self.stdout.write(data)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|