|  |  | 
builtins.object
Agent
json.encoder.JSONEncoder(builtins.object)
AgentEncoder
 
 
| class Agent(builtins.object)
 |  |  | Agent(name, attrs=None, action=None, duration=9223372036854775807, prim_group=None, serial_obj=None, exec_key=None, **kwargs) 
 This is the base class of all agents, environments,
 and objects contained in an environment.
 
 |  |  | Methods defined here: 
 __add__(self, other)Adds agent and group to make new group.
 __call__(self, **kwargs)Agents will 'act' by being called as a function.If the agent has no `action()` function, do nothing.
 If returns False, by default agent will move.
 __contains__(self, item)
 __eq__(self, other)Return self==value.
 __getitem__(self, key)
 __init__(self, name, attrs=None, action=None, duration=9223372036854775807, prim_group=None, serial_obj=None, exec_key=None, **kwargs)Initialize self.  See help(type(self)) for accurate signature.
 __iter__(self)
 __len__(self)
 __repr__(self)Return repr(self).
 __setitem__(self, key, value)
 __str__(self)Return str(self).
 add_group(self, group)
 check_null_pos(fn)Should be used to decorate any function that uses pos[X] or pos[Y]
 del_group(self, group)
 die(self)
 from_json(self, serial_agent)
 get(self, key, default=None)This is a call to get_attr() to not break existing codethat calls get().
 get_attr(self, key, default=None)
 get_pos(self)
 get_x(self)
 get_y(self)
 group_name(self)
 has_color(self)
 is_active(self)
 is_located(self)
 move(self, max_move=None, angle=None)Move this agent to a random pos within max_moveof its current pos.
 prim_group_nm(self)prim_group is just a name, but we don't want modelsgoing straight at it!
 primary_group(self)
 restore(self, serial_obj)
 set_attr(self, key, val)
 set_pos(self, x, y)
 set_prim_group(self, group)We want this to store the name of the group.The str() of the group is its name.
 The str() of the name is itself.
 If we are passed None, set to blank.
 switch_groups(self, g1, g2)
 to_json(self)
 Data descriptors defined here:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 Data and other attributes defined here:
 
 __hash__ = None
 |  
 
| class AgentEncoder(json.encoder.JSONEncoder)
 |  |  | AgentEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) 
 The JSON encoder base class for all descendants
 of Agent.
 
 |  |  | Method resolution order:AgentEncoderjson.encoder.JSONEncoderbuiltins.object
 Methods defined here:
 
 default(self, o)Implement this method in a subclass such that it returnsa serializable object for ``o``, or calls the base implementation
 (to raise a ``TypeError``).
 
 For example, to support arbitrary iterators, you could
 implement default like this::
 
 def default(self, o):
 try:
 iterable = iter(o)
 except TypeError:
 pass
 else:
 return list(iterable)
 # Let the base class default method raise the TypeError
 return JSONEncoder.default(self, o)
 Methods inherited from json.encoder.JSONEncoder:
 
 __init__(self, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)Constructor for JSONEncoder, with sensible defaults.
 If skipkeys is false, then it is a TypeError to attempt
 encoding of keys that are not str, int, float or None.  If
 skipkeys is True, such items are simply skipped.
 
 If ensure_ascii is true, the output is guaranteed to be str
 objects with all incoming non-ASCII characters escaped.  If
 ensure_ascii is false, the output can contain non-ASCII characters.
 
 If check_circular is true, then lists, dicts, and custom encoded
 objects will be checked for circular references during encoding to
 prevent an infinite recursion (which would cause an OverflowError).
 Otherwise, no such check takes place.
 
 If allow_nan is true, then NaN, Infinity, and -Infinity will be
 encoded as such.  This behavior is not JSON specification compliant,
 but is consistent with most JavaScript based encoders and decoders.
 Otherwise, it will be a ValueError to encode such floats.
 
 If sort_keys is true, then the output of dictionaries will be
 sorted by key; this is useful for regression tests to ensure
 that JSON serializations can be compared on a day-to-day basis.
 
 If indent is a non-negative integer, then JSON array
 elements and object members will be pretty-printed with that
 indent level.  An indent level of 0 will only insert newlines.
 None is the most compact representation.
 
 If specified, separators should be an (item_separator, key_separator)
 tuple.  The default is (', ', ': ') if *indent* is ``None`` and
 (',', ': ') otherwise.  To get the most compact JSON representation,
 you should specify (',', ':') to eliminate whitespace.
 
 If specified, default is a function that gets called for objects
 that can't otherwise be serialized.  It should return a JSON encodable
 version of the object or raise a ``TypeError``.
 encode(self, o)Return a JSON string representation of a Python data structure.
 >>> from json.encoder import JSONEncoder
 >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
 '{"foo": ["bar", "baz"]}'
 iterencode(self, o, _one_shot=False)Encode the given object and yield each stringrepresentation as available.
 
 For example::
 
 for chunk in JSONEncoder().iterencode(bigobject):
 mysocket.write(chunk)
 Data descriptors inherited from json.encoder.JSONEncoder:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 Data and other attributes inherited from json.encoder.JSONEncoder:
 
 item_separator = ', '
 key_separator = ': '
 |  |