pkgcore.bugzilla.query module

Composable searches against GET /rest/bug.

Constraints come in two flavours. Plain equality goes in BugQuery.simple as repeated parameters, which Bugzilla ORs within a key and ANDs across keys. Anything needing an operator becomes a Criterion rendered into the f<N>/o<N>/v<N> boolean chart parameters, with the slot numbers allocated at render time so any two queries can be combined.

class pkgcore.bugzilla.query.BugQuery(simple: tuple[tuple[str, tuple[str, ...]], ...] = (), charts: tuple[Criterion | ChartGroup, ...] = (), limit: int | None = None, offset: int | None = None, order: str | None = None)[source]

Bases: object

A search, built from named constructors and combined with &

classmethod any_of(*queries: BugQuery) BugQuery[source]

OR several chart-only queries together.

Simple parameters can’t take part in a chart group, so a query holding any is rejected rather than silently ANDed in.

classmethod assigned_to(*emails: str) BugQuery[source]
batches(base_length: int = 0, max_length: int = 6000) Iterator[BugQuery][source]

Split into sub-queries whose encoded parameters each fit the budget.

Only the largest splittable axis is divided, either the id simple parameter or a Criterion marked splittable; everything else is repeated in every batch. Sizing uses the encoded length rather than a count, so it adapts to long atoms instead of guessing.

classmethod category(*categories: BugCategory) BugQuery[source]

Restrict to keywordreqs and/or stablereqs

classmethod cc(*emails: str) BugQuery[source]
charts: tuple[Criterion | ChartGroup, ...]
classmethod component(*components: Component | str) BugQuery[source]
classmethod flag(name: str, *statuses: FlagStatus | str) BugQuery[source]

Match a flag by status.

Bugzilla can’t express “flag is absent”; those bugs have to be fetched and filtered client side.

classmethod ids(bugs: Iterable[BugId | int]) BugQuery[source]
classmethod keywords(*keywords: str) BugQuery[source]
limit: int | None
offset: int | None
order: str | None
classmethod package_list_any(packages: Iterable[object]) BugQuery[source]

Match bugs whose package list mentions any of these packages

paged(limit: int, offset: int = 0) BugQuery[source]

Return a copy with explicit paging.

Bugzilla rejects an offset without a limit, and treats limit=0 as unlimited while silently discarding the offset, so both are refused.

params() list[tuple[str, str]][source]

Render to ordered query parameters.

Ordered pairs rather than a mapping, since chart slots are positional and duplicate keys are meaningful.

classmethod product(*products: Product | str) BugQuery[source]
classmethod resolution(*resolutions: str) BugQuery[source]
simple: tuple[tuple[str, tuple[str, ...]], ...]
classmethod status(*statuses: Status | str) BugQuery[source]
classmethod unresolved() BugQuery[source]

Match open bugs, i.e. those with no resolution set.

Selecting on the open statuses instead returns the same set, since Bugzilla only leaves the resolution empty while the status is open, so this is the one spelling worth having.

classmethod without_tags(*tags: str) BugQuery[source]

Exclude bugs carrying any of these personal tags

class pkgcore.bugzilla.query.ChartGroup(join: Join, children: tuple[Criterion | ChartGroup, ...])[source]

Bases: object

Several conditions combined with an explicit join

children: tuple[Criterion | ChartGroup, ...]
join: Join
render(slot: int) tuple[list[tuple[str, str]], int][source]
class pkgcore.bugzilla.query.Criterion(field: str, op: ChartOp, values: tuple[str, ...] = (), negate: bool = False, splittable: bool = False)[source]

Bases: object

One boolean chart condition

field: str
negate: bool
op: ChartOp
render(slot: int) list[tuple[str, str]][source]
splittable: bool
values: tuple[str, ...]
with_values(values: Iterable[str]) Criterion[source]