Skip to content

Commit 058d597

Browse files
author
Val Brodsky
committed
Fix deprecation warnings
1 parent cda69b7 commit 058d597

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

libs/labelbox/src/labelbox/data/annotation_types/geometry/mask.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
from typing import Callable, Optional, Tuple, Union, Dict, List
1+
from typing import Callable, Dict, List, Optional, Tuple, Union
22

3-
import numpy as np
43
import cv2
5-
4+
import numpy as np
5+
from pydantic import field_validator
66
from shapely.geometry import MultiPolygon, Polygon
77

88
from ..data import MaskData
99
from .geometry import Geometry
1010

11-
from pydantic import field_validator
12-
1311

1412
class Mask(Geometry):
1513
"""Mask used to represent a single class in a larger segmentation mask
@@ -91,7 +89,7 @@ def draw(
9189
as opposed to the mask that this object references which might have multiple objects determined by colors
9290
"""
9391
mask = self.mask.value
94-
mask = np.alltrue(mask == self.color, axis=2).astype(np.uint8)
92+
mask = np.all(mask == self.color, axis=2).astype(np.uint8)
9593

9694
if height is not None or width is not None:
9795
mask = cv2.resize(

libs/labelbox/src/labelbox/schema/data_row_metadata.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
conlist,
2727
model_serializer,
2828
)
29+
from typing_extensions import Annotated
2930

3031
from labelbox.schema.identifiable import GlobalKey, UniqueId
3132
from labelbox.schema.identifiables import DataRowIdentifiers, UniqueIds
@@ -423,7 +424,7 @@ def update_enum_option(
423424
schema = self._validate_custom_schema_by_name(name)
424425
if schema.kind != DataRowMetadataKind.enum:
425426
raise ValueError(
426-
f"Updating Enum option is only supported for Enum metadata schema"
427+
"Updating Enum option is only supported for Enum metadata schema"
427428
)
428429
valid_options: List[str] = [o.name for o in schema.options]
429430

@@ -757,10 +758,6 @@ def bulk_export(self, data_row_ids) -> List[DataRowMetadata]:
757758
and isinstance(data_row_ids[0], str)
758759
):
759760
data_row_ids = UniqueIds(data_row_ids)
760-
warnings.warn(
761-
"Using data row ids will be deprecated. Please use "
762-
"UniqueIds or GlobalKeys instead."
763-
)
764761

765762
def _bulk_export(
766763
_data_row_ids: DataRowIdentifiers,

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,6 @@ def update_data_row_labeling_priority(
13391339

13401340
if isinstance(data_rows, list):
13411341
data_rows = UniqueIds(data_rows)
1342-
warnings.warn(
1343-
"Using data row ids will be deprecated. Please use "
1344-
"UniqueIds or GlobalKeys instead."
1345-
)
13461342

13471343
method = "createQueuePriorityUpdateTask"
13481344
priority_param = "priority"
@@ -1513,10 +1509,6 @@ def move_data_rows_to_task_queue(self, data_row_ids, task_queue_id: str):
15131509
"""
15141510
if isinstance(data_row_ids, list):
15151511
data_row_ids = UniqueIds(data_row_ids)
1516-
warnings.warn(
1517-
"Using data row ids will be deprecated. Please use "
1518-
"UniqueIds or GlobalKeys instead."
1519-
)
15201512

15211513
method = "createBulkAddRowsToQueueTask"
15221514
query_str = (

libs/labelbox/tests/data/test_data_row_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def big_dataset(dataset: Dataset, image_url):
6161

6262
def make_metadata(dr_id: str = None, gk: str = None) -> DataRowMetadata:
6363
msg = "A message"
64-
time = datetime.utcnow()
64+
time = datetime.now(timezone.utc),
6565

6666
metadata = DataRowMetadata(
6767
global_key=gk,
@@ -124,7 +124,7 @@ def test_get_datarow_metadata_ontology(mdo):
124124
fields=[
125125
DataRowMetadataField(
126126
schema_id=mdo.reserved_by_name["captureDateTime"].uid,
127-
value=datetime.utcnow(),
127+
value=datetime.now(timezone.utc),
128128
),
129129
DataRowMetadataField(schema_id=split.parent, value=split.uid),
130130
DataRowMetadataField(

0 commit comments

Comments
 (0)