Skip to content
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

Better repr of large_image classes #1787

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Better repr of large_image classes #1787

merged 1 commit into from
Jan 24, 2025

Conversation

manthey
Copy link
Member

@manthey manthey commented Jan 24, 2025

Before, the repr of a large_image tile source was something like OpenslideFileTileSource ('/data/samplefile.svs', 'JPEG', 95, 0, 'raw', False, '__STYLESTART__', {'bands': [{'band': 1, 'palette': 'white'}]}, '__STYLEEND__'). Now, this is
OpenslideFileTileSource('/data/samplefile.svs', style={'bands': [{'band': 1, 'palette': 'white'}]}), which could actually be used to open the tile source again. If the class is unpickleable (for instance, a vips tile sink), the repr is surrounded by <> to indicate this.

As an added feature, __rich_repr__ has been added to make the results prettier for those using the rich text library.

Before, the repr of a large_image tile source was something like
`OpenslideFileTileSource ('/data/samplefile.svs', 'JPEG', 95, 0, 'raw',
False, '__STYLESTART__', {'bands': [{'band': 1, 'palette': 'white'}]},
'__STYLEEND__')`.  Now, this is
`OpenslideFileTileSource('/data/samplefile.svs', style={'bands':
[{'band': 1, 'palette': 'white'}]})`, which could actually be used to
open the tile source again.  If the class is unpickleable (for instance,
a vips tile sink), the repr is surrounded by `<>` to indicate this.

As an added feature, `__rich_repr__` has been added to make the results
prettier for those using the rich text library.
@manthey manthey merged commit 8931fa1 into master Jan 24, 2025
17 of 18 checks passed
@manthey manthey deleted the better-repr branch January 24, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant