indico_toolkit 7.2.2__tar.gz → 7.2.3__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.
Files changed (76) hide show
  1. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/PKG-INFO +2 -2
  2. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/__init__.py +1 -1
  3. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/polling/queries.py +17 -8
  4. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/normalization.py +7 -0
  5. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/__init__.py +12 -0
  6. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/documentextraction.py +15 -14
  7. indico_toolkit-7.2.3/indico_toolkit/results/predictions/prediction.py +71 -0
  8. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/summarization.py +9 -9
  9. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/unbundling.py +10 -10
  10. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/result.py +12 -1
  11. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/retry.py +10 -11
  12. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/pyproject.toml +2 -2
  13. indico_toolkit-7.2.2/indico_toolkit/results/predictions/prediction.py +0 -42
  14. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/LICENSE +0 -0
  15. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/README.md +0 -0
  16. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/association/__init__.py +0 -0
  17. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/association/association.py +0 -0
  18. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/association/extracted_tokens.py +0 -0
  19. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/association/line_items.py +0 -0
  20. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/association/positioning.py +0 -0
  21. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/association/splitting.py +0 -0
  22. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/auto_review/__init__.py +0 -0
  23. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/auto_review/auto_review_functions.py +0 -0
  24. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/auto_review/auto_reviewer.py +0 -0
  25. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/client.py +0 -0
  26. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/errors.py +0 -0
  27. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/__init__.py +0 -0
  28. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/box.py +0 -0
  29. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/cell.py +0 -0
  30. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/etloutput.py +0 -0
  31. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/range.py +0 -0
  32. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/span.py +0 -0
  33. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/table.py +0 -0
  34. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/token.py +0 -0
  35. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/etloutput/utils.py +0 -0
  36. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/indico_wrapper/__init__.py +0 -0
  37. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/indico_wrapper/download.py +0 -0
  38. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/indico_wrapper/indico_wrapper.py +0 -0
  39. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/indico_wrapper/modelop.py +0 -0
  40. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/indico_wrapper/workflow.py +0 -0
  41. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/metrics/__init__.py +0 -0
  42. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/metrics/compare_ground_truth.py +0 -0
  43. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/metrics/compare_models.py +0 -0
  44. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/metrics/metrics.py +0 -0
  45. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/metrics/plotting.py +0 -0
  46. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/ocr/__init__.py +0 -0
  47. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/ocr/ondoc_object.py +0 -0
  48. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/ocr/standard_object.py +0 -0
  49. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/pipelines/__init__.py +0 -0
  50. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/pipelines/file_processing.py +0 -0
  51. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/polling/__init__.py +0 -0
  52. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/polling/autoreview.py +0 -0
  53. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/polling/downstream.py +0 -0
  54. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/py.typed +0 -0
  55. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/__init__.py +0 -0
  56. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/document.py +0 -0
  57. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictionlist.py +0 -0
  58. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/citation.py +0 -0
  59. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/classification.py +0 -0
  60. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/extraction.py +0 -0
  61. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/formextraction.py +0 -0
  62. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/predictions/group.py +0 -0
  63. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/review.py +0 -0
  64. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/task.py +0 -0
  65. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/results/utils.py +0 -0
  66. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/snapshots/__init__.py +0 -0
  67. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/snapshots/snapshot.py +0 -0
  68. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/structure/__init__.py +0 -0
  69. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/structure/create_structure.py +0 -0
  70. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/structure/queries.py +0 -0
  71. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/structure/utils.py +0 -0
  72. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/types/__init__.py +0 -0
  73. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/types/classification.py +0 -0
  74. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/types/extractions.py +0 -0
  75. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/types/predictions.py +0 -0
  76. {indico_toolkit-7.2.2 → indico_toolkit-7.2.3}/indico_toolkit/types/workflow_object.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: indico-toolkit
3
- Version: 7.2.2
3
+ Version: 7.2.3
4
4
  Summary: Classes, functions, and abstractions for Indico IPA
5
5
  License: MIT
6
6
  Author: Indico Solutions Engineering
@@ -18,7 +18,7 @@ Provides-Extra: examples
18
18
  Provides-Extra: metrics
19
19
  Provides-Extra: predictions
20
20
  Provides-Extra: snapshots
