reviewboard.reviews.conditions¶
Condition choices and operators for review requests and related objects.
- class ReviewRequestConditionChoiceMixin[source]¶
Bases:
object
Mixin for condition choices that operate off review requests.
This will set state needed to match against the choice.
- class AnyReviewGroupsPublicOperator(choice)[source]¶
Bases:
BaseConditionOperator
An operator for matching against any public review groups.
- operator_id = 'any-public'[source]¶
The ID of the operator.
This must be unique within a
BaseConditionChoice
.
- matches(match_value, **kwargs)[source]¶
Return whether any review groups are public.
- Parameters:
match_value (
list
ofreviewboard.reviews.models.group.Group
) – The review groups to match.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
True
if any review groups are public.False
if all are invite-only or the list is empty.- Return type:
- class AllReviewGroupsInviteOnlyOperator(choice)[source]¶
Bases:
BaseConditionOperator
An operator for matching against all invite-only review groups.
- operator_id = 'all-invite-only'[source]¶
The ID of the operator.
This must be unique within a
BaseConditionChoice
.
- matches(match_value, **kwargs)[source]¶
Return whether all review groups in the list are invite-only.
- Parameters:
match_value (
list
ofreviewboard.reviews.models.group.Group
) – The review groups to match.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
True
if all review group in the list are invite-only.False
if any are public, or the list is empty.- Return type:
- __annotations__ = {}¶
- class ReviewGroupsChoice(**kwargs)[source]¶
Bases:
BaseConditionModelMultipleChoice
A condition choice for matching review groups.
This is used to match a
Group
against a list of groups, against no group (empty list), or against a group’s public/invite-only state.- choice_id = 'review-groups'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- value_kwarg = 'review_groups'[source]¶
The keyword argument required for condition matching.
This is the name of the keyword argument that must be provided in order for this choice to be considered for matching. By default, this expects a
value=
keyword argument to be passed toCondition.match
, but choices can specify another name instead.This allows multiple choices with different expected values to be used in the same
ConditionSet
.
- operators = <djblets.conditions.operators.ConditionOperators object>[source]¶
The operators for this choice.
This must be set to an instance of
ConditionOperators
.
- get_queryset()[source]¶
Return the queryset used to look up review group choices.
- Returns:
The queryset for review groups.
- Return type:
- get_match_value(review_groups, value_state_cache, **kwargs)[source]¶
Return the review groups used for matching.
- Parameters:
review_groups (
django.db.models.query.QuerySet
) – The provided queryset for review groups.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The list of review groups.
- Return type:
- class ReviewRequestBranchChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,BaseConditionStringChoice
A condition choice for matching a review request’s branch.
- choice_id = 'branch'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- get_match_value(review_request, **kwargs)[source]¶
Return the branch text used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s branch text.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestDescriptionChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,BaseConditionStringChoice
A condition choice for matching a review request’s description.
- choice_id = 'description'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- get_match_value(review_request, **kwargs)[source]¶
Return the description text used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s description text.
- Return type:
- __annotations__ = {}¶
- class BaseReviewRequestDiffFileChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,ConditionChoiceMatchListItemsMixin
,BaseConditionStringChoice
A condition choice for matching affected diff files on a review request.
This matches against a list of file paths that were added/modified/deleted on the latest diffset of a review request.
- get_match_value(review_request, value_state_cache, **kwargs)[source]¶
Return the list of filenames used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The set of filenames.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestAnyDiffFileChoice(**kwargs)[source]¶
Bases:
BaseReviewRequestDiffFileChoice
- choice_id = 'any_diffed_file'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- require_match_all_items = False[source]¶
Whether all items must match for the choice’s match to be successful.
By default, the match is successful if any item in the list matches. If
True
, all items must match.
- __annotations__ = {}¶
- class ReviewRequestAllDiffFilesChoice(**kwargs)[source]¶
Bases:
BaseReviewRequestDiffFileChoice
- choice_id = 'all_diffed_files'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- require_match_all_items = True[source]¶
Whether all items must match for the choice’s match to be successful.
By default, the match is successful if any item in the list matches. If
True
, all items must match.
- __annotations__ = {}¶
- class ReviewRequestOwnerChoice(**kwargs)[source]¶
Bases:
LocalSiteModelChoiceMixin
,ReviewRequestConditionChoiceMixin
,BaseConditionModelMultipleChoice
A condition choice for matching a review request’s owner.
- queryset = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>[source]¶
The queryset used for the choice.
- choice_id = 'owner'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- operators = <djblets.conditions.operators.ConditionOperators object>[source]¶
The operators for this choice.
This must be set to an instance of
ConditionOperators
.
- get_match_value(review_request, **kwargs)[source]¶
Return the owner used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s owner.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestReviewerChoice(**kwargs)[source]¶
Bases:
LocalSiteModelChoiceMixin
,ReviewRequestConditionChoiceMixin
,BaseConditionModelMultipleChoice
A condition choice for matching a review request’s reviewer.
- queryset = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>[source]¶
The queryset used for the choice.
- choice_id = 'reviewer'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- operators = <djblets.conditions.operators.ConditionOperators object>[source]¶
The operators for this choice.
This must be set to an instance of
ConditionOperators
.
- get_match_value(review_request, **kwargs)[source]¶
Return the reviewers used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
, unused) – Unused keyword arguments.
- Returns:
List of the review request’s reviewers.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestParticipantChoice(**kwargs)[source]¶
Bases:
LocalSiteModelChoiceMixin
,ReviewRequestConditionChoiceMixin
,BaseConditionModelMultipleChoice
A condition choice for matching a review request’s participant.
- queryset = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>[source]¶
The queryset used for the choice.
- choice_id = 'participant'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- operators = <djblets.conditions.operators.ConditionOperators object>[source]¶
The operators for this choice.
This must be set to an instance of
ConditionOperators
.
- get_match_value(review_request, **kwargs)[source]¶
Return the participants used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
, unused) – Unused keyword arguments.
- Returns:
The review request’s participants.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestSummaryChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,BaseConditionStringChoice
A condition choice for matching a review request’s summary.
- choice_id = 'summary'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- get_match_value(review_request, **kwargs)[source]¶
Return the summary text used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s summary text.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestTestingDoneChoice(**kwargs)[source]¶
Bases:
BaseConditionStringChoice
A condition choice for matching a review request’s Testing Done field.
- choice_id = 'testing-done'[source]¶
The ID of the choice.
This must be unique within a
ConditionSet
.
- get_match_value(review_request, **kwargs)[source]¶
Return the testing done text used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s testing done text.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestRepositoriesChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,RepositoriesChoice
A condition choice for matching a review request’s repositories.
- get_match_value(review_request, **kwargs)[source]¶
Return the repository used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s repository.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestRepositoryTypeChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,RepositoryTypeChoice
A condition choice for matching a review request’s repository types.
- get_match_value(review_request, **kwargs)[source]¶
Return the repository used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Unused keyword arguments.
- Returns:
The review request’s repository.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestReviewGroupsChoice(**kwargs)[source]¶
Bases:
ReviewRequestConditionChoiceMixin
,ReviewGroupsChoice
A condition choice for matching a review request’s review groups.
- get_match_value(review_request, **kwargs)[source]¶
Return the review groups used for matching.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The provided review request.**kwargs (
dict
) – Extra keyword arguments.
- Returns:
The queryset for a review request’s target review groups.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestConditionChoices(choices=[])[source]¶
Bases:
ConditionChoices
A standard set of review request condition choices.
This provides a handful of condition choices that are useful for review requests. They can be used in integrations or any other place where conditions are used.
- choice_classes = [<class 'reviewboard.reviews.conditions.ReviewRequestBranchChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestDescriptionChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestRepositoriesChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestRepositoryTypeChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestReviewGroupsChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestOwnerChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestReviewerChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestParticipantChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestSummaryChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestTestingDoneChoice'>][source]¶
A list of default choices.
This is only used if a list of choices is not passed to the constructor.
- __annotations__ = {'_by_id': 'Dict[int, RegistryItemType]', '_items': 'set[RegistryItemType]', '_key_order': 'List[int]', '_lock': 'RLock', '_registry': 'dict[str, dict[object, RegistryItemType]]', 'already_registered_error_class': 'Type[AlreadyRegisteredError]', 'default_errors': 'RegistryErrorsDict', 'errors': 'RegistryErrorsDict', 'item_name': 'Optional[str]', 'lookup_attrs': 'Sequence[str]', 'lookup_error_class': 'Type[ItemLookupError]', 'state': 'RegistryState'}¶
- __parameters__ = ()¶