mal-simulator 0.2.1__tar.gz → 0.2.2__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.
- {mal_simulator-0.2.1/mal_simulator.egg-info → mal_simulator-0.2.2}/PKG-INFO +1 -1
- {mal_simulator-0.2.1 → mal_simulator-0.2.2/mal_simulator.egg-info}/PKG-INFO +1 -1
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/__init__.py +3 -3
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/mal_simulator.py +38 -7
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/pyproject.toml +1 -6
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/AUTHORS +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/LICENSE +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/README.md +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/mal_simulator.egg-info/SOURCES.txt +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/mal_simulator.egg-info/dependency_links.txt +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/mal_simulator.egg-info/entry_points.txt +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/mal_simulator.egg-info/requires.txt +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/mal_simulator.egg-info/top_level.txt +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/__main__.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/agents/__init__.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/agents/decision_agent.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/agents/keyboard_input.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/agents/passive_agent.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/agents/searchers.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/envs/__init__.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/envs/base_classes.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/envs/gym_envs.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/envs/malsim_vectorized_obs_env.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/malsim/scenario.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/setup.cfg +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/tests/test_main.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/tests/test_mal_simulator.py +0 -0
- {mal_simulator-0.2.1 → mal_simulator-0.2.2}/tests/test_scenario.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mal-simulator
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A MAL compliant simulator.
|
|
5
5
|
Author-email: Andrei Buhaiu <buhaiu@kth.se>, Joakim Loxdal <loxdal@kth.se>, Jakob Nyberg <jaknyb@kth.se>, Nikolaos Kakouros <nkak@kth.se>
|
|
6
6
|
License: Apache Software License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mal-simulator
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A MAL compliant simulator.
|
|
5
5
|
Author-email: Andrei Buhaiu <buhaiu@kth.se>, Joakim Loxdal <loxdal@kth.se>, Jakob Nyberg <jaknyb@kth.se>, Nikolaos Kakouros <nkak@kth.se>
|
|
6
6
|
License: Apache Software License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# MAL Simulator v0.2.
|
|
3
|
-
# Copyright
|
|
2
|
+
# MAL Simulator v0.2.2
|
|
3
|
+
# Copyright 2025, Andrei Buhaiu.
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
# you may not use this file except in compliance with the License.
|
|
@@ -24,7 +24,7 @@ MAL Simulator
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
__title__ = "malsim"
|
|
27
|
-
__version__ = "0.2.
|
|
27
|
+
__version__ = "0.2.2"
|
|
28
28
|
__authors__ = ["Andrei Buhaiu", "Joakim Loxdal", "Jakob Nyberg", "Nikolaos Kakouros"]
|
|
29
29
|
__license__ = "Apache 2.0"
|
|
30
30
|
__docformat__ = "restructuredtext en"
|
|
@@ -76,8 +76,13 @@ class MalSimDefenderState(MalSimAgentState):
|
|
|
76
76
|
super().__init__(name, AgentType.DEFENDER)
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
class MalSimAgentStateView:
|
|
80
|
-
"""Read-only interface to MalSimAgentState.
|
|
79
|
+
class MalSimAgentStateView(MalSimAttackerState, MalSimDefenderState):
|
|
80
|
+
"""Read-only interface to MalSimAgentState.
|
|
81
|
+
|
|
82
|
+
Subclassing from State classes only to satisfy static analysis and support
|
|
83
|
+
autocompletion that would otherwise be unavailable due to the dynamic
|
|
84
|
+
__getattr(ibute)__ method.
|
|
85
|
+
"""
|
|
81
86
|
|
|
82
87
|
_frozen = False
|
|
83
88
|
|
|
@@ -88,16 +93,34 @@ class MalSimAgentStateView:
|
|
|
88
93
|
def __setattr__(self, key, value) -> None:
|
|
89
94
|
if self._frozen:
|
|
90
95
|
raise AttributeError("Cannot modify agent state view")
|
|
91
|
-
|
|
96
|
+
super().__setattr__(key, value)
|
|
92
97
|
|
|
93
98
|
def __delattr__(self, key) -> None:
|
|
94
99
|
if self._frozen:
|
|
95
100
|
raise AttributeError("Cannot modify agent state view")
|
|
96
101
|
super().__delattr__(key)
|
|
97
102
|
|
|
98
|
-
def
|
|
99
|
-
"""Return read-only version of proxied agent's properties.
|
|
100
|
-
|
|
103
|
+
def __getattribute__(self, attr) -> Any:
|
|
104
|
+
"""Return read-only version of proxied agent's properties.
|
|
105
|
+
|
|
106
|
+
If the attribute exists in the View only return it from there. Using
|
|
107
|
+
__getattribute__ instead of __getattr__ as the latter is called only for
|
|
108
|
+
missing properties; since this class is a subclass of State, it will
|
|
109
|
+
have all state properties and those would be returned from self, not
|
|
110
|
+
self._agent. Using __getattribute__ allows use to filter which
|
|
111
|
+
properties to return from self and which from self._agent.
|
|
112
|
+
"""
|
|
113
|
+
if attr in ("_agent", "_frozen") or \
|
|
114
|
+
attr.startswith("__") and attr.endswith("__"):
|
|
115
|
+
return super().__getattribute__(attr)
|
|
116
|
+
|
|
117
|
+
agent = super().__getattribute__('_agent')
|
|
118
|
+
value = getattr(agent, attr)
|
|
119
|
+
|
|
120
|
+
if attr == '_agent':
|
|
121
|
+
return agent
|
|
122
|
+
|
|
123
|
+
value = getattr(agent, attr)
|
|
101
124
|
|
|
102
125
|
if isinstance(value, dict):
|
|
103
126
|
return MappingProxyType(value)
|
|
@@ -110,7 +133,15 @@ class MalSimAgentStateView:
|
|
|
110
133
|
|
|
111
134
|
def __dir__(self):
|
|
112
135
|
"""Dynamically resolve attribute names for REPL autocompletion."""
|
|
113
|
-
|
|
136
|
+
dunder_attrs = [
|
|
137
|
+
attr
|
|
138
|
+
for attr in dir(self.__class__)
|
|
139
|
+
if attr.startswith("__") and attr.endswith("__")
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
props = list(vars(self._agent).keys()) + ["_agent", "_frozen"]
|
|
143
|
+
|
|
144
|
+
return dunder_attrs + props
|
|
114
145
|
|
|
115
146
|
|
|
116
147
|
@dataclass
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mal-simulator"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name="Andrei Buhaiu", email="buhaiu@kth.se" },
|
|
6
6
|
{ name="Joakim Loxdal", email="loxdal@kth.se" },
|
|
7
7
|
{ name="Jakob Nyberg", email="jaknyb@kth.se" },
|
|
8
8
|
{ name="Nikolaos Kakouros", email="nkak@kth.se" }
|
|
9
|
-
|
|
10
9
|
]
|
|
11
10
|
description = "A MAL compliant simulator."
|
|
12
11
|
readme = "README.md"
|
|
@@ -44,7 +43,6 @@ dev = [
|
|
|
44
43
|
"Bug Tracker" = "https://github.com/mal-lang/mal-simulator/issues"
|
|
45
44
|
"Repository" = "https://github.com/mal-lang/mal-simulator"
|
|
46
45
|
|
|
47
|
-
|
|
48
46
|
[project.scripts]
|
|
49
47
|
malsim = "malsim.__main__:main"
|
|
50
48
|
|
|
@@ -55,8 +53,5 @@ build-backend = "setuptools.build_meta"
|
|
|
55
53
|
[tool.setuptools.packages.find]
|
|
56
54
|
include = ["malsim*"]
|
|
57
55
|
|
|
58
|
-
[tool.setuptools.package-data]
|
|
59
|
-
maltoolbox = ["tests*"]
|
|
60
|
-
|
|
61
56
|
[tool.pytest.ini_options]
|
|
62
57
|
pythonpath = ['.']
|
|
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
|
|
File without changes
|