-
Notifications
You must be signed in to change notification settings - Fork 73
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
Don't print empty byte strings for no metadata #2351
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2351 +/- ##
==========================================
- Coverage 93.29% 91.29% -2.00%
==========================================
Files 28 28
Lines 26764 27936 +1172
Branches 1227 1507 +280
==========================================
+ Hits 24969 25504 +535
- Misses 1762 2370 +608
- Partials 33 62 +29
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I'm not sure this is the best way to do things anyway - isn't the point that printing out the "b'...'" is unhelpful, and we should just strip the "b" and quotes out of the rendered metadata? I don't see any advantage to keeping them in. So, we define a function def render_metadata(md):
s = str(md)
if isinstance(md, bytes):
# Strip leading b' and trailing '
s = s[2:-1]
return s and use this for all the table output functions? Of course, util.render_metadata should also probably call |
Happy to do this: I was taking a more conservative approach and assuming that we would want to distinguish e.g. metadata of |
🤷 We probably don't expect there to be much metadata-with-no-schema out there, so maybe having the ugly But definitely lets not get into what the boolean interpretation of a schema should be. |
I'd like to keep this really simple and only replace |
I.e.
? |
|
Can we get away with a simple |
How about we use a function, like this? Then we avoid distributing this logic around many different places. |
Happy with the function, but I think it should only check for |
Done. I stuck a line in test_tables.py: test_str to put a blank metadata value in there, but perhaps that's excessive as the function is tested in |
Current test failure is a codecov fault, I think, nothing to do with this PR. |
de581f0
to
ef4c32e
Compare
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 added a changelog, as technically this is a breaking change.
ef4c32e
to
42570fc
Compare
Fixes #2349 but no tests yet: I want to see if this is the right approach: i.e. should an empty metadata schema be treated as False when viewed as a bool? Thoughts @benjeffery ?