Skip to content

Commit

Permalink
Update reprs appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed Aug 23, 2022
1 parent 76f924e commit febd2ef
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
32 changes: 16 additions & 16 deletions python/pyarrow/io.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ cdef class NativeFile(_Weakrefable):
self.close()

def __repr__(self):
name = f"{self.__class__.__module__}.{self.__class__.__name__}"
return (f"{name}("
f"own_file={self.own_file}, "
f"is_seekable={self.is_seekable}, "
f"is_writable={self.is_writable}, "
f"is_readable={self.is_readable})")
name = f"pyarrow.{self.__class__.__name__}"
return (f"<{name} "
f"own_file={self.own_file} "
f"is_seekable={self.is_seekable} "
f"is_writable={self.is_writable} "
f"is_readable={self.is_readable}>")

@property
def mode(self):
Expand Down Expand Up @@ -1062,12 +1062,12 @@ cdef class Buffer(_Weakrefable):
return self.size

def __repr__(self):
name = f"{self.__class__.__module__}.{self.__class__.__name__}"
return (f"{name}("
f"address={hex(self.address)}, "
f"size={self.size}, "
f"is_cpu={self.is_cpu}, "
f"is_mutable={self.is_mutable})")
name = f"pyarrow.{self.__class__.__name__}"
return (f"<{name} "
f"address={hex(self.address)} "
f"size={self.size} "
f"is_cpu={self.is_cpu} "
f"is_mutable={self.is_mutable}>")

@property
def size(self):
Expand Down Expand Up @@ -2099,10 +2099,10 @@ cdef class Codec(_Weakrefable):
return pybuf if asbytes else out_buf

def __repr__(self):
name = f"{self.__class__.__module__}.{self.__class__.__name__}"
return (f"{name}("
f"name={self.name}, "
f"compression_level={self.compression_level})")
name = f"pyarrow.{self.__class__.__name__}"
return (f"<{name} "
f"name={self.name} "
f"compression_level={self.compression_level}>")


def compress(object buf, codec='lz4', asbytes=False, memory_pool=None):
Expand Down
10 changes: 5 additions & 5 deletions python/pyarrow/memory.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ cdef class MemoryPool(_Weakrefable):
return frombytes(self.pool.backend_name())

def __repr__(self):
name = f"{self.__class__.__module__}.{self.__class__.__name__}"
return (f"{name}("
f"backend_name={self.backend_name}, "
f"bytes_allocated={self.bytes_allocated()}, "
f"max_memory={self.max_memory()})")
name = f"pyarrow.{self.__class__.__name__}"
return (f"<{name} "
f"backend_name={self.backend_name} "
f"bytes_allocated={self.bytes_allocated()} "
f"max_memory={self.max_memory()}>")

cdef CMemoryPool* maybe_unbox_memory_pool(MemoryPool memory_pool):
if memory_pool is None:
Expand Down
2 changes: 1 addition & 1 deletion python/pyarrow/table.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -2013,7 +2013,7 @@ cdef class RecordBatch(_PandasConvertible):
>>> batch = pa.RecordBatch.from_arrays([n_legs, animals],
... names=["n_legs", "animals"])
>>> batch.serialize()
pyarrow.lib.Buffer(address=..., size=..., is_cpu=True, is_mutable=True)
<pyarrow.Buffer address=0x... size=... is_cpu=True is_mutable=True>
"""
cdef shared_ptr[CBuffer] buffer
cdef CIpcWriteOptions options = CIpcWriteOptions.Defaults()
Expand Down
2 changes: 1 addition & 1 deletion python/pyarrow/types.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ cdef class Schema(_Weakrefable):
Write schema to Buffer:
>>> schema.serialize()
pyarrow.lib.Buffer(address=..., size=..., is_cpu=True, is_mutable=True)
<pyarrow.Buffer address=0x... size=... is_cpu=True is_mutable=True>
"""
cdef:
shared_ptr[CBuffer] buffer
Expand Down

0 comments on commit febd2ef

Please sign in to comment.