Skip to content

Commit

Permalink
Enforce keyword arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin committed Jan 29, 2025
1 parent 32e11ba commit 162a3ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ragna/deploy/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ async def content_stream() -> AsyncIterator[bytes]:

@router.get("/documents")
async def get_documents(user: UserDependency) -> list[schemas.Document]:
return engine.get_documents(user.name)
return engine.get_documents(user=user.name)

@router.get("/documents/{id}")
async def get_document(user: UserDependency, id: uuid.UUID) -> schemas.Document:
return engine.get_document(user.name, id)
return engine.get_document(user=user.name, id=id)

@router.get("/documents/{id}/content")
async def get_document_content(
user: UserDependency, id: uuid.UUID
) -> StreamingResponse:
schema_document = engine.get_document(user.name, id)
schema_document = engine.get_document(user=user.name, id=id)
core_document = engine._to_core.document(schema_document)
headers = {"Content-Disposition": f"inline; filename={schema_document.name}"}

Expand Down
8 changes: 4 additions & 4 deletions ragna/deploy/_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async def store_documents(

streams = dict(ids_and_streams)

documents = self.get_documents(user, streams.keys())
documents = self.get_documents(user=user, ids=streams.keys())

for document in documents:
core_document = cast(
Expand All @@ -191,13 +191,13 @@ async def store_documents(
await core_document._write(streams[document.id])

def get_documents(
self, user: str, ids: Collection[uuid.UUID] | None = None
self, *, user: str, ids: Collection[uuid.UUID] | None = None
) -> list[schemas.Document]:
with self._database.get_session() as session:
return self._database.get_documents(session, user=user, ids=ids)

def get_document(self, user: str, id: uuid.UUID) -> schemas.Document:
return next(iter(self.get_documents(user, [id])))
def get_document(self, *, user: str, id: uuid.UUID) -> schemas.Document:
return next(iter(self.get_documents(user=user, ids=[id])))

def create_chat(
self, *, user: str, chat_creation: schemas.ChatCreation
Expand Down

0 comments on commit 162a3ff

Please sign in to comment.