salabim 24.0.10.post5__py3-none-any.whl → 24.0.11__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- salabim/salabim.py +31 -35
- {salabim-24.0.10.post5.dist-info → salabim-24.0.11.dist-info}/METADATA +1 -1
- salabim-24.0.11.dist-info/RECORD +10 -0
- salabim-24.0.10.post5.dist-info/RECORD +0 -10
- {salabim-24.0.10.post5.dist-info → salabim-24.0.11.dist-info}/WHEEL +0 -0
- {salabim-24.0.10.post5.dist-info → salabim-24.0.11.dist-info}/top_level.txt +0 -0
salabim/salabim.py
CHANGED
@@ -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="pyscript" in sys.modules
|
63
|
+
AnacondaCode = "pyscript" in sys.modules
|
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)
|
@@ -14131,15 +14127,15 @@ class Environment:
|
|
14131
14127
|
note that the header is only printed if trace=True
|
14132
14128
|
"""
|
14133
14129
|
len_s1 = len(self.time_to_str(0))
|
14134
|
-
self.print_trace((len_s1 - 4) * " " + "time", "current component", "action", "information", "" if (
|
14135
|
-
self.print_trace(len_s1 * "-", 20 * "-", 35 * "-", 48 * "-", "" if (
|
14130
|
+
self.print_trace((len_s1 - 4) * " " + "time", "current component", "action", "information", "" if (PythonInExcel or AnacondaCode) else "line#")
|
14131
|
+
self.print_trace(len_s1 * "-", 20 * "-", 35 * "-", 48 * "-", "" if (PythonInExcel or AnacondaCode) else 6 * "-")
|
14136
14132
|
for ref in range(len(self._source_files)):
|
14137
14133
|
for fullfilename, iref in self._source_files.items():
|
14138
14134
|
if ref == iref:
|
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 = []
|
@@ -26553,7 +26549,7 @@ def can_animate(try_only: bool = True) -> bool:
|
|
26553
26549
|
except ImportError:
|
26554
26550
|
ImageGrab = None
|
26555
26551
|
|
26556
|
-
if not Pythonista and not (
|
26552
|
+
if not Pythonista and not (PythonInExcel or AnacondaCode):
|
26557
26553
|
from PIL import ImageTk
|
26558
26554
|
except ImportError:
|
26559
26555
|
if try_only:
|
@@ -26562,7 +26558,7 @@ def can_animate(try_only: bool = True) -> bool:
|
|
26562
26558
|
|
26563
26559
|
g.dummy_image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
|
26564
26560
|
|
26565
|
-
if not Pythonista and not (
|
26561
|
+
if not Pythonista and not (PythonInExcel or AnacondaCode):
|
26566
26562
|
if PyDroid:
|
26567
26563
|
if not g.tkinter_loaded:
|
26568
26564
|
if try_only:
|
@@ -0,0 +1,10 @@
|
|
1
|
+
salabim/DejaVuSansMono.ttf,sha256=Z_oIXp5yp1Zaw2y2p3vaxwHhjHpG0MFbmwhxSh4aIEI,335068
|
2
|
+
salabim/LICENSE.txt,sha256=qHlBa-POyexatCxDTjSKMlYtkBFQDn9lu-YV_1L6V0U,1106
|
3
|
+
salabim/__init__.py,sha256=r7qPLvlmX0dkZDyjuTo8Jo3ex3sD1L4pmK6K5ib9vyw,56
|
4
|
+
salabim/calibri.ttf,sha256=RWpf8Uo31RfvGGNaSt9-2sXSuN87AVE_NFMRsV3LhBk,1330156
|
5
|
+
salabim/mplus-1m-regular.ttf,sha256=EuFHr90BJjuAn_r5MleJFN-WfkeWJ4tf7DweI5zr8tU,289812
|
6
|
+
salabim/salabim.py,sha256=4_MnkDN-cbMTmgGsSe0GVWTMDO1Bwk9tzArOUmdx8Yg,1097327
|
7
|
+
salabim-24.0.11.dist-info/METADATA,sha256=GvOkBsH4ol5LofjZg7u_Qe4ZakqGpoIULeHC676vAe0,3450
|
8
|
+
salabim-24.0.11.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
9
|
+
salabim-24.0.11.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
|
10
|
+
salabim-24.0.11.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
salabim/DejaVuSansMono.ttf,sha256=Z_oIXp5yp1Zaw2y2p3vaxwHhjHpG0MFbmwhxSh4aIEI,335068
|
2
|
-
salabim/LICENSE.txt,sha256=qHlBa-POyexatCxDTjSKMlYtkBFQDn9lu-YV_1L6V0U,1106
|
3
|
-
salabim/__init__.py,sha256=r7qPLvlmX0dkZDyjuTo8Jo3ex3sD1L4pmK6K5ib9vyw,56
|
4
|
-
salabim/calibri.ttf,sha256=RWpf8Uo31RfvGGNaSt9-2sXSuN87AVE_NFMRsV3LhBk,1330156
|
5
|
-
salabim/mplus-1m-regular.ttf,sha256=EuFHr90BJjuAn_r5MleJFN-WfkeWJ4tf7DweI5zr8tU,289812
|
6
|
-
salabim/salabim.py,sha256=jkHX2FH0E_wyIuHK5sHtFmZ-vTzjMwgtvkOQqaEgDQk,1097385
|
7
|
-
salabim-24.0.10.post5.dist-info/METADATA,sha256=536RgdiFsGvvFkbo_ZYFUJAciP6QRTl7tEH2zNhf8O4,3456
|
8
|
-
salabim-24.0.10.post5.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
9
|
-
salabim-24.0.10.post5.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
|
10
|
-
salabim-24.0.10.post5.dist-info/RECORD,,
|
File without changes
|
File without changes
|