Documentation for the Code

class pyrollout.feature.Feature(name, groups=None, percentage=None, randomize=False, users=None)[source]
__init__(name, groups=None, percentage=None, randomize=False, users=None)[source]

A representation of a feature for use in PyRollout.

Parameters:
  • name (basestring) – Name of feature, this is what you will pass in when checking access
  • groups (list) – optional list of group names to allow access to “ALL” and “NONE” are special names
  • percentage (int) – 0-100 percentage of users who should have access
  • randomize (bool) – randomize percentage access, normally based simply on user ID
  • users (list) – list of user IDs that should have access
can(user_storage, user)[source]

Check if user, stored in user_storage, can access this feature.

Parameters:
  • user_storage (pyrollout.storage.UserStorageManager) –
  • user (dict or object) –
Returns:

Can user access feature

Return type:

bool

can_group(user_storage, user)[source]

Check if user can access feature by group.

Parameters:
  • user_storage (pyrollout.storage.UserStorageManager) –
  • user (dict or object) –
Returns:

Can user access feature

Return type:

bool

can_user_id(user_storage, user)[source]

Check if user can access feature by user ID.

Parameters:
  • user_storage (pyrollout.storage.UserStorageManager) –
  • user (dict or object) –
Returns:

Can user access feature

Return type:

bool

can_user_pct(user_storage, user)[source]

Check if user can access feature by percentage.

Parameters:
  • user_storage (pyrollout.storage.UserStorageManager) –
  • user (dict or object) –
Returns:

Can user access feature

Return type:

bool