You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jorisvandenbossche (via GitHub)" <gi...@apache.org> on 2023/04/13 14:48:01 UTC

[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #34894: GH-34868: [Python] Share docstrings between classes

jorisvandenbossche commented on code in PR #34894:
URL: https://github.com/apache/arrow/pull/34894#discussion_r1165640449


##########
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")

Review Comment:
   ```suggestion
   @doc(is_null, datatype="any integer")
   ```
   
   I would keep the "any" to clearly indicate this is for _any_ integer (i.e. all bitwidths and signed/unsigned)



##########
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:
   I think we can remove that. We don't have a clear definition of "logical" types in the arrow format spec, and the fact that a map type is basically a list of structs is an implementation detail (and adding "logical" here doesn't help making that clear)



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org