WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 909d2ff

Browse files
committed
Merge branch 'feature/geti-inspect' into status-bar-rework
2 parents 4b590c8 + 3c79f7d commit 909d2ff

35 files changed

+690
-381
lines changed

application/backend/src/api/dependencies/dependencies.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ def is_valid_uuid(identifier: str) -> bool:
105105
"""
106106
Check if a given string identifier is formatted as a valid UUID
107107
108-
:param identifier: String to check
109-
:return: True if valid UUID, False otherwise
108+
Args:
109+
identifier: String to check
110+
111+
Returns:
112+
True if valid UUID, False otherwise
110113
"""
111114
try:
112115
UUID(identifier)

application/backend/src/api/media_rest_validator.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ def validate_image_file(request: Request, file: UploadFile = File(None)) -> Uplo
1818
"""
1919
Validates a request to upload an image, if the file is not present, returns None.
2020
21-
:param request: FastAPI request that was made to upload the file
22-
:param file: uploaded image file
23-
:raises InvalidMediaException if the file name is empty or the file extension is
24-
not in the supported file extensions
25-
:raises PayloadTooLargeException when the total size of the request exceeds 8GB
21+
Args:
22+
request: FastAPI request that was made to upload the file
23+
file: uploaded image file
24+
25+
Raises:
26+
InvalidMediaException: if the file name is empty or the file extension is
27+
not in the supported file extensions
28+
PayloadTooLargeException: when the total size of the request exceeds 8GB
29+
30+
Returns:
31+
UploadFile if valid, None if file is not present
2632
"""
2733
if file is None:
2834
return None

