HowdenCommonObjects 0.1.0__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.
- howdencommonobjects-0.1.0/HowdenCommonObjects/__init__.py +0 -0
- howdencommonobjects-0.1.0/HowdenCommonObjects/howden_result.py +10 -0
- howdencommonobjects-0.1.0/HowdenCommonObjects/usage.py +38 -0
- howdencommonobjects-0.1.0/HowdenCommonObjects.egg-info/PKG-INFO +8 -0
- howdencommonobjects-0.1.0/HowdenCommonObjects.egg-info/SOURCES.txt +12 -0
- howdencommonobjects-0.1.0/HowdenCommonObjects.egg-info/dependency_links.txt +1 -0
- howdencommonobjects-0.1.0/HowdenCommonObjects.egg-info/top_level.txt +1 -0
- howdencommonobjects-0.1.0/PKG-INFO +8 -0
- howdencommonobjects-0.1.0/pyproject.toml +9 -0
- howdencommonobjects-0.1.0/setup.cfg +4 -0
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class Usage:
|
|
7
|
+
llm_model: Optional[str] = None
|
|
8
|
+
input_tokens: int = 0
|
|
9
|
+
output_tokens: int = 0
|
|
10
|
+
parser_model: Optional[str] = None
|
|
11
|
+
parsing_tier: Optional[str] = None
|
|
12
|
+
pages_parsed: int = 0
|
|
13
|
+
|
|
14
|
+
def __iadd__(self, other):
|
|
15
|
+
if not isinstance(other, Usage):
|
|
16
|
+
raise TypeError(f"Cannot add Usage and {type(other).__name__}")
|
|
17
|
+
|
|
18
|
+
for field, val in vars(self).items():
|
|
19
|
+
other_val = getattr(other, field)
|
|
20
|
+
|
|
21
|
+
if isinstance(val, int):
|
|
22
|
+
setattr(self, field, val + other_val)
|
|
23
|
+
elif isinstance(val, str) or val is None:
|
|
24
|
+
if (val is None and other_val is None) or val == other_val:
|
|
25
|
+
# Neither object has a value or equal values
|
|
26
|
+
continue
|
|
27
|
+
elif val is None and isinstance(other_val, str):
|
|
28
|
+
# self is empty, so take other's value
|
|
29
|
+
setattr(self, field, other_val)
|
|
30
|
+
elif isinstance(val, str) and other_val is None:
|
|
31
|
+
# self already has the value, keep it
|
|
32
|
+
continue
|
|
33
|
+
else:
|
|
34
|
+
# Conflicting values
|
|
35
|
+
raise ValueError(f"Conflicting values for {field}:{val!r} and {other_val!r}")
|
|
36
|
+
else:
|
|
37
|
+
raise NotImplementedError(f"Addition for type {type(val).__name__} has not been implemented.")
|
|
38
|
+
return self
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: HowdenCommonObjects
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple configuration manager with Pydantic and JSON export.
|
|
5
|
+
Author-email: Casper Bresdahl <casper.bresdahl@howdendanmark.dk>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: <3.14,>=3.12
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
HowdenCommonObjects/__init__.py
|
|
3
|
+
HowdenCommonObjects/howden_result.py
|
|
4
|
+
HowdenCommonObjects/usage.py
|
|
5
|
+
HowdenCommonObjects.egg-info/PKG-INFO
|
|
6
|
+
HowdenCommonObjects.egg-info/SOURCES.txt
|
|
7
|
+
HowdenCommonObjects.egg-info/dependency_links.txt
|
|
8
|
+
HowdenCommonObjects.egg-info/top_level.txt
|
|
9
|
+
howdencommonobjects.egg-info/PKG-INFO
|
|
10
|
+
howdencommonobjects.egg-info/SOURCES.txt
|
|
11
|
+
howdencommonobjects.egg-info/dependency_links.txt
|
|
12
|
+
howdencommonobjects.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
HowdenCommonObjects
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: HowdenCommonObjects
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple configuration manager with Pydantic and JSON export.
|
|
5
|
+
Author-email: Casper Bresdahl <casper.bresdahl@howdendanmark.dk>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: <3.14,>=3.12
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "HowdenCommonObjects"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A simple configuration manager with Pydantic and JSON export."
|
|
5
|
+
authors = [{name = "Casper Bresdahl", email = "casper.bresdahl@howdendanmark.dk"}]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = {text = "MIT"}
|
|
8
|
+
requires-python = ">=3.12,<3.14"
|
|
9
|
+
dependencies = []
|