21
- Requires-Dist: indico-client (>=6.14.0,<7.0.0)
21
+ Requires-Dist: indico-client (>=6.14.0,<8.0.0)
22
22
  Requires-Dist: pandas (>=2.2.3,<3.0.0) ; extra == "all"
23
23
  Requires-Dist: pandas (>=2.2.3,<3.0.0) ; extra == "downloads"
24
24
  Requires-Dist: pandas (>=2.2.3,<3.0.0) ; extra == "examples"
@@ -21,4 +21,4 @@ __all__ = (
21
21
  "ToolkitStaggeredLoopError",
22
22
  "ToolkitStatusError",
23
23
  )
24
- __version__ = "7.2.2"
24
+ __version__ = "7.2.3"
@@ -11,7 +11,13 @@ class SubmissionIdsPendingAutoReview(GraphQLRequest): # type: ignore[misc, no-a
11
11
  query SubmissionIdsPendingAutoReview($workflowIds: [Int]) {
12
12
  submissions(
13
13
  desc: false
14
- filters: { status: PENDING_AUTO_REVIEW }
14
+ filters: {
15
+ AND: [
16
+ { status: PENDING_AUTO_REVIEW }
17
+ { filesDeleted: false }
18
+ { retrieved: false }
19
+ ]
20
+ }
15
21
  limit: 1000
16
22
  orderBy: ID
17
23
  workflowIds: $workflowIds
@@ -39,13 +45,16 @@ class SubmissionIdsPendingDownstream(GraphQLRequest): # type: ignore[misc, no-a
39
45
  submissions(
40
46
  desc: false
41
47
  filters: {
42
- AND: {
43
- retrieved: false
44
- OR: [
45
- { status: COMPLETE }
46
- { status: FAILED }
47
- ]
48
- }
48
+ AND: [
49
+ {
50
+ OR: [
51
+ { status: COMPLETE }
52
+ { status: FAILED }
53
+ ]
54
+ }
55
+ { filesDeleted: false }
56
+ { retrieved: false }
57
+ ]
49
58
  }
50
59
  limit: 1000
51
60
  orderBy: ID
@@ -54,6 +54,13 @@ def normalize_prediction_dict(task_type: TaskType, prediction: "Any") -> None:
54
54
  ) and not has(prediction, list, "spans"):
55
55
  prediction["spans"] = []
56
56
 
57
+ # Form Extraction bounding boxes may very rarely have a `.0` decimal place,
58
+ # which causes them to fail strict validation.
59
+ if task_type == TaskType.FORM_EXTRACTION:
60
+ for edge in ("top", "left", "right", "bottom"):
61
+ if has(prediction, float, edge):
62
+ prediction[edge] = int(prediction[edge])
63
+
57
64
  # Form Extractions added in review may lack bounding box information.
58
65
  # These values will match `NULL_BOX`.
59
66
  if task_type == TaskType.FORM_EXTRACTION and not has(prediction, int, "top"):
@@ -1,3 +1,4 @@
1
+ import sys
1
2
  from typing import TYPE_CHECKING
2
3
 
3
4
  from ..normalization import normalize_prediction_dict
@@ -55,3 +56,14 @@ def from_dict(
55
56
  return Unbundling.from_dict(document, task, review, prediction)
56
57
  else:
57
58
  raise ValueError(f"unsupported task type {task.type!r}")
59
+
60
+
61
+ # `dataclass()` doesn't (yet) provide a way to configure the generated `__replace__`
62
+ # method on Python 3.13+. Unshadow `Prediction.__replace__` in generated subclasses.
63
+ if sys.version_info >= (3, 13):
64
+ del Classification.__replace__
65
+ del DocumentExtraction.__replace__
66
+ del Extraction.__replace__
67
+ del FormExtraction.__replace__
68
+ del Summarization.__replace__
69
+ del Unbundling.__replace__
@@ -1,5 +1,5 @@
1
- from copy import copy, deepcopy
2
- from dataclasses import dataclass, field, replace
1
+ from copy import copy
2
+ from dataclasses import dataclass, field
3
3
  from typing import TYPE_CHECKING, Any
4
4
 
5
5
  from ...etloutput import (
@@ -131,6 +131,19 @@ class DocumentExtraction(Extraction):
131
131
  self.tables.append(table)
132
132
  self.cells.append(cell)
133
133
 
134
+ def __deepcopy__(self, memo: Any) -> "Self":
135
+ """
136
+ Supports `copy.deepcopy(prediction)` without copying immutable objects.
137
+ This provides a significant time and memory improvement when OCR is assigned.
138
+ """
139
+ new_instance = super().__deepcopy__(memo)
140
+ new_instance.groups = copy(self.groups)
141
+ new_instance.spans = copy(self.spans)
142
+ new_instance.tokens = copy(self.tokens)
143
+ new_instance.tables = copy(self.tables)
144
+ new_instance.cells = copy(self.cells)
145
+ return new_instance
146
+
134
147
  @staticmethod
135
148
  def from_dict(
136
149
  document: "Document",
@@ -190,15 +203,3 @@ class DocumentExtraction(Extraction):
190
203
  prediction["rejected"] = True
191
204
 
192
205
  return prediction
193
-
194
- def copy(self) -> "Self":
195
- return replace(
196
- self,
197
- groups=copy(self.groups),
198
- spans=copy(self.spans),
199
- tokens=copy(self.tokens),
200
- tables=copy(self.tables),
201
- cells=copy(self.cells),
202
- confidences=copy(self.confidences),
203
- extras=deepcopy(self.extras),
204
- )
@@ -0,0 +1,71 @@
1
+ from copy import copy, deepcopy
2
+ from dataclasses import dataclass
3
+ from typing import TYPE_CHECKING, Any
4
+
5
+ if TYPE_CHECKING:
6
+ from typing_extensions import Self
7
+
8
+ from ..document import Document
9
+ from ..review import Review
10
+ from ..task import Task
11
+
12
+
13
+ @dataclass
14
+ class Prediction:
15
+ document: "Document"
16
+ task: "Task"
17
+ review: "Review | None"
18
+
19
+ label: str
20
+ confidences: "dict[str, float]"
21
+ extras: "dict[str, Any]"
22
+
23
+ @property
24
+ def confidence(self) -> float:
25
+ return self.confidences[self.label]
26
+
27
+ @confidence.setter
28
+ def confidence(self, value: float) -> None:
29
+ self.confidences[self.label] = value
30
+
31
+ def __deepcopy__(self, memo: Any) -> "Self":
32
+ """
33
+ Supports `copy.deepcopy(prediction)` without copying immutable objects.
34
+ """
35
+ new_instance = copy(self)
36
+ new_instance.confidences = copy(self.confidences)
37
+ new_instance.extras = deepcopy(self.extras, memo)
38
+ return new_instance
39
+
40
+ def __replace__override__(self, **attributes: Any) -> "Self":
41
+ """
42
+ Supports `copy.replace(prediction, **attrs)` on Python 3.13+
43
+
44
+ Unlike `dataclasses.replace(**attrs)` this performs a deep copy and allows
45
+ assigning properties in addition to attributes.
46
+
47
+ E.g.
48
+ >>> dataclasses.replace(prediction, confidence=1.0)
49
+ Shallow copy and raises TypeError(...)
50
+ >>> copy.replace(prediction, confidence=1.0)
51
+ Deep copy and returns Prediction(confidence=1.0, ...)
52
+ """
53
+ new_instance = deepcopy(self)
54
+
55
+ for attribute, value in attributes.items():
56
+ setattr(new_instance, attribute, value)
57
+
58
+ return new_instance
59
+
60
+ def to_dict(self) -> "dict[str, Any]":
61
+ """
62
+ Create a prediction dictionary for auto review changes.
63
+ """
64
+ raise NotImplementedError()
65
+
66
+
67
+ # `dataclass()` doesn't (yet) provide a way to override the generated `__replace__`
68
+ # method on Python 3.13+. It must be overridden after class generation and unshadowed
69
+ # on all derived classes.
70
+ Prediction.__replace__ = Prediction.__replace__override__ # type:ignore
71
+ del Prediction.__replace__override__
@@ -1,4 +1,4 @@
1
- from copy import copy, deepcopy
1
+ from copy import copy
2
2
  from dataclasses import dataclass, replace
3
3
  from typing import TYPE_CHECKING, Any
4
4
 
@@ -70,6 +70,14 @@ class Summarization(Extraction):
70
70
  """
71
71
  self.citation = replace(self.citation, span=span)
72
72
 
73
+ def __deepcopy__(self, memo: Any) -> "Self":
74
+ """
75
+ Supports `copy.deepcopy(prediction)` without copying immutable objects.
76
+ """
77
+ new_instance = super().__deepcopy__(memo)
78
+ new_instance.citations = copy(self.citations)
79
+ return new_instance
80
+
73
81
  @staticmethod
74
82
  def from_dict(
75
83
  document: "Document",
@@ -125,11 +133,3 @@ class Summarization(Extraction):
125
133
  prediction["rejected"] = True
126
134
 
127
135
  return prediction
128
-
129
- def copy(self) -> "Self":
130
- return replace(
131
- self,
132
- citations=copy(self.citations),
133
- confidences=copy(self.confidences),
134
- extras=deepcopy(self.extras),
135
- )
@@ -1,5 +1,5 @@
1
- from copy import copy, deepcopy
2
- from dataclasses import dataclass, replace
1
+ from copy import copy
2
+ from dataclasses import dataclass
3
3
  from typing import TYPE_CHECKING, Any
4
4
 
5
5
  from ...etloutput import Span
@@ -25,6 +25,14 @@ class Unbundling(Prediction):
25
25
  """
26
26
  return tuple(span.page for span in self.spans)
27
27
 
28
+ def __deepcopy__(self, memo: Any) -> "Self":
29
+ """
30
+ Supports `copy.deepcopy(prediction)` without copying immutable objects.
31
+ """
32
+ new_instance = super().__deepcopy__(memo)
33
+ new_instance.spans = copy(self.spans)
34
+ return new_instance
35
+
28
36
  @staticmethod
29
37
  def from_dict(
30
38
  document: "Document",
@@ -55,11 +63,3 @@ class Unbundling(Prediction):
55
63
  "confidence": self.confidences,
56
64
  "spans": [span.to_dict() for span in self.spans],
57
65
  }
58
-
59
- def copy(self) -> "Self":
60
- return replace(
61
- self,
62
- spans=copy(self.spans),
63
- confidences=copy(self.confidences),
64
- extras=deepcopy(self.extras),
65
- )
@@ -1,6 +1,8 @@
1
- from dataclasses import dataclass
1
+ from copy import deepcopy
2
+ from dataclasses import dataclass, replace
2
3
  from functools import partial
3
4
  from itertools import chain
5
+ from typing import TYPE_CHECKING, Any
4
6
 
5
7
  from . import predictions as prediction
6
8
  from .document import Document
@@ -11,6 +13,9 @@ from .review import Review, ReviewType
11
13
  from .task import Task
12
14
  from .utils import get
13
15
 
16
+ if TYPE_CHECKING:
17
+ from typing_extensions import Self
18
+
14
19
 
15
20
  @dataclass(frozen=True, order=True)
16
21
  class Result:
@@ -44,6 +49,12 @@ class Result:
44
49
  def final(self) -> "PredictionList[Prediction]":
45
50
  return self.predictions.where(review=self.reviews[-1] if self.reviews else None)
46
51
 
52
+ def __deepcopy__(self, memo: Any) -> "Self":
53
+ """
54
+ Supports `copy.deepcopy(result)` without copying immutable objects.
55
+ """
56
+ return replace(self, predictions=deepcopy(self.predictions, memo))
57
+
47
58
  @staticmethod
48
59
  def from_dict(result: object) -> "Result":
49
60
  """
@@ -10,8 +10,7 @@ if TYPE_CHECKING:
10
10
  from typing import ParamSpec, TypeVar
11
11
 
12
12
  ArgumentsType = ParamSpec("ArgumentsType")
13
- OuterReturnType = TypeVar("OuterReturnType")
14
- InnerReturnType = TypeVar("InnerReturnType")
13
+ ReturnType = TypeVar("ReturnType")
15
14
 
16
15
 
17
16
  def retry(
@@ -20,7 +19,7 @@ def retry(
20
19
  wait: float = 1,
21
20
  backoff: float = 4,
22
21
  jitter: float = 0.5,
23
- ) -> "Callable[[Callable[ArgumentsType, OuterReturnType]], Callable[ArgumentsType, OuterReturnType]]": # noqa: E501
22
+ ) -> "Callable[[Callable[ArgumentsType, ReturnType]], Callable[ArgumentsType, ReturnType]]": # noqa: E501
24
23
  """
25
24
  Decorate a function or coroutine to retry when it raises specified errors,
26
25
  apply exponential backoff and jitter to the wait time,
@@ -46,15 +45,15 @@ def retry(
46
45
 
47
46
  @overload
48
47
  def retry_decorator(
49
- decorated: "Callable[ArgumentsType, Awaitable[InnerReturnType]]",
50
- ) -> "Callable[ArgumentsType, Awaitable[InnerReturnType]]": ...
48
+ decorated: "Callable[ArgumentsType, Awaitable[ReturnType]]",
49
+ ) -> "Callable[ArgumentsType, Awaitable[ReturnType]]": ...
51
50
  @overload
52
51
  def retry_decorator(
53
- decorated: "Callable[ArgumentsType, InnerReturnType]",
54
- ) -> "Callable[ArgumentsType, InnerReturnType]": ...
52
+ decorated: "Callable[ArgumentsType, ReturnType]",
53
+ ) -> "Callable[ArgumentsType, ReturnType]": ...
55
54
  def retry_decorator(
56
- decorated: "Callable[ArgumentsType, InnerReturnType]",
57
- ) -> "Callable[ArgumentsType, Awaitable[InnerReturnType]] | Callable[ArgumentsType, InnerReturnType]": # noqa: E501
55
+ decorated: "Callable[ArgumentsType, ReturnType]",
56
+ ) -> "Callable[ArgumentsType, Awaitable[ReturnType]] | Callable[ArgumentsType, ReturnType]": # noqa: E501
58
57
  """
59
58
  Decorate either a function or coroutine as appropriate.
60
59
  """
@@ -63,7 +62,7 @@ def retry(
63
62
  @wraps(decorated)
64
63
  async def retrying_coroutine( # type: ignore[return]
65
64
  *args: "ArgumentsType.args", **kwargs: "ArgumentsType.kwargs"
66
- ) -> "InnerReturnType":
65
+ ) -> "ReturnType":
67
66
  for times_retried in range(count + 1):
68
67
  try:
69
68
  return await decorated(*args, **kwargs) # type: ignore[no-any-return]
@@ -79,7 +78,7 @@ def retry(
79
78
  @wraps(decorated)
80
79
  def retrying_function( # type: ignore[return]
81
80
  *args: "ArgumentsType.args", **kwargs: "ArgumentsType.kwargs"
82
- ) -> "InnerReturnType":
81
+ ) -> "ReturnType":
83
82
  for times_retried in range(count + 1):
84
83
  try:
85
84
  return decorated(*args, **kwargs)
@@ -12,8 +12,8 @@ authors = [
12
12
  readme = "README.md"
13
13
  urls = { source = "https://github.com/IndicoDataSolutions/Indico-Solutions-Toolkit" }
14
14
  requires-python = ">=3.10"
15
- version = "7.2.2"
16
- dependencies = ["indico-client (>=6.14.0,<7.0.0)"]
15
+ version = "7.2.3"
16
+ dependencies = ["indico-client (>=6.14.0,<8.0.0)"]
17
17
 
18
18
  [project.optional-dependencies]
19
19
  all = ["pandas (>=2.2.3,<3.0.0)", "plotly (>=5.2.1,<6.0.0)", "tqdm (>=4.50.0,<5.0.0)"]
@@ -1,42 +0,0 @@
1
- from copy import copy, deepcopy
2
- from dataclasses import dataclass, replace
3
- from typing import TYPE_CHECKING, Any
4
-
5
- if TYPE_CHECKING:
6
- from typing_extensions import Self
7
-
8
- from ..document import Document
9
- from ..review import Review
10
- from ..task import Task
11
-
12
-
13
- @dataclass
14
- class Prediction:
15
- document: "Document"
16
- task: "Task"
17
- review: "Review | None"
18
-
19
- label: str
20
- confidences: "dict[str, float]"
21
- extras: "dict[str, Any]"
22
-
23
- @property
24
- def confidence(self) -> float:
25
- return self.confidences[self.label]
26
-
27
- @confidence.setter
28
- def confidence(self, value: float) -> None:
29
- self.confidences[self.label] = value
30
-
31
- def to_dict(self) -> "dict[str, Any]":
32
- """
33
- Create a prediction dictionary for auto review changes.
34
- """
35
- raise NotImplementedError()
36
-
37
- def copy(self) -> "Self":
38
- return replace(
39
- self,
40
- confidences=copy(self.confidences),
41
- extras=deepcopy(self.extras),
42
- )
File without changes
File without changes