application/backend/src/entities/images_folder_stream.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def __init__(self, folder_path: str, ignore_existing_images: bool) -> None:
6666
def _init_watchdog(self, folder_path: str) -> None:
6767
"""
6868
Initialize the watchdog to monitor images folder events.
69-
:param folder_path: path to the folder with images
69+
70+
Args:
71+
folder_path: path to the folder with images
7072
"""
7173
event_handler = ImagesFolderEventHandler(
7274
self.file_added,

application/backend/src/exceptions.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ class GetiBaseException(Exception):
88
"""
99
Base class for Geti exceptions with a predefined HTTP error code.
1010
11-
:param message: str message providing short description of error
12-
:param error_code: str id of error
13-
:param http_status: int default http status code to return to user
11+
Args:
12+
message: str message providing short description of error
13+
error_code: str id of error
14+
http_status: int default http status code to return to user
1415
"""
1516

1617
def __init__(self, message: str, error_code: str, http_status: int) -> None:
@@ -24,7 +25,8 @@ class InvalidMediaException(GetiBaseException):
2425
"""
2526
Exception raised when uploaded media file is invalid.
2627
27-
:param message: str containing a custom message.
28+
Args:
29+
message: str containing a custom message.
2830
"""
2931

3032
def __init__(self, message: str) -> None:
@@ -39,7 +41,8 @@ class PayloadTooLargeException(GetiBaseException):
3941
"""
4042
Exception raised when the request payload is too large.
4143
42-
:param max_size: Max size in MB
44+
Args:
45+
max_size: Max size in MB
4346
"""
4447

4548
def __init__(self, max_size: float) -> None:
@@ -54,7 +57,8 @@ class DuplicateJobException(GetiBaseException):
5457
"""
5558
Exception raised when attempting to submit a duplicate job.
5659
57-
:param message: str containing a custom message about the duplicate job.
60+
Args:
61+
message: str containing a custom message about the duplicate job.
5862
"""
5963

6064
def __init__(self, message: str = "A job with the same payload is already running or queued") -> None:
@@ -69,7 +73,8 @@ class ResourceNotFoundException(GetiBaseException):
6973
"""
7074
Exception raised when a resource could not be found in database.
7175
72-
:param resource_id: ID of the resource that was not found
76+
Args:
77+
resource_id: ID of the resource that was not found
7378
"""
7479

7580
def __init__(self, resource_id: str | UUID, resource_name: str) -> None:

application/backend/src/repositories/binary_repo.py

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ async def read_file(self, filename: str) -> bytes:
3131
"""
3232
Read a binary file from the filesystem.
3333
34-
:param filename: Relative path to the file.
35-
:return: Binary content of the file.
34+
Args:
35+
filename: Relative path to the file.
36+
37+
Returns:
38+
Binary content of the file.
3639
"""
3740

3841
def stdlib_read():
@@ -56,17 +59,23 @@ def get_full_path(self, filename: str) -> str:
5659
"""
5760
Get the full path for a given filename within the project folder.
5861
59-
:param filename: Name of the file.
60-
:return: Full path to the file.
62+
Args:
63+
filename: Name of the file.
64+
65+
Returns:
66+
Full path to the file.
6167
"""
6268

6369
async def save_file(self, filename: str, content: bytes) -> str:
6470
"""
6571
Save a binary file to the filesystem under the project directory.
6672
67-
:param filename: Name of the file to save.
68-
:param content: Binary content of the file.
69-
:return: The path where the file was saved.
73+
Args:
74+
filename: Name of the file to save.
75+
content: Binary content of the file.
76+
77+
Returns:
78+
The path where the file was saved.
7079
"""
7180

7281
def stdlib_write():
@@ -87,7 +96,8 @@ async def delete_file(self, filename: str) -> None:
8796
"""
8897
Delete a binary file from the filesystem.
8998
90-
:param filename: Name of the file to delete.
99+
Args:
100+
filename: Name of the file to delete.
91101
"""
92102

93103
def stdlib_delete():
@@ -122,8 +132,11 @@ def get_snapshot_path(self, snapshot_id: str | UUID) -> str:
122132
"""
123133
Get the full path for a dataset snapshot.
124134
125-
:param snapshot_id: ID of the snapshot.
126-
:return: Full path to the snapshot file.
135+
Args:
136+
snapshot_id: ID of the snapshot.
137+
138+
Returns:
139+
Full path to the snapshot file.
127140
"""
128141
return self.get_full_path(f"{snapshot_id}.parquet")
129142

@@ -149,7 +162,8 @@ def model_folder_path(self) -> str:
149162
"""
150163
Get the folder path for models.
151164
152-
:return: Folder path for models.
165+
Returns:
166+
Folder path for models.
153167
"""
154168
return os.path.join(self.project_folder_path, self._model_id)
155169

@@ -171,9 +185,12 @@ def get_weights_file_path(self, format: ExportType, name: str) -> str:
171185
"""
172186
Read a weights file from the model folder.
173187
174-
:param format: Format of the model (e.g., ExportType.OPENVINO).
175-
:param name: Name of the weights to read.
176-
:return: path of the weights file.
188+
Args:
189+
format: Format of the model (e.g., ExportType.OPENVINO).
190+
name: Name of the weights to read.
191+
192+
Returns:
193+
path of the weights file.
177194
"""
178195
return os.path.join(self.model_folder_path, "weights", format, name)
179196

@@ -191,17 +208,21 @@ def model_export_folder_path(self) -> str:
191208
"""
192209
Get the folder path for model exports.
193210
194-
:return: Folder path for model exports.
211+
Returns:
212+
Folder path for model exports.
195213
"""
196214
return os.path.join(self.project_folder_path, self._model_id)
197215

198216
def get_model_export_path(self, model_name: str, export_params: ExportParameters) -> str:
199217
"""
200218
Get the full path for a dataset snapshot.
201219
202-
:param model_name: name of the model
203-
:param export_params: model export parameters
204-
:return: Full path to the model export zip file.
220+
Args:
221+
model_name: name of the model
222+
export_params: model export parameters
223+
224+
Returns:
225+
Full path to the model export zip file.
205226
"""
206227
compression_suffix = f"_{export_params.compression.value}" if export_params.compression else ""
207228
filename = f"{model_name}_{export_params.format.value}{compression_suffix}.zip"

application/ui/src/components/virtualizer-grid-layout/grid-media-item/grid-media-item.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
line-height: 0px;
1111
padding: var(--spectrum-global-dimension-size-125);
1212
border-radius: var(--spectrum-global-dimension-size-50);
13+
background-color: var(--spectrum-gray-100);
1314

1415
&:empty {
1516
display: none;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Image } from '@geti-inspect/icons';
2+
import { Flex } from '@geti/ui';
3+
import { clsx } from 'clsx';
4+
5+
import styles from './dataset-item-placeholder.module.scss';
6+
7+
export const DatasetItemPlaceholder = () => {
8+
return (
9+
<Flex justifyContent={'center'} alignItems={'center'} UNSAFE_className={clsx(styles.datasetItemPlaceholder)}>
10+
<Image />
11+
</Flex>
12+
);
13+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.datasetItemPlaceholder {
2+
width: 100%;
3+
height: 100%;
4+
aspect-ratio: auto;
5+
border: 1px dashed var(--spectrum-global-color-gray-700);
6+
background-color: var(--spectrum-global-color-gray-200);
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { MediaItem } from '../types';
2+
3+
const PLACEHOLDER_FILENAME = 'placeholder';
4+
5+
export const isPlaceholderItem = (name: string): boolean => {
6+
return name.includes(PLACEHOLDER_FILENAME);
7+
};
8+
9+
export const getPlaceholderItem = (index: number): MediaItem => {
10+
return {
11+
id: `${PLACEHOLDER_FILENAME}-${index}`,
12+
filename: PLACEHOLDER_FILENAME,
13+
project_id: '',
14+
size: 0,
15+
is_anomalous: false,
16+
width: 0,
17+
height: 0,
18+
};
19+
};

application/ui/src/features/inspect/dataset/dataset-item/dataset-item-placeholder.component.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)