[GitHub] [arrow] AlenkaF commented on a diff in pull request #33698: GH-31507: [Python] Address docstrings in Streams and File Access (Stream Classes)

2023-01-18 Thread GitBox


AlenkaF commented on code in PR #33698:
URL: https://github.com/apache/arrow/pull/33698#discussion_r1073308531


##
python/pyarrow/io.pxi:
##
@@ -1459,23 +1484,21 @@ cdef class BufferReader(NativeFile):
 
 Examples
 
+Create an Arrow input stream and inspect it:
 
 >>> import pyarrow as pa
 >>> data = b'reader data'
->>> f = pa.BufferReader(data)
->>> f.size()
+>>> buf = memoryview(data)

Review Comment:
   It needs some kind of a source ([str, Path, buffer, file-like object, 
…](https://docs.python.org/3/library/stdtypes.html#str)):
   
   ```python
   >>> import pyarrow as pa
   >>> data = b'reader data'
   >>> with pa.input_stream(data) as stream:
   ... stream.size()
   ... 
   Traceback (most recent call last):
 File "", line 1, in 
 File "pyarrow/io.pxi", line 2403, in pyarrow.lib.input_stream
   hasattr(source, 'closed')):
   TypeError: pa.input_stream() called with instance of ''
   ```
   Can change the source, if preferred.



-- 
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-unsubscr...@arrow.apache.org

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



[GitHub] [arrow] AlenkaF commented on a diff in pull request #33698: GH-31507: [Python] Address docstrings in Streams and File Access (Stream Classes)

2023-01-17 Thread GitBox


AlenkaF commented on code in PR #33698:
URL: https://github.com/apache/arrow/pull/33698#discussion_r1072165185


##
python/pyarrow/io.pxi:
##
@@ -1368,6 +1456,26 @@ cdef class BufferReader(NativeFile):
 Parameters
 --
 obj : Python bytes or pyarrow.Buffer
+
+Examples
+
+
+>>> import pyarrow as pa
+>>> data = b'reader data'
+>>> f = pa.BufferReader(data)

Review Comment:
   I have added changes regarding this comment in this commit: 
https://github.com/apache/arrow/pull/33698/commits/10d5e89c0181a66e04d7a3db03e17a3daad7f532
   I hope I captured all the necessary changes.



-- 
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-unsubscr...@arrow.apache.org

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



[GitHub] [arrow] AlenkaF commented on a diff in pull request #33698: GH-31507: [Python] Address docstrings in Streams and File Access (Stream Classes)

2023-01-17 Thread GitBox


AlenkaF commented on code in PR #33698:
URL: https://github.com/apache/arrow/pull/33698#discussion_r1072109464


##
python/pyarrow/io.pxi:
##
@@ -851,6 +879,16 @@ cdef class MemoryMappedFile(NativeFile):
 A stream that represents a memory-mapped file.
 
 Supports 'r', 'r+', 'w' modes.
+
+Examples
+
+Create a MemoryMappedFile:

Review Comment:
   Yeah, makes perfect sense. Will do.



-- 
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-unsubscr...@arrow.apache.org

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