Skip to content

Commit

Permalink
Fix some minor typing issues (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-cord-tech authored Dec 10, 2024
1 parent df7cd5c commit 63b35da
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions encord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def create_image_group(

def create_dicom_series(
self,
file_paths: typing.Collection[Union[Path, str]],
file_paths: Union[typing.Collection[str], typing.Collection[Path], typing.Collection[Union[str, Path]]],
title: Optional[str] = None,
cloud_upload_settings: CloudUploadSettings = CloudUploadSettings(),
folder_uuid: Optional[uuid.UUID] = None,
Expand Down Expand Up @@ -1087,7 +1087,7 @@ def save_label_rows(self, uids: List[str], payload: List[LabelRow], validate_bef
}
return self._querier.basic_setter(LabelRow, uid=uids, payload=multirequest_payload, retryable=True)

def create_label_row(self, uid, *, get_signed_url=False) -> typing.Any:
def create_label_row(self, uid, *, get_signed_url=False) -> LabelRow:
"""
This function is documented in :meth:`encord.project.Project.create_label_row`.
"""
Expand Down
2 changes: 1 addition & 1 deletion encord/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def create_image_group(

def create_dicom_series(
self,
file_paths: Collection[Union[Path, str]],
file_paths: Union[Collection[str], Collection[Path], Collection[Union[Path, str]]],
cloud_upload_settings: CloudUploadSettings = CloudUploadSettings(),
title: Optional[str] = None,
folder: Optional[Union[UUID, StorageFolder]] = None,
Expand Down
4 changes: 2 additions & 2 deletions encord/http/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class CloudUploadSettings:


def _get_content_type(
orm_class: Union[Type[Images], Type[Video], Type[DicomSeries], Type[Audio]], file_path: str
orm_class: Union[Type[Images], Type[Video], Type[DicomSeries], Type[Audio]], file_path: Union[str, Path]
) -> Optional[str]:
if orm_class == Images:
return mimetypes.guess_type(file_path)[0]
return mimetypes.guess_type(str(file_path))[0]
elif orm_class == Video or orm_class == Audio:
return "application/octet-stream"
elif orm_class == DicomSeries:
Expand Down
2 changes: 1 addition & 1 deletion encord/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ def move_to_folder(
self,
target_folder: Union[StorageFolder, UUID],
allow_mirror_dataset_changes: bool = False,
):
) -> None:
"""
Move the item to another folder.
Expand Down
Empty file added py.typed
Empty file.
4 changes: 2 additions & 2 deletions tests/objects/test_label_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def test_classification_index_answer_overwrite():
assert classification_instance.get_answer() == "Aphrodite"


def test_classification_answering_with_ontology_access():
def test_classification_answering_with_ontology_access() -> None:
"""A demonstrative test to show how easy it would be for clients to use the ontology to answer classifications"""

# NOTE: it is important to add the `Classification` here, to distinguish between the attribute and classification,
Expand Down Expand Up @@ -975,7 +975,7 @@ def test_label_status_forwards_compatibility():
assert LabelStatus("new-unknown-status").value == "_MISSING_LABEL_STATUS_"


def test_frame_view(ontology):
def test_frame_view(ontology) -> None:
label_row_metadata_dict = asdict(FAKE_LABEL_ROW_METADATA)
label_row_metadata_dict["frames_per_second"] = 25
label_row_metadata_dict["duration"] = 0.2
Expand Down

0 comments on commit 63b35da

Please sign in to comment.