Follow-up from PR #23558 review: Unspecified() already always returns a singleton, so it's
unclear whether the module-level UNSPECIFIED instance is still needed, or if Unspecified()
should just be used directly wherever a sentinel is required:
|
class Unspecified: |
|
""" |
|
Sentinel value meaning "no value was explicitly provided". |
|
|
|
The singleton instance :data:`UNSPECIFIED` is used as the default for every |
|
:class:`StreamingOptions` field, as well as for |
|
``ParquetOptions.prefetch_file_metadata``. When a field is still |
|
``UNSPECIFIED`` after construction (i.e. neither an explicit value nor a |
|
matching environment variable was provided), the consuming component decides |
|
on the semantics. |
|
""" |
|
|
|
_instance: Unspecified | None = None |
|
|
|
def __new__(cls) -> Unspecified: |
|
"""Return the singleton instance.""" |
|
if cls._instance is None: |
|
cls._instance = super().__new__(cls) |
|
return cls._instance |
|
|
|
def __repr__(self) -> str: |
|
"""Return ``"UNSPECIFIED"``.""" |
|
return "UNSPECIFIED" |
|
|
|
|
|
UNSPECIFIED = Unspecified() |
Related
Follow-up from PR #23558 review:
Unspecified()already always returns a singleton, so it'sunclear whether the module-level
UNSPECIFIEDinstance is still needed, or ifUnspecified()should just be used directly wherever a sentinel is required:
cudf/python/cudf_polars/cudf_polars/utils/config.py
Lines 68 to 93 in d4ecace
Related
plc.io.parquet.read_parquetwith prefetched parquet file metadata. #23558plc.io.parquet.read_parquetwith prefetched parquet file metadata. #23558 (comment)