danepitkin opened a new pull request, #34894:
URL: https://github.com/apache/arrow/pull/34894

   ### Rationale for this change
   
   Python classes sometimes duplicate docstrings, but change one word such as 
class name. Add a decorator function as a utility to help deduplicate docstring 
descriptions. Only works in Python. Does not work in Cython due to this CPython 
issue https://github.com/python/cpython/issues/91309.
   
   ### What changes are included in this PR?
   
   Add a decorator `@doc` that can copy, concatenate, and/or format docstrings 
between classes.
   
   ### Are these changes tested?
   
   Tests added. 
   
   ```
   >>> import pyarrow
   >>> from pyarrow.filesystem import FileSystem, LocalFileSystem, 
DaskFileSystem, S3FSWrapper
   >>> from pyarrow.hdfs import HadoopFileSystem
   >>> for fs in [FileSystem, LocalFileSystem, DaskFileSystem, S3FSWrapper, 
HadoopFileSystem]:
   ...     print(fs.__name__)
   ...     print(fs.isdir.__doc__)
   ... 
   FileSystem
   
           Return True if path is a directory.
   
           Parameters
           ----------
           path : str
               Path to check.
           
   LocalFileSystem
   
   Return True if path is a directory.
   
   Parameters
   ----------
   path : str
       Path to check.
   
   DaskFileSystem
   
   Return True if path is a directory.
   
   Parameters
   ----------
   path : str
       Path to check.
   
   S3FSWrapper
   
   Return True if path is a directory.
   
   Parameters
   ----------
   path : str
       Path to check.
   
   HadoopFileSystem
   
   Return True if path is a directory.
   
   Parameters
   ----------
   path : str
       Path to check.
   
   ```
   Note that `FileSystem.isdir.__doc__` is not dedented because it does not use 
the `@doc` decorator.
   
   ### Are there any user-facing changes?
   
   No


-- 
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]

Reply via email to