| |
- builtins.object
-
- CantAsk
- lib.agent.Agent(builtins.object)
-
- User
-
- APIUser
- PrintToStdOut
-
- BatchUser(PrintToStdOut, CantAsk, User)
- TermUser(PrintToStdOut, User)
- TestUser(PrintToStdOut, CantAsk, User)
class APIUser(User) |
|
APIUser(name='api', **kwargs)
This is our web user, who is expected to communicate with a web page
frontend.
This class needs from_json() and to_json() methods. |
|
- Method resolution order:
- APIUser
- User
- lib.agent.Agent
- builtins.object
Methods defined here:
- __call__(self, menuid=None)
- Can't present menu to a scripted test!
- __init__(self, name='api', **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- ask(self, msg, default=None)
- Ask the user something and present it to the web page
- debug(self, msg, end='\n')
- Tell the user some debug info.
- from_json(self, serial_obj)
- This must be written!
- log(self, msg)
- When running on a server, `print()` ought to write to the
log. But let's also add the logging messages to return to
the front-end.
- tell(self, msg, end='\n')
- Tell the user something by showing it on the web page
- to_json(self)
Methods inherited from User:
- exclude_menu_item(self, to_exclude)
- This will immediately remove an item from the menu.
- get_msgs(self)
- is_interactive(self)
- Is this an (immediately) interactive user?
(Like a terminal or GUI user.)
- tell_err(self, msg, end='\n')
- tell_warn(self, msg, end='\n')
Methods inherited from lib.agent.Agent:
- __add__(self, other)
- Adds agent and group to make new group.
- __contains__(self, item)
- __eq__(self, other)
- Return self==value.
- __getitem__(self, key)
- __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)
- get(self, key, default=None)
- This is a call to get_attr() to not break existing code
that 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_move
of its current pos.
- prim_group_nm(self)
- prim_group is just a name, but we don't want models
going 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)
Data descriptors inherited from lib.agent.Agent:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from lib.agent.Agent:
- __hash__ = None
|
class BatchUser(PrintToStdOut, CantAsk, User) |
|
BatchUser(name='batch', **kwargs)
This is our test user, who has some characteristics different from the
terminal user, such as overriding ask() and __call__(). |
|
- Method resolution order:
- BatchUser
- PrintToStdOut
- CantAsk
- User
- lib.agent.Agent
- builtins.object
Methods defined here:
- __init__(self, name='batch', **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
Methods inherited from PrintToStdOut:
- tell(self, msg, end='\n')
- How to tell the user something.
Methods inherited from CantAsk:
- ask(self, msg, default=None)
- Can't ask anything of this type of user.
Data descriptors inherited from CantAsk:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from User:
- __call__(self)
- Can't present menu to a scripted test!
- exclude_menu_item(self, to_exclude)
- This will immediately remove an item from the menu.
- from_json(self, serial_obj)
- This must be written!
- get_msgs(self)
- is_interactive(self)
- Is this an (immediately) interactive user?
(Like a terminal or GUI user.)
- log(self, msg)
- By default log just does whatever tell() does.
- tell_err(self, msg, end='\n')
- tell_warn(self, msg, end='\n')
- to_json(self)
Methods inherited from lib.agent.Agent:
- __add__(self, other)
- Adds agent and group to make new group.
- __contains__(self, item)
- __eq__(self, other)
- Return self==value.
- __getitem__(self, key)
- __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)
- get(self, key, default=None)
- This is a call to get_attr() to not break existing code
that 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_move
of its current pos.
- prim_group_nm(self)
- prim_group is just a name, but we don't want models
going 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)
Data and other attributes inherited from lib.agent.Agent:
- __hash__ = None
|
class CantAsk(builtins.object) |
|
A mixin for users who can't be asked questions. |
|
Methods defined here:
- ask(self, msg, default=None)
- Can't ask anything of this type of user.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PrintToStdOut(User) |
|
PrintToStdOut(name='User', model=None, **kwargs)
Output should be sent to stdout for these users. |
|
- Method resolution order:
- PrintToStdOut
- User
- lib.agent.Agent
- builtins.object
Methods defined here:
- tell(self, msg, end='\n')
- How to tell the user something.
Methods inherited from User:
- __call__(self)
- Can't present menu to a scripted test!
- __init__(self, name='User', model=None, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- ask(self, msg, default=None)
- How to ask the user something.
- exclude_menu_item(self, to_exclude)
- This will immediately remove an item from the menu.
- from_json(self, serial_obj)
- This must be written!
- get_msgs(self)
- is_interactive(self)
- Is this an (immediately) interactive user?
(Like a terminal or GUI user.)
- log(self, msg)
- By default log just does whatever tell() does.
- tell_err(self, msg, end='\n')
- tell_warn(self, msg, end='\n')
- to_json(self)
Methods inherited from lib.agent.Agent:
- __add__(self, other)
- Adds agent and group to make new group.
- __contains__(self, item)
- __eq__(self, other)
- Return self==value.
- __getitem__(self, key)
- __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)
- get(self, key, default=None)
- This is a call to get_attr() to not break existing code
that 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_move
of its current pos.
- prim_group_nm(self)
- prim_group is just a name, but we don't want models
going 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)
Data descriptors inherited from lib.agent.Agent:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from lib.agent.Agent:
- __hash__ = None
|
class TermUser(PrintToStdOut, User) |
|
TermUser(name='terminal', **kwargs)
A representation of the user on a terminal. |
|
- Method resolution order:
- TermUser
- PrintToStdOut
- User
- lib.agent.Agent
- builtins.object
Methods defined here:
- __call__(self)
- Can't present menu to a scripted test!
- __init__(self, name='terminal', **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- ask(self, msg, default=None)
- How to ask the user something.
- debug(self, msg, end='\n')
- from_json(self, serial_obj)
- This must be written!
- get_opt_by_func_nm(self, func_nm)
- For now we have this awkward business of fetching by func
name.
- get_radio(self, item)
- is_interactive(self)
- Is this an (immediately) interactive user?
(Like a terminal or GUI user.)
- is_number(self, c)
- Check if `c` is a number.
- log(self, msg, end='\n')
- How to log something for this type of user.
Our default is going to be the same as tell, for now!
- set_radio_options(self, item)
- to_json(self)
Methods inherited from PrintToStdOut:
- tell(self, msg, end='\n')
- How to tell the user something.
Methods inherited from User:
- exclude_menu_item(self, to_exclude)
- This will immediately remove an item from the menu.
- get_msgs(self)
- tell_err(self, msg, end='\n')
- tell_warn(self, msg, end='\n')
Methods inherited from lib.agent.Agent:
- __add__(self, other)
- Adds agent and group to make new group.
- __contains__(self, item)
- __eq__(self, other)
- Return self==value.
- __getitem__(self, key)
- __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)
- get(self, key, default=None)
- This is a call to get_attr() to not break existing code
that 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_move
of its current pos.
- prim_group_nm(self)
- prim_group is just a name, but we don't want models
going 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)
Data descriptors inherited from lib.agent.Agent:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from lib.agent.Agent:
- __hash__ = None
|
class TestUser(PrintToStdOut, CantAsk, User) |
|
TestUser(name='User', model=None, **kwargs)
This is our test user, who has some characteristics different from the
terminal user, such as overriding ask() and __call__(). |
|
- Method resolution order:
- TestUser
- PrintToStdOut
- CantAsk
- User
- lib.agent.Agent
- builtins.object
Methods inherited from PrintToStdOut:
- tell(self, msg, end='\n')
- How to tell the user something.
Methods inherited from CantAsk:
- ask(self, msg, default=None)
- Can't ask anything of this type of user.
Data descriptors inherited from CantAsk:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from User:
- __call__(self)
- Can't present menu to a scripted test!
- __init__(self, name='User', model=None, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- exclude_menu_item(self, to_exclude)
- This will immediately remove an item from the menu.
- from_json(self, serial_obj)
- This must be written!
- get_msgs(self)
- is_interactive(self)
- Is this an (immediately) interactive user?
(Like a terminal or GUI user.)
- log(self, msg)
- By default log just does whatever tell() does.
- tell_err(self, msg, end='\n')
- tell_warn(self, msg, end='\n')
- to_json(self)
Methods inherited from lib.agent.Agent:
- __add__(self, other)
- Adds agent and group to make new group.
- __contains__(self, item)
- __eq__(self, other)
- Return self==value.
- __getitem__(self, key)
- __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)
- get(self, key, default=None)
- This is a call to get_attr() to not break existing code
that 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_move
of its current pos.
- prim_group_nm(self)
- prim_group is just a name, but we don't want models
going 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)
Data and other attributes inherited from lib.agent.Agent:
- __hash__ = None
|
class User(lib.agent.Agent) |
|
User(name='User', model=None, **kwargs)
A representation of the user in the system.
It is an abstract class! |
|
- Method resolution order:
- User
- lib.agent.Agent
- builtins.object
Methods defined here:
- __call__(self)
- Can't present menu to a scripted test!
- __init__(self, name='User', model=None, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- ask(self, msg, default=None)
- How to ask the user something.
- exclude_menu_item(self, to_exclude)
- This will immediately remove an item from the menu.
- from_json(self, serial_obj)
- This must be written!
- get_msgs(self)
- is_interactive(self)
- Is this an (immediately) interactive user?
(Like a terminal or GUI user.)
- log(self, msg)
- By default log just does whatever tell() does.
- tell(self, msg, end='\n')
- How to tell the user something.
- tell_err(self, msg, end='\n')
- tell_warn(self, msg, end='\n')
- to_json(self)
Methods inherited from lib.agent.Agent:
- __add__(self, other)
- Adds agent and group to make new group.
- __contains__(self, item)
- __eq__(self, other)
- Return self==value.
- __getitem__(self, key)
- __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)
- get(self, key, default=None)
- This is a call to get_attr() to not break existing code
that 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_move
of its current pos.
- prim_group_nm(self)
- prim_group is just a name, but we don't want models
going 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)
Data descriptors inherited from lib.agent.Agent:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from lib.agent.Agent:
- __hash__ = None
| |