Skip to content

Commit

Permalink
Small type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Jul 31, 2024
1 parent b582f3b commit 18eb6b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arro3-core/python/arro3/core/_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ class DataType:
def decimal256(cls, precision: int, scale: int) -> DataType:
"""Create decimal type with precision and scale and 256-bit width."""
@classmethod
def list(cls, value_type: ArrowSchemaExportable, list_size: int | None) -> DataType:
def list(
cls, value_type: ArrowSchemaExportable, list_size: int | None = None
) -> DataType:
"""Create ListType instance from child data type or field.
Args:
Expand Down Expand Up @@ -1042,7 +1044,7 @@ class Table:
"""
def add_column(
self, i: int, field: str | ArrowSchemaExportable, column: ArrowStreamExportable
) -> RecordBatch:
) -> Table:
"""Add column to Table at position.
A new table is returned with the column added, the original table object is left unchanged.
Expand All @@ -1057,7 +1059,7 @@ class Table:
"""
def append_column(
self, field: str | ArrowSchemaExportable, column: ArrowStreamExportable
) -> RecordBatch:
) -> Table:
"""Append column at end of columns.
Args:
Expand Down
2 changes: 2 additions & 0 deletions pyo3-arrow/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ impl PyDataType {
}

#[classmethod]
#[pyo3(signature = (length=None))]
fn binary(_: &Bound<PyType>, length: Option<i32>) -> Self {
if let Some(length) = length {
Self(DataType::FixedSizeBinary(length))
Expand Down Expand Up @@ -380,6 +381,7 @@ impl PyDataType {
}

#[classmethod]
#[pyo3(signature = (value_type, list_size=None))]
fn list(_: &Bound<PyType>, value_type: PyField, list_size: Option<i32>) -> Self {
if let Some(list_size) = list_size {
Self(DataType::FixedSizeList(value_type.into(), list_size))
Expand Down

0 comments on commit 18eb6b5

Please sign in to comment.