States#

A state is observed on a pull request or on its author, like a condition: it has an id, the inputs that configure it, and the data that the update of the repository reads for it in the background. A condition (Conditions) is a state of a pull request that is true or false; the states of people are numbers, counted in all repositories of a project, such as the reviews a person gave. Conditions check them, such as review_ratio: Review to pull request ratio.

Id

What it observes

pull_requests_opened: Pull requests opened

How many pull requests a person opened in the project.

own_pull_requests_closed: Own pull requests closed

How many pull requests a person opened and closed themselves in the project.

reviews_given: Reviews given

How many reviews a person gave in the project, without those of comments only.

review_ratio: Review to pull request ratio

The reviews a person gave in the project for each pull request they opened and did not close themselves.

Where they count#

The repositories counted are those of the project that the viewer sees (Scope); the numbers of all people are counted at once, with one query of the database each.

A state of a person, a number counted in the repositories of a project.

class pycal_dashboard.conditions.state.person.PersonState#

Bases: State

A number of a person in a project, such as the reviews they gave.

It is observed on a person in a project (Scope, all its repositories): the author of a pull request, or a person of GitHub. A subclass has measure().

phrase#

The state compared with a number, with %(comparison)s and %(number)s, for the columns of the table, such as its author gave %(comparison)s %(number)s reviews.

Type:

ClassVar[str]

counted#

Whether it is a count, such as reviews, whose comparisons read more than and fewer than; else a value, such as a ratio: above and below.

Type:

ClassVar[bool]

classmethod observe(subject, scope=None, values=None)#

The number of a person: the author of a pull request, or a person of GitHub.

Parameters:
  • subject – A pull request, whose author is observed, or a person (GitHubUser).

  • scope – The repositories counted, such as those of a project; for a pull request, its repository by default.

  • values – The configuration, from configure().

Returns:

The number; None without a person or while the data is not complete.

classmethod evidence(issue, project)#

The page of the author of a pull request in the project, where they are counted.

Parameters:
  • issue – The pull request.

  • project – The project; None for no page.

Returns:

The link to the page of the author; none without an author or a project.

classmethod compare(subject, comparison, number, scope=None, values=None)#

Whether the state compares with a number: what the conditions of states check.

Parameters:
  • subject – A pull request or a person, see observe().

  • comparison – Such as below or at_least, see COMPARISONS of pycal_dashboard.conditions.input.comparison.

  • number – The number.

  • scope – The repositories counted.

  • values – The inputs of the state, such as kinds.

Returns:

True if it holds; None while the state is not known.

abstractmethod classmethod measure(person, scope, values)#

The state of a person whose data is complete.

Parameters:
  • person – The person.

  • scope – The repositories counted.

  • values – The configuration.

Returns:

The number.

Where the states of people are counted: the repositories of a project.

class pycal_dashboard.conditions.state.scope.Scope(repositories, project=None)#

The repositories in which the states of people are counted, such as those of a project.

The numbers of all people are counted at once, with one query each, the first time one is asked for, so that a table of many pull requests asks the database a few times only.

synced()#

The pull requests with the PR Sync of the project on, read once.

Returns:

Their ids; None without a project.

skips()#

Who skips a step of the project: pull requests by a writer, and authors, read once.

Returns:

The ids of the pull requests that a writer skipped a step for, and the GitHub handles (lower case) of the authors whose pull requests skip a step; None without a project.

classmethod of(subject)#

The scope of a pull request (its repository) or of a project (its repositories).

Parameters:

subject – A pull request, a project, or a person (no repositories).

Returns:

The scope.

static person(subject)#

The person observed: the author of a pull request, or the person itself.

Parameters:

subject – A pull request or a person.

Returns:

The person; None for a pull request whose author GitHub does not say.

counts(name, kinds=None)#

A number of every person in the repositories, by the id of the person.

Parameters:
  • name – opened (pull requests opened), closed_own (of those, closed by the person without merging) or reviews (reviews given).

  • kinds – For reviews, the kinds of reviews that count; all of them for None.

Returns:

The numbers by the id of the GitHubUser; people without any are missing.

count(name, person, kinds=None)#

A number of a person, see counts().

Parameters:
  • name – opened, closed_own or reviews.

  • person – The person.

  • kinds – For reviews, the kinds of reviews that count; all of them for None.

Returns:

The number.