Direct data class

class pyanp.direct.Direct(alt_names=None)[source]

Represents the concept of directly setting data. It is a single user only pyanp.prioritizer.Prioritizer instance.

__init__(alt_names=None)[source]

Initialize self. See help(type(self)) for accurate signature.

add_alt(alt_name: str) → None[source]

Adds an alternative.

Parameters:alt_name – The name of the alt to add.
Returns:Nothing
Raises:ValueError – If the alternative already existed
add_user(uname: str) → None[source]

Does nothing since Direct current does not have users.

Parameters:uname – The name of the user we should add
Returns:Nothing
priority(username=None, ptype: pyanp.prioritizer.PriorityType = None)[source]

Gets the priority for the given user. At the moment it simply ignores user since direct data only stores one data set for all users.

Parameters:
  • username – The name of the user, but it is ignored.
  • ptype – Should we normalize, idealize, or leave the priority alone.
Returns:

A pandas.Series whose index is the alternative names and whose values are the priorities.

usernames()[source]

Direct has no notion of users at the moment, so this returns the empty list.

Returns:Empty list