Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update neat engine #729

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cognite/neat/_session/_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ def __call__(self, io: Any) -> IssueList:
class CSVReadAPI(BaseReadAPI):
def __call__(self, io: Any, type: str, primary_key: str) -> None:
engine = import_engine()
engine.set.file(io)
engine.set.type(type)
engine.set.primary_key(primary_key)
engine.set.source = ".csv"
engine.set.file = io
engine.set.type = type
engine.set.primary_key = primary_key
extractor = engine.create_extractor()

self._state.instances.store.write(extractor)
Expand Down
17 changes: 8 additions & 9 deletions cognite/neat/_session/engine/_interface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterable
from typing import Any, ClassVar, Protocol
from typing import Any, Protocol

from rdflib import Literal, URIRef

Expand All @@ -8,18 +8,17 @@ class Extractor(Protocol):
def extract(self) -> Iterable[tuple[URIRef, URIRef, Literal | URIRef]]: ...


class SetterAPI(Protocol):
def file(self, io: Any) -> None: ...

def type(self, type: str) -> None: ...

def primary_key(self, key: str) -> None: ...
class ConfigAPI(Protocol):
source: str | None
file: Any | None
type: str | None
primary_key: str | None


class NeatEngine(Protocol):
version: ClassVar[str] = "1.0.0"
version: str = "1.0.0"

@property
def set(self) -> SetterAPI: ...
def set(self) -> ConfigAPI: ...

def create_extractor(self) -> Extractor: ...
Loading