You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AlenkaF (via GitHub)" <gi...@apache.org> on 2025/09/01 07:33:11 UTC
Re: [PR] GH-47389: [Python] CSV and JSON options lack a nice repr/str [arrow]
AlenkaF commented on code in PR #47397:
URL: https://github.com/apache/arrow/pull/47397#discussion_r2313107543
##########
python/pyarrow/tests/test_csv.py:
##########
@@ -378,6 +448,21 @@ def test_write_options():
opts.batch_size = 0
opts.validate()
+ expected_repr = ("<pyarrow.csv.WriteOptions("
+ f"include_header={opts.include_header}, "
+ f"batch_size={opts.batch_size}, "
+ f"delimiter={opts.delimiter!r}, "
+ f"quoting_style='{opts.quoting_style}')>")
+ assert repr(opts) == expected_repr
+
+ # Test str
Review Comment:
```suggestion
```
##########
python/pyarrow/_csv.pyx:
##########
@@ -585,6 +605,24 @@ cdef class ParseOptions(_Weakrefable):
except TypeError:
return False
+ def __repr__(self):
+ return (f"<pyarrow.csv.ParseOptions("
+ f"delimiter={self.delimiter!r}, "
+ f"quote_char={self.quote_char!r}, "
+ f"double_quote={self.double_quote}, "
+ f"escape_char={self.escape_char!r}, "
+ f"newlines_in_values={self.newlines_in_values}, "
+ f"ignore_empty_lines={self.ignore_empty_lines})>")
Review Comment:
I'm wondering if we should include `invalid_row_handler` — at least to indicate whether it's set or `None`?
--
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