Skip to content

Commit 22aa87a

Browse files
committed
Rename: TransformationProject -> ProjectTransformation
1 parent 6050887 commit 22aa87a

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44
- Update documentation
55
- Adjust wording. Improve tests. Add API example.
6+
- Rename: `TransformationProject` -> `ProjectTransformation`
67

78
## 2025/03/14 v0.2.0
89
- Core: Added streaming support for JSONL / NDJSON files

src/tikray/core.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from tqdm import tqdm
77

88
from tikray.model.collection import CollectionAddress, CollectionTransformation
9-
from tikray.model.project import TransformationProject
9+
from tikray.model.project import ProjectTransformation
1010
from tikray.util.data import lines_in_file, load_json, save_json
1111

1212
logger = logging.getLogger(__name__)
@@ -15,7 +15,7 @@
1515
def process_project(transformation: Path, input_: Path, output: Path, use_jsonl: bool = False) -> None:
1616
logger.info(f"Using transformation '{transformation}' on multi-collection input '{input_}'")
1717

18-
project = TransformationProject.from_yaml(transformation.read_text())
18+
project = ProjectTransformation.from_yaml(transformation.read_text())
1919
for item in input_.iterdir():
2020
logger.info(f"Processing input: {item}")
2121
address = CollectionAddress(container=item.parent.name, name=item.stem)
@@ -40,7 +40,7 @@ def process_collection(
4040
logger.info(f"Using transformation '{transformation}' on single-collection input '{input_}'")
4141
ct = CollectionTransformation.from_yaml(transformation.read_text())
4242
if address is not None:
43-
pt = TransformationProject.from_yaml(transformation.read_text())
43+
pt = ProjectTransformation.from_yaml(transformation.read_text())
4444
ct = pt.get(CollectionAddress(*address.split(".")))
4545
logger.info(f"Processing input: {input_}")
4646
lines = lines_in_file(input_)

src/tikray/model/project.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
@define
11-
class TransformationProject(Dumpable):
11+
class ProjectTransformation(Dumpable):
1212
meta: Metadata = Metadata(version=1, type="tikray-project")
1313
collections: t.List[CollectionTransformation] = Factory(list)
1414
_map: t.Dict[CollectionAddress, CollectionTransformation] = Factory(dict)
@@ -18,13 +18,13 @@ def __attrs_post_init__(self):
1818
for collection in self.collections:
1919
self._add(collection)
2020

21-
def _add(self, collection: CollectionTransformation) -> "TransformationProject":
21+
def _add(self, collection: CollectionTransformation) -> "ProjectTransformation":
2222
if collection is None or collection.address is None:
2323
raise ValueError("CollectionTransformation or address missing")
2424
self._map[collection.address] = collection
2525
return self
2626

27-
def add(self, collection: CollectionTransformation) -> "TransformationProject":
27+
def add(self, collection: CollectionTransformation) -> "ProjectTransformation":
2828
self.collections.append(collection)
2929
return self._add(collection)
3030

tests/test_project.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
import pytest
44
from tikray.model.collection import CollectionAddress, CollectionTransformation
5-
from tikray.model.project import TransformationProject
5+
from tikray.model.project import ProjectTransformation
66

77

88
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Does not work on Python 3.8 and earlier")
99
def test_project_success():
1010
address = CollectionAddress(container="foo", name="bar")
1111
ct = CollectionTransformation(address=address)
12-
pt = TransformationProject().add(ct)
12+
pt = ProjectTransformation().add(ct)
1313
pt.to_yaml()
1414

15-
pt = TransformationProject(collections=[ct])
15+
pt = ProjectTransformation(collections=[ct])
1616
pt.to_yaml()
1717

1818
assert pt.get(address) is ct
1919

2020

2121
def test_project_failure():
2222
with pytest.raises(ValueError) as ex:
23-
TransformationProject().add(CollectionTransformation())
23+
ProjectTransformation().add(CollectionTransformation())
2424
assert ex.match("CollectionTransformation or address missing")

0 commit comments

Comments
 (0)