-
Notifications
You must be signed in to change notification settings - Fork 4
LABIMP-7672 | Video Keyframe upload #36
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
Changes from all commits
e833f55
7227696
677e2e2
a2cadb6
9a7bf4d
cffbb31
529edfa
52f6b3c
012762e
33060af
8f6e556
4e92d06
2b1b7cb
2e11a4b
58567b8
93a4579
85041ad
9abc091
4958c4b
eac98e4
0636123
5ea0b90
9ed67cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| [flake8] | ||
| max-line-length = 200 | ||
| extend-ignore = E203, W503, E402, F405 | ||
| exclude = .git,__pycache__,.venv,build,dist,venv,driver.py | ||
| exclude = .git,__pycache__,.venv,build,dist,venv,driver.py,.history |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,3 +30,4 @@ download | |
| labellerr/__pycache__/ | ||
| env.* | ||
| claude.md | ||
| .history/ | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||
| BASE_URL = "https://api.labellerr.com" | ||||||||||
| BASE_URL = "https://api-gateway-qcb3iv2gaa-uc.a.run.app" | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL SECURITY ISSUE: The BASE_URL has been changed to a development/staging environment (
Suggested change
This looks like a development configuration that was accidentally committed. Please revert this change before merging. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Hardcoded Development/QA API URL The BASE_URL is pointing to a non-production API endpoint ( Impact:
Security Risk: HIGH Recommendation:
Suggested change
|
||||||||||
| ALLOWED_ORIGINS = "https://pro.labellerr.com" | ||||||||||
|
|
||||||||||
|
|
||||||||||
|
|
@@ -7,7 +7,7 @@ | |||||||||
| TOTAL_FILES_SIZE_LIMIT_PER_DATASET = 2.5 * 1024 * 1024 * 1024 # 2.5GB | ||||||||||
| TOTAL_FILES_COUNT_LIMIT_PER_DATASET = 2500 | ||||||||||
|
|
||||||||||
| ANNOTATION_FORMAT = ["json", "coco_json", "csv", "png"] | ||||||||||
| ANNOTATION_FORMAT = ["json", "coco_json", "csv", "png", "video_json"] | ||||||||||
| LOCAL_EXPORT_FORMAT = ["json", "coco_json", "csv", "png"] | ||||||||||
| LOCAL_EXPORT_STATUS = [ | ||||||||||
| "review", | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,14 +4,13 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import uuid | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from abc import ABCMeta | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import Dict, Any, List, TYPE_CHECKING | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import TYPE_CHECKING, Any, Dict, Generator | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| from .. import constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..exceptions import InvalidDatasetError, LabellerrError | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..client import LabellerrClient | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..files import LabellerrFile | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..connectors import LabellerrConnection | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..exceptions import InvalidDatasetError, LabellerrError | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..files import LabellerrFile | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if TYPE_CHECKING: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ..projects import LabellerrProject | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -175,15 +174,22 @@ def on_success(dataset_data): | |||||||||||||||||||||||||||||||||||||||||||||||||||
| on_success=on_success, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def fetch_files(self, page_size: int = 1000) -> List[LabellerrFile]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| def fetch_files( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self, page_size: int = 1000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Generator[LabellerrFile, None, None]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| def fetch_files( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self, page_size: int = 1000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Generator[LabellerrFile, None, None]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+177
to
+182
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Duplicate Method Signature The method signature for Impact:
Recommendation:
Suggested change
Remove the duplicate lines 180-189. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Fetch all files in this dataset as LabellerrFile instances. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param page_size: Number of files to fetch per API request (default: 10) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :return: List of file IDs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param page_size: Number of files to fetch per API request (default: 1000) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :return: Generator yielding LabellerrFile instances | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param page_size: Number of files to fetch per API request (default: 1000) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :return: Generator yielding LabellerrFile instances | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Fetching files for dataset: {self.dataset_id}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| file_ids = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logging.info(f"Fetching files for dataset: {self.dataset_id}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logging.info(f"Fetching files for dataset: {self.dataset_id}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+191
to
+192
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code Quality: Duplicate Logging Statement The same logging statement appears twice on consecutive lines. This is redundant. Recommendation:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| next_search_after = None # Start with None for first page | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| while True: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -205,15 +211,26 @@ def fetch_files(self, page_size: int = 1000) -> List[LabellerrFile]: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| response = self.client.make_request( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "GET", url, extra_headers=None, request_id=unique_id, params=params | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(response) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Extract files from the response | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| files = response.get("response", {}).get("files", []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Collect file IDs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for file_info in files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| file_id = file_info.get("file_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if file_id: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| file_ids.append(file_id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for file_data in files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| _file = LabellerrFile.from_file_data(self.client, file_data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| yield _file | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| except LabellerrError as e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logging.warning( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"Warning: Failed to create file instance for {file_data.get('file_id')}: {str(e)}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for file_data in files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| _file = LabellerrFile.from_file_data(self.client, file_data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| yield _file | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| except LabellerrError as e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logging.warning( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"Warning: Failed to create file instance for {file_data.get('file_id')}: {str(e)}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+218
to
+233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Duplicate Loop Logic The same for-loop appears twice (lines 218-225 and 226-233), processing files and yielding them. This will cause each file to be yielded twice. Impact:
Recommendation:
Suggested change
Remove the duplicate loop (lines 226-233). |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get next_search_after for pagination | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| next_search_after = response.get("response", {}).get("next_search_after") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -222,23 +239,6 @@ def fetch_files(self, page_size: int = 1000) -> List[LabellerrFile]: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| if not next_search_after or not files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| files = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| for file_id in file_ids: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| _file = LabellerrFile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| client=self.client, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| file_id=file_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| dataset_id=self.dataset_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| files.append(_file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| except LabellerrError as e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logging.warning( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"Warning: Failed to create file instance for {file_id}: {str(e)}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| return files | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def sync_with_connection( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| project: "LabellerrProject", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRITICAL: Duplicate Function Definition
The
list_templatesfunction is defined twice (lines 74-99 and 102-127) with identical implementations. This is a copy-paste error that will cause issues.Impact:
Recommendation:
Delete one of these duplicate definitions.