danepitkin commented on code in PR #34894:
URL: https://github.com/apache/arrow/pull/34894#discussion_r1160100765
##########
python/pyarrow/types.py:
##########
@@ -407,155 +223,71 @@ def is_unicode(t):
return is_string(t)
+@doc(is_null, datatype="string (utf8 unicode)")
def is_string(t):
- """
- Return True if value is an instance of string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_STRING
+@doc(is_unicode, method="is_large_string")
def is_large_unicode(t):
- """
- Alias for is_large_string.
-
- Parameters
- ----------
- t : DataType
- """
return is_large_string(t)
+@doc(is_null, datatype="large string (utf8 unicode)")
def is_large_string(t):
- """
- Return True if value is an instance of large string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_LARGE_STRING
+@doc(is_null, datatype="fixed size binary")
def is_fixed_size_binary(t):
- """
- Return True if value is an instance of a fixed size binary type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_FIXED_SIZE_BINARY
+@doc(is_null, datatype="date")
def is_date(t):
- """
- Return True if value is an instance of a date type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DATE_TYPES
+@doc(is_null, datatype="date32 (days)")
def is_date32(t):
- """
- Return True if value is an instance of a date32 (days) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE32
+@doc(is_null, datatype="date64 (milliseconds)")
def is_date64(t):
- """
- Return True if value is an instance of a date64 (milliseconds) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE64
+@doc(is_null, datatype="logical map")
Review Comment:
Do we want to keep "logical" in `logical map`?
##########
python/pyarrow/types.py:
##########
@@ -54,351 +56,165 @@ def is_null(t):
return t.id == lib.Type_NA
+@doc(is_null, datatype="boolean")
def is_boolean(t):
- """
- Return True if value is an instance of a boolean type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_BOOL
+@doc(is_null, datatype="integer")
def is_integer(t):
- """
- Return True if value is an instance of any integer type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _INTEGER_TYPES
+@doc(is_null, datatype="signed integer")
def is_signed_integer(t):
- """
- Return True if value is an instance of any signed integer type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _SIGNED_INTEGER_TYPES
+@doc(is_null, datatype="unsigned integer")
def is_unsigned_integer(t):
- """
- Return True if value is an instance of any unsigned integer type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _UNSIGNED_INTEGER_TYPES
+@doc(is_null, datatype="int8")
def is_int8(t):
- """
- Return True if value is an instance of an int8 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_INT8
+@doc(is_null, datatype="int16")
def is_int16(t):
- """
- Return True if value is an instance of an int16 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_INT16
+@doc(is_null, datatype="int32")
def is_int32(t):
- """
- Return True if value is an instance of an int32 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_INT32
+@doc(is_null, datatype="int64")
def is_int64(t):
- """
- Return True if value is an instance of an int64 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_INT64
+@doc(is_null, datatype="uint8")
def is_uint8(t):
- """
- Return True if value is an instance of an uint8 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_UINT8
+@doc(is_null, datatype="uint16")
def is_uint16(t):
- """
- Return True if value is an instance of an uint16 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_UINT16
+@doc(is_null, datatype="uint32")
def is_uint32(t):
- """
- Return True if value is an instance of an uint32 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_UINT32
+@doc(is_null, datatype="uint64")
def is_uint64(t):
- """
- Return True if value is an instance of an uint64 type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_UINT64
+@doc(is_null, datatype="floating point numeric")
def is_floating(t):
- """
- Return True if value is an instance of a floating point numeric type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _FLOATING_TYPES
+@doc(is_null, datatype="float16 (half-precision)")
def is_float16(t):
- """
- Return True if value is an instance of a float16 (half-precision) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_HALF_FLOAT
+@doc(is_null, datatype="float32 (single precision)")
def is_float32(t):
- """
- Return True if value is an instance of a float32 (single precision) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_FLOAT
+@doc(is_null, datatype="float64 (double precision)")
def is_float64(t):
- """
- Return True if value is an instance of a float64 (double precision) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DOUBLE
+@doc(is_null, datatype="list")
def is_list(t):
- """
- Return True if value is an instance of a list type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_LIST
+@doc(is_null, datatype="large list")
def is_large_list(t):
- """
- Return True if value is an instance of a large list type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_LARGE_LIST
+@doc(is_null, datatype="fixed size list")
def is_fixed_size_list(t):
- """
- Return True if value is an instance of a fixed size list type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_FIXED_SIZE_LIST
+@doc(is_null, datatype="struct")
def is_struct(t):
- """
- Return True if value is an instance of a struct type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_STRUCT
+@doc(is_null, datatype="union")
def is_union(t):
- """
- Return True if value is an instance of a union type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _UNION_TYPES
+@doc(is_null, datatype="nested")
Review Comment:
Do we like `nested` or `nested type`?
##########
python/pyarrow/types.py:
##########
@@ -407,155 +223,71 @@ def is_unicode(t):
return is_string(t)
+@doc(is_null, datatype="string (utf8 unicode)")
def is_string(t):
- """
- Return True if value is an instance of string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_STRING
+@doc(is_unicode, method="is_large_string")
def is_large_unicode(t):
- """
- Alias for is_large_string.
-
- Parameters
- ----------
- t : DataType
- """
return is_large_string(t)
+@doc(is_null, datatype="large string (utf8 unicode)")
def is_large_string(t):
- """
- Return True if value is an instance of large string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_LARGE_STRING
+@doc(is_null, datatype="fixed size binary")
def is_fixed_size_binary(t):
- """
- Return True if value is an instance of a fixed size binary type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_FIXED_SIZE_BINARY
+@doc(is_null, datatype="date")
def is_date(t):
- """
- Return True if value is an instance of a date type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DATE_TYPES
+@doc(is_null, datatype="date32 (days)")
def is_date32(t):
- """
- Return True if value is an instance of a date32 (days) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE32
+@doc(is_null, datatype="date64 (milliseconds)")
def is_date64(t):
- """
- Return True if value is an instance of a date64 (milliseconds) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE64
+@doc(is_null, datatype="logical map")
def is_map(t):
- """
- Return True if value is an instance of a map logical type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_MAP
+@doc(is_null, datatype="decimal")
def is_decimal(t):
- """
- Return True if value is an instance of a decimal type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DECIMAL_TYPES
+@doc(is_null, datatype="decimal128")
def is_decimal128(t):
- """
- Return True if value is an instance of a decimal type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DECIMAL128
+@doc(is_null, datatype="decimal256")
Review Comment:
Added "256" to `decimal256` here.
##########
python/pyarrow/types.py:
##########
@@ -407,155 +223,71 @@ def is_unicode(t):
return is_string(t)
+@doc(is_null, datatype="string (utf8 unicode)")
def is_string(t):
- """
- Return True if value is an instance of string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_STRING
+@doc(is_unicode, method="is_large_string")
def is_large_unicode(t):
- """
- Alias for is_large_string.
-
- Parameters
- ----------
- t : DataType
- """
return is_large_string(t)
+@doc(is_null, datatype="large string (utf8 unicode)")
def is_large_string(t):
- """
- Return True if value is an instance of large string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_LARGE_STRING
+@doc(is_null, datatype="fixed size binary")
def is_fixed_size_binary(t):
- """
- Return True if value is an instance of a fixed size binary type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_FIXED_SIZE_BINARY
+@doc(is_null, datatype="date")
def is_date(t):
- """
- Return True if value is an instance of a date type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DATE_TYPES
+@doc(is_null, datatype="date32 (days)")
def is_date32(t):
- """
- Return True if value is an instance of a date32 (days) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE32
+@doc(is_null, datatype="date64 (milliseconds)")
def is_date64(t):
- """
- Return True if value is an instance of a date64 (milliseconds) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE64
+@doc(is_null, datatype="logical map")
def is_map(t):
- """
- Return True if value is an instance of a map logical type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_MAP
+@doc(is_null, datatype="decimal")
def is_decimal(t):
- """
- Return True if value is an instance of a decimal type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DECIMAL_TYPES
+@doc(is_null, datatype="decimal128")
def is_decimal128(t):
- """
- Return True if value is an instance of a decimal type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DECIMAL128
+@doc(is_null, datatype="decimal256")
def is_decimal256(t):
- """
- Return True if value is an instance of a decimal type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DECIMAL256
+@doc(is_null, datatype="dictionary-encoded")
def is_dictionary(t):
- """
- Return True if value is an instance of a dictionary-encoded type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DICTIONARY
+@doc(is_null, datatype="interval")
def is_interval(t):
- """
- Return True if the value is an instance of an interval type.
-
- Parameters
- ----------
- t : DateType
- """
return t.id == lib.Type_INTERVAL_MONTH_DAY_NANO
+@doc(is_null, datatype="primitive")
Review Comment:
Do we like `primitive` or `primitive type` better?
##########
python/pyarrow/types.py:
##########
@@ -407,155 +223,71 @@ def is_unicode(t):
return is_string(t)
+@doc(is_null, datatype="string (utf8 unicode)")
def is_string(t):
- """
- Return True if value is an instance of string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_STRING
+@doc(is_unicode, method="is_large_string")
def is_large_unicode(t):
- """
- Alias for is_large_string.
-
- Parameters
- ----------
- t : DataType
- """
return is_large_string(t)
+@doc(is_null, datatype="large string (utf8 unicode)")
def is_large_string(t):
- """
- Return True if value is an instance of large string (utf8 unicode) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_LARGE_STRING
+@doc(is_null, datatype="fixed size binary")
def is_fixed_size_binary(t):
- """
- Return True if value is an instance of a fixed size binary type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_FIXED_SIZE_BINARY
+@doc(is_null, datatype="date")
def is_date(t):
- """
- Return True if value is an instance of a date type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DATE_TYPES
+@doc(is_null, datatype="date32 (days)")
def is_date32(t):
- """
- Return True if value is an instance of a date32 (days) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE32
+@doc(is_null, datatype="date64 (milliseconds)")
def is_date64(t):
- """
- Return True if value is an instance of a date64 (milliseconds) type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_DATE64
+@doc(is_null, datatype="logical map")
def is_map(t):
- """
- Return True if value is an instance of a map logical type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id == lib.Type_MAP
+@doc(is_null, datatype="decimal")
def is_decimal(t):
- """
- Return True if value is an instance of a decimal type.
-
- Parameters
- ----------
- t : DataType
- """
return t.id in _DECIMAL_TYPES
+@doc(is_null, datatype="decimal128")
Review Comment:
Added "128" to `decimal128` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]