We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e39cec commit bd51de3Copy full SHA for bd51de3
1 file changed
src/thread/thread.py
@@ -439,6 +439,16 @@ def __init__(
439
"""
440
assert 0 <= max_threads, 'max_threads cannot be set to 0'
441
442
+ # Enforce required arguments
443
+ if not isinstance(dataset, SupportsLength):
444
+ assert (
445
+ _length
446
+ ), '`_length` must be set if `dataset` does not support `__len__`'
447
+
448
+ if not hasattr(dataset, '__getitem__'):
449
450
+ _get_value
451
+ ), '`_get_value` must be set if `dataset` does not support `__getitem__`'
452
453
_length = _length(dataset) if callable(_length) else _length
454
_length = len(dataset) if isinstance(dataset, SupportsLength) else _length
0 commit comments