Skip to content

Commit

Permalink
Merge branch 'release/0.0.2rc3'
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierLuna committed Sep 11, 2019
2 parents c053f34 + 43e6f01 commit d4c10d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pycaprio/core/adapters/http_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ def delete_annotation(self, project_id: int, document_id: int, user_name: str):
allowed_statuses=(204, 200))
return True

def export_project(self, project_id: int) -> bytes:
response = self.client.get(f"/projects/{project_id}/export.zip", allowed_statuses=(200,))
def export_project(self, project_id: int, format: str = DocumentFormats.DEFAULT) -> bytes:
response = self.client.get(f"/projects/{project_id}/export.zip", allowed_statuses=(200,),
params={'format': format})
return response.content

def import_project(self, zip_stream: IO) -> Project:
Expand Down
9 changes: 6 additions & 3 deletions pycaprio/core/interfaces/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ def annotations(self, project_id: int, document_id: int) -> List[Annotation]:
pass # pragma: no cover

@abstractmethod
def annotation(self, project_id: int, document_id: int, annotation_id: int) -> bytes:
def annotation(self, project_id: int, document_id: int, annotation_id: int,
format: str = DocumentFormats.DEFAULT) -> bytes:
"""
Retrieves a Document
:param project_id: The project_id of the Project where the Annotation is located
:param document_id: The document_id of the Document where the Annotation is located
:param format: Format in which the annotation will be downloaded
:return: Content of the Annotation in bytes
"""
pass # pragma: no cover
Expand Down Expand Up @@ -98,7 +100,7 @@ def create_document(self, project_id: int, document_name: str, content: IO,

@abstractmethod
def create_annotation(self, project_id: int, document_id: int, user_name: str, content: IO,
annotation_format: str = DocumentFormats.DEFAULT, state: str = AnnotationStatus):
annotation_format: str = DocumentFormats.DEFAULT, state: str = AnnotationStatus.DEFAULT):
"""
Creates a Document
:param project_id: Id of the Project where the new Document will be created
Expand Down Expand Up @@ -139,10 +141,11 @@ def delete_annotation(self, project_id: int, document_id: int, user_name: str) -
pass # pragma: no cover

@abstractmethod
def export_project(self, project_id: int) -> bytes:
def export_project(self, project_id: int, format: str = DocumentFormats.DEFAULT) -> bytes:
"""
Exports a Project into a .zip file.
:param project_id: Project id.
:param format: Format in which the documents and annotations will be exported.
:return: Zip file in bytes.
"""
pass # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pycaprio"
version = "0.0.2rc2"
version = "0.0.2rc3"
description = "Python client for the INCEpTION annotation tool API"
authors = ["Savanamed"]
license = "MIT"
Expand Down

0 comments on commit d4c10d6

Please sign in to comment.