vulyk.cli package

Submodules

vulyk.cli.admin module

Package contains CLI tools implementation related to admins

vulyk.cli.admin.list_admin() → None[source]

Outputs a list of emails of administrators.

vulyk.cli.admin.toggle_admin(email, state) → None[source]

Toggles admin state of given user.

Parameters
  • email (str) – email address.

  • state (bool) – State we want to set.

vulyk.cli.batches module

Package contains CLI tools related to managing batches of tasks.

vulyk.cli.batches.add_batch(batch_id: str, count: int, task_type: vulyk.models.task_types.AbstractTaskType, default_batch: str, batch_meta: Optional[Dict] = None) → None[source]

Updates or creates new batch after loading new dataset. Only default batch may be extended.

Parameters
  • batch_id (str) – Name of the batch

  • count (int) – Number of tasks to load

  • task_type (AbstractTaskType) – Type of tasks loaded into the batch

  • default_batch (str) – Name of the default batch

  • batch_meta (Optional[Dict]) – User params to override default batch meta

Raise

click.BadParameter

vulyk.cli.batches.batches_list() → List[str][source]
Returns

List of batches IDs to validate CLI input

Return type

List[str]

vulyk.cli.batches.validate_batch(ctx, param: str, value: str, default_batch: str) → str[source]

Refuses your attempts to add tasks to existing batch (except ‘default’)

Parameters
  • ctx – Click context

  • param (str) – Name of parameter (batch)

  • value (str) – Value of batch parameter

  • default_batch (str) – Name of the default batch

Returns

the value if is valid

Return type

str

Raise

click.BadParameter

vulyk.cli.db module

vulyk.cli.db.export_reports(task_id: vulyk.models.task_types.AbstractTaskType, path: str, batch: str, closed: bool) → None[source]
vulyk.cli.db.load_tasks(task_type: vulyk.models.task_types.AbstractTaskType, path: str, batch: str) → int[source]
Parameters

batch (str) – Batch ID tasks should be loaded into

Returns

Number of tasks loaded

Return type

int

vulyk.cli.db.open_anything(filename: str)[source]

vulyk.cli.groups module

vulyk.cli.groups.add_task_type(gid: str, task_type: str) → None[source]

Appends task type to the list of allowed ones of certain group

Parameters
  • gid (str) – Group’s symbolic code

  • task_type (str) – Task type symbolic code

Raises

click.BadParameter – if wrong gid has been passed

vulyk.cli.groups.assign_to(username: str, gid: str) → None[source]

Assigns a group to user

Parameters
  • gid (str) – Group’s symbolic code

  • username (str) – Username of member

Raises

click.BadParameter – if wrong gid or ` username` has been passed

vulyk.cli.groups.get_groups_ids() → List[str][source]

Returns list of groups codes

:rtype : list[str]

vulyk.cli.groups.list_groups() → Generator[str, None, None][source]

Generates list of group representation strings

:rtype : _generator[str]

vulyk.cli.groups.new_group(gid: str, description: str) → None[source]

Creates new group

Parameters
  • gid (str) – Group’s symbolic code

  • description (str) – Short description (optional)

Raises

click.BadParameter – if wrong id has been passed

vulyk.cli.groups.remove_group(gid: str) → None[source]

Delete existing group

Parameters

gid (str) – Group’s symbolic code

Raises

click.BadParameter – if wrong id has been passed

vulyk.cli.groups.remove_task_type(gid: str, task_type: str) → None[source]

Removes task type from the list of allowed types of specified group

Parameters
  • gid (str) – Group’s symbolic code

  • task_type (str) – Task type symbolic code

Raises

click.BadParameter – if wrong gid has been passed

vulyk.cli.groups.resign(username: str, gid: str) → None[source]

Excludes user from specified group

Parameters
  • gid (str) – Group’s symbolic code

  • username (str) – Username of member

Raises

click.BadParameter – if wrong gid or ` username` has been passed

vulyk.cli.groups.validate_id(ctx, param: str, value: str) → str[source]

Allows group code to consist only of letters/numbers/underscore

Parameters
  • ctx – Click context

  • param (str) – Name of parameter (id)

  • value (str) – Value of id parameter

Returns

true if value passes

Return type

str

Raises

click.BadParameter

vulyk.cli.stats module

vulyk.cli.stats.batch_completeness(batch_name: str, task_type: str) → collections.OrderedDict[source]

Gathers completeness stats on every batch using 2 metrics: - actually completed tasks - actual reports to total planned amount ratio (tasks * redundancy)

Parameters
  • batch_name (str) – Optional name of batch to filter by

  • task_type (str) – Optional name of task type to filter by

Return type

OrderedDict

Module contents

The package consists of modules hat provide support for different aspects of project’s CLI.

vulyk.cli.is_initialized(default_key='default') → bool[source]

The method checks whether the default group has been created already or has not.

Parameters

default_key (str) – Default group ID

Returns

A boolean flag

Return type

bool

vulyk.cli.project_init(allowed_types) → None[source]

The method reassures that a default group is already available, otherwise it will be created and passed task types are to be made accessible to the group.

Parameters

allowed_types (list[str]) – Task type names to be allowed to default group.