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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bugdantic
3
- Version: 0.2
3
+ Version: 0.2.2
4
4
  Summary: Bugzilla client based on pydantic
5
5
  Author-email: James Graham <james@hoppipolla.co.uk>
6
6
  Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.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[dict[str, str]] = None,
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: dict[str, str],
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
- query["offset"] = str(int(query["offset"]) + page_size)
422
+ offset += page_size
423
+ query["offset"] = str(offset)
417
424
 
418
425
  return results
419
426
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bugdantic
3
- Version: 0.2
3
+ Version: 0.2.2
4
4
  Summary: Bugzilla client based on pydantic
5
5
  Author-email: James Graham <james@hoppipolla.co.uk>
6
6
  Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
@@ -5,7 +5,7 @@ authors = [
5
5
  {name = "James Graham", email = "james@hoppipolla.co.uk"}
6
6
  ]
7
7
 
8
- version = "0.2"
8
+ version = "0.2.2"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
11
11
  "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes