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

Minor code cleanup #449

Merged
merged 1 commit into from
Oct 16, 2023
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
13 changes: 2 additions & 11 deletions encord/objects/ontology_labels_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,13 +1003,8 @@ def _to_object_actions(self) -> Dict[str, Any]:
def _to_classification_answers(self) -> Dict[str, Any]:
ret: Dict[str, Any] = {}
for classification in self._classifications_map.values():
classifications = []

all_static_answers = classification.get_all_static_answers()
for answer in all_static_answers:
if answer.is_answered():
classifications.append(answer.to_encord_dict())

classifications = [answer.to_encord_dict() for answer in all_static_answers if answer.is_answered()]
ret[classification.classification_hash] = {
"classifications": list(reversed(classifications)),
"classificationHash": classification.classification_hash,
Expand All @@ -1036,12 +1031,8 @@ def _dynamic_answers_to_encord_dict(object_instance: ObjectInstance) -> List[Dic
return ret

def _to_encord_data_units(self) -> Dict[str, Any]:
ret = {}
frame_level_data = self._label_row_read_only_data.frame_level_data
for value in frame_level_data.values():
ret[value.image_hash] = self._to_encord_data_unit(value)

return ret
return {value.image_hash: self._to_encord_data_unit(value) for value in frame_level_data.values()}

def _to_encord_data_unit(self, frame_level_data: FrameLevelImageGroupData) -> Dict[str, Any]:
ret: Dict[str, Any] = {}
Expand Down
3 changes: 1 addition & 2 deletions encord/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,7 @@ def list_collaborator_timers(
Path("analytics/collaborators/timers"), params=params, result_type=Page[CollaboratorTimer]
)

for result in page.results:
yield result
yield from page.results

if page.next_page_token is not None:
params.page_token = page.next_page_token
Expand Down
6 changes: 1 addition & 5 deletions encord/user_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,7 @@ def __get_images_paths(self, annotations_base64: str, images_directory_path: Pat
@staticmethod
def __get_recursive_image_paths(images_directory_path: Path) -> List[Path]:
"""Recursively get all the images in all the sub folders."""
ret = []
for file in images_directory_path.glob("**/*"):
if file.is_file():
ret.append(file)
return ret
return [file for file in images_directory_path.glob("**/*") if file.is_file()]

def __upload_cvat_images(
self, images_paths: List[Path], used_base_path: Path, dataset_name: str
Expand Down
Loading