Skip to content
/ arrow Public
forked from apache/arrow

Commit

Permalink
apacheGH-45003: [Python][Docs] Update docstrings for metadata methods…
Browse files Browse the repository at this point in the history
… on Field and Schema classes (apache#45004)

### Rationale for this change

The docstrings here are not completely accurate. See apache#45003.

I looked at whether it would make more sense or be more natural for methods like these to return an empty `dict` instead of None and I think None feels better from an API design and usage perspective.

### What changes are included in this PR?

Updated docstrings to reflect actual behavior.

### Are these changes tested?

While the changes don't need testing, I did check to see if we have unit tests for the behavior that's been documented here. We do.

### Are there any user-facing changes?

Accurate docs.
* GitHub Issue: apache#45003

Authored-by: Bryce Mecum <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
  • Loading branch information
amoeba authored Dec 13, 2024
1 parent 9016a83 commit a1627b9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/pyarrow/types.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,11 @@ cdef class Field(_Weakrefable):
@property
def metadata(self):
"""
The field metadata.
The field metadata (if any is set).
Returns
-------
metadata : dict or None
Examples
--------
Expand Down Expand Up @@ -2982,11 +2986,11 @@ cdef class Schema(_Weakrefable):
@property
def metadata(self):
"""
The schema's metadata.
The schema's metadata (if any is set).
Returns
-------
metadata: dict
metadata: dict or None
Examples
--------
Expand Down

0 comments on commit a1627b9

Please sign in to comment.