-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Minor changes to Materials CSV source
- Move `MaterialsSource` to `csv/base.py` because we don't have any others implementations so far, - Update types in annotations, - Add `delimiter` field to CSV Source (we can expect a customer using tabs, commas and etc), - Add additional validation logic when reading a file (a read will fail if a file does not contain a required column), - Minor improvements and test changes.
- Loading branch information
1 parent
cbf5145
commit b38d1f4
Showing
8 changed files
with
179 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +0,0 @@ | ||
import abc | ||
from typing import Iterator | ||
|
||
from pydantic import BaseModel | ||
from volur.pork.materials.v1alpha3 import material_pb2 | ||
|
||
|
||
class MaterialSource(BaseModel): | ||
@abc.abstractmethod | ||
def __iter__(self: "MaterialSource") -> Iterator[material_pb2.Material]: ... # type: ignore[override] | ||
|
||
@abc.abstractmethod | ||
def __next__(self: "MaterialSource") -> material_pb2.Material: ... | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import abc | ||
from typing import AsyncIterator, Iterator | ||
|
||
from pydantic import BaseModel | ||
from volur.pork.materials.v1alpha3 import material_pb2 | ||
|
||
|
||
class MaterialSource(BaseModel): | ||
""" | ||
Base class for material sources. | ||
This class in an abstract class that defines the interface for material CSV | ||
source. | ||
""" | ||
|
||
@abc.abstractmethod | ||
def __iter__(self: "MaterialSource") -> Iterator[material_pb2.Material]: ... # type: ignore[override] | ||
|
||
@abc.abstractmethod | ||
def __next__(self: "MaterialSource") -> material_pb2.Material: ... | ||
|
||
@abc.abstractmethod | ||
def __aiter__(self: "MaterialSource") -> AsyncIterator[material_pb2.Material]: ... | ||
|
||
@abc.abstractmethod | ||
async def __anext__( | ||
self: "MaterialSource", | ||
) -> material_pb2.Material: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.