|
6 | 6 | Default values are provided here as a reference for implementors. |
7 | 7 | """ |
8 | 8 |
|
| 9 | +from __future__ import annotations |
| 10 | + |
9 | 11 | import abc |
10 | 12 | from typing import ( |
11 | 13 | Any, |
12 | 14 | ClassVar, |
13 | 15 | Iterator, |
14 | 16 | List, |
15 | | - Optional, |
16 | 17 | Sequence, |
17 | 18 | Tuple, |
18 | 19 | TypeVar, |
@@ -51,9 +52,9 @@ def create( |
51 | 52 | *, |
52 | 53 | schema: pa.Schema, |
53 | 54 | index_column_names: Sequence[str] = (options.SOMA_JOINID,), |
54 | | - domain: Optional[Sequence[Optional[Tuple[Any, Any]]]] = None, |
55 | | - platform_config: Optional[options.PlatformConfig] = None, |
56 | | - context: Optional[Any] = None, |
| 55 | + domain: Sequence[Tuple[Any, Any] | None] | None = None, |
| 56 | + platform_config: options.PlatformConfig | None = None, |
| 57 | + context: Any | None = None, |
57 | 58 | ) -> Self: |
58 | 59 | """Creates a new ``DataFrame`` at the given URI. |
59 | 60 |
|
@@ -112,13 +113,13 @@ def create( |
112 | 113 | def read( |
113 | 114 | self, |
114 | 115 | coords: options.SparseDFCoords = (), |
115 | | - column_names: Optional[Sequence[str]] = None, |
| 116 | + column_names: Sequence[str] | None = None, |
116 | 117 | *, |
117 | 118 | batch_size: options.BatchSize = options.BatchSize(), |
118 | | - partitions: Optional[options.ReadPartitions] = None, |
| 119 | + partitions: options.ReadPartitions | None = None, |
119 | 120 | result_order: options.ResultOrderStr = _RO_AUTO, |
120 | | - value_filter: Optional[str] = None, |
121 | | - platform_config: Optional[options.PlatformConfig] = None, |
| 121 | + value_filter: str | None = None, |
| 122 | + platform_config: options.PlatformConfig | None = None, |
122 | 123 | ) -> "ReadIter[pa.Table]": |
123 | 124 | """Reads a user-defined slice of data into Arrow tables. |
124 | 125 |
|
@@ -218,7 +219,7 @@ def write( |
218 | 219 | self, |
219 | 220 | values: Union[pa.RecordBatch, pa.Table], |
220 | 221 | *, |
221 | | - platform_config: Optional[options.PlatformConfig] = None, |
| 222 | + platform_config: options.PlatformConfig | None = None, |
222 | 223 | ) -> Self: |
223 | 224 | """Writes the data from an Arrow table to the persistent object. |
224 | 225 |
|
@@ -283,9 +284,9 @@ def create( |
283 | 284 | uri: str, |
284 | 285 | *, |
285 | 286 | type: pa.DataType, |
286 | | - shape: Sequence[Optional[int]], |
287 | | - platform_config: Optional[options.PlatformConfig] = None, |
288 | | - context: Optional[Any] = None, |
| 287 | + shape: Sequence[int | None], |
| 288 | + platform_config: options.PlatformConfig | None = None, |
| 289 | + context: Any | None = None, |
289 | 290 | ) -> Self: |
290 | 291 | """Creates a new ND array of the current type at the given URI. |
291 | 292 |
|
@@ -376,9 +377,9 @@ def read( |
376 | 377 | self, |
377 | 378 | coords: options.DenseNDCoords = (), |
378 | 379 | *, |
379 | | - partitions: Optional[options.ReadPartitions] = None, |
| 380 | + partitions: options.ReadPartitions | None = None, |
380 | 381 | result_order: options.ResultOrderStr = _RO_AUTO, |
381 | | - platform_config: Optional[options.PlatformConfig] = None, |
| 382 | + platform_config: options.PlatformConfig | None = None, |
382 | 383 | ) -> pa.Tensor: |
383 | 384 | """Reads the specified subarray as a Tensor. |
384 | 385 |
|
@@ -432,7 +433,7 @@ def write( |
432 | 433 | coords: options.DenseNDCoords, |
433 | 434 | values: pa.Tensor, |
434 | 435 | *, |
435 | | - platform_config: Optional[options.PlatformConfig] = None, |
| 436 | + platform_config: options.PlatformConfig | None = None, |
436 | 437 | ) -> Self: |
437 | 438 | """Writes an Arrow tensor to a subarray of the persistent object. |
438 | 439 |
|
@@ -476,9 +477,9 @@ def read( |
476 | 477 | coords: options.SparseNDCoords = (), |
477 | 478 | *, |
478 | 479 | batch_size: options.BatchSize = options.BatchSize(), |
479 | | - partitions: Optional[options.ReadPartitions] = None, |
| 480 | + partitions: options.ReadPartitions | None = None, |
480 | 481 | result_order: options.ResultOrderStr = _RO_AUTO, |
481 | | - platform_config: Optional[options.PlatformConfig] = None, |
| 482 | + platform_config: options.PlatformConfig | None = None, |
482 | 483 | ) -> "SparseRead": |
483 | 484 | """Reads the specified subarray in batches. |
484 | 485 |
|
@@ -537,7 +538,7 @@ def write( |
537 | 538 | self, |
538 | 539 | values: SparseArrowData, |
539 | 540 | *, |
540 | | - platform_config: Optional[options.PlatformConfig] = None, |
| 541 | + platform_config: options.PlatformConfig | None = None, |
541 | 542 | ) -> Self: |
542 | 543 | """Writes a Tensor to a subarray of the persistent object. |
543 | 544 |
|
|
0 commit comments