Skip to content

Commit 78f87a7

Browse files
committed
[QQC-506] Rename CATALOG to BATCHES in QueueMode
1 parent 8efb3d9 commit 78f87a7

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
# Version 0.0.0 (YYYY-MM-DD) - In Progress
4+
5+
### Changed
6+
* Update QueueMode enum to support new value for QueueMode.Batch = `BATCHES`.
7+
38
# Version 3.27.2 (2022-10-04)
49

510
### Added

labelbox/schema/queue_mode.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
from enum import Enum
22

3+
import logging
4+
5+
logger = logging.getLogger(__name__)
6+
37

48
class QueueMode(str, Enum):
5-
Batch = "CATALOG"
9+
Batch = "BATCHES"
610
Dataset = "DATA_SET"
11+
12+
@classmethod
13+
def _missing_(cls, value):
14+
# Parses the deprecated "CATALOG" value back to QueueMode.Batch.
15+
if value == "CATALOG":
16+
return QueueMode.Batch

tests/unit/test_queue_mode.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pytest
2+
3+
from labelbox.schema.queue_mode import QueueMode
4+
5+
6+
def test_parse_deprecated_catalog():
7+
assert QueueMode("CATALOG") == QueueMode.Batch
8+
9+
10+
def test_parse_batches():
11+
assert QueueMode("BATCHES") == QueueMode.Batch
12+
13+
14+
def test_parse_data_set():
15+
assert QueueMode("DATA_SET") == QueueMode.Dataset
16+
17+
18+
def test_fails_for_unknown():
19+
with pytest.raises(ValueError):
20+
QueueMode("foo")

0 commit comments

Comments
 (0)