-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(python): function to inspect a single-chunk Array #436
feat(python): function to inspect a single-chunk Array #436
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
python/src/nanoarrow/array.py
Outdated
@@ -490,3 +490,7 @@ def to_string(self, width_hint=80, items_hint=10) -> str: | |||
|
|||
def __repr__(self) -> str: | |||
return self.to_string() | |||
|
|||
def inspect(self): # or dump? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quite like inspect()
!
This could probably fairly easily be extended to multiple chunks (by printing out in a loop?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably fairly easily be extended to multiple chunks (by printing out in a loop?)
That's indeed true, that shouldn't be that hard. We don't need it right now, so would prefer to do it later
python/src/nanoarrow/_repr_utils.py
Outdated
@@ -248,3 +248,46 @@ def device_repr(device): | |||
device_type = f"- device_type: {device.device_type.name} <{device.device_type_id}>" | |||
device_id = f"- device_id: {device.device_id}" | |||
return "\n".join([title_line, device_type, device_id]) | |||
|
|||
|
|||
def array_dump(array, indent=0, max_char_width=80): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def array_dump(array, indent=0, max_char_width=80): | |
def array_inspect(array, indent=0, max_char_width=80): |
Addresses #435
Reusing the existing repr utilities, the current code gives this: