bugdantic 0.2__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bugdantic-0.2 → bugdantic-0.2.2}/PKG-INFO +1 -1
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic/bugzilla.py +12 -5
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic.egg-info/PKG-INFO +1 -1
- {bugdantic-0.2 → bugdantic-0.2.2}/pyproject.toml +1 -1
- {bugdantic-0.2 → bugdantic-0.2.2}/LICENSE +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/README.md +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic/__init__.py +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic/py.typed +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic.egg-info/SOURCES.txt +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic.egg-info/dependency_links.txt +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic.egg-info/requires.txt +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/bugdantic.egg-info/top_level.txt +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/setup.cfg +0 -0
- {bugdantic-0.2 → bugdantic-0.2.2}/test/test_bugzilla.py +0 -0
|
@@ -3,7 +3,7 @@ import json
|
|
|
3
3
|
import logging
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from datetime import datetime
|
|
6
|
-
from typing import Any, Mapping, MutableMapping, Optional
|
|
6
|
+
from typing import Any, Mapping, MutableMapping, Optional, Sequence
|
|
7
7
|
from urllib.parse import urljoin
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
@@ -11,6 +11,9 @@ from pydantic import BaseModel, ConfigDict
|
|
|
11
11
|
|
|
12
12
|
Json = dict[str, "Json"] | list["Json"] | str | int | float | bool | None
|
|
13
13
|
|
|
14
|
+
QueryValue = Optional[str | int | float | bool]
|
|
15
|
+
QueryParams = Mapping[str, QueryValue | Sequence[QueryValue]]
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
class BugzillaError(Exception):
|
|
16
19
|
pass
|
|
@@ -133,7 +136,6 @@ class BugSearch(BaseModel):
|
|
|
133
136
|
# Data model for bug history
|
|
134
137
|
|
|
135
138
|
|
|
136
|
-
|
|
137
139
|
class BugHistory(BaseModel):
|
|
138
140
|
id: int
|
|
139
141
|
history: list[History]
|
|
@@ -308,12 +310,14 @@ class Bugzilla:
|
|
|
308
310
|
path: str,
|
|
309
311
|
include_fields: Optional[list[str]] = None,
|
|
310
312
|
exclude_fields: Optional[list[str]] = None,
|
|
311
|
-
params: Optional[
|
|
313
|
+
params: Optional[QueryParams] = None,
|
|
312
314
|
headers: Optional[dict[str, str]] = None,
|
|
313
315
|
json_body: Optional[MutableMapping[str, Json]] = None,
|
|
314
316
|
) -> Mapping[str, Json]:
|
|
315
317
|
if params is None:
|
|
316
318
|
params = {}
|
|
319
|
+
else:
|
|
320
|
+
params = {**params}
|
|
317
321
|
|
|
318
322
|
if include_fields is not None:
|
|
319
323
|
params["include_fields"] = ",".join(include_fields)
|
|
@@ -385,11 +389,13 @@ class Bugzilla:
|
|
|
385
389
|
|
|
386
390
|
def search(
|
|
387
391
|
self,
|
|
388
|
-
query:
|
|
392
|
+
query: QueryParams,
|
|
389
393
|
include_fields: Optional[list[str]] = None,
|
|
390
394
|
page_size: int = 100,
|
|
391
395
|
) -> list[Bug]:
|
|
396
|
+
query = {**query}
|
|
392
397
|
paginate = False
|
|
398
|
+
offset = 0
|
|
393
399
|
if "limit" not in query and "offset" not in query and page_size > 0:
|
|
394
400
|
query["limit"] = str(page_size)
|
|
395
401
|
query["offset"] = "0"
|
|
@@ -413,7 +419,8 @@ class Bugzilla:
|
|
|
413
419
|
)
|
|
414
420
|
raise BugzillaError("Response contained neither bugs nor faults fields")
|
|
415
421
|
|
|
416
|
-
|
|
422
|
+
offset += page_size
|
|
423
|
+
query["offset"] = str(offset)
|
|
417
424
|
|
|
418
425
|
return results
|
|
419
426
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|