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
Add humanize bytes utility #189
Add humanize bytes utility #189
Conversation
There are a small number of linting changes that black made (new black version). I segregated them into their own commit and included them here. |
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.
Just a couple typos - looks good otherwise!
docs/utilities.rst
Outdated
|
||
Returns the provided byte string in a human readable format. | ||
|
||
If the value is 5 bytes or shorted it is returned in full in its hexidecimal representation (without a ``0x`` prefix) |
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.
shorted
=> shorter
docs/utilities.rst
Outdated
|
||
If the value is 5 bytes or shorted it is returned in full in its hexidecimal representation (without a ``0x`` prefix) | ||
|
||
If the value is longer that 5 bytes it is returne in its hexidecimal |
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.
returne
=> returned
What was wrong?
The
humanize_hash
function was useful for things that are consistently 32 bytes long but it didn't work well for variable length byte strings since 1) the input value is typed asHash32
and 2) it doesn't work correctly for short byte strings..How was it fixed?
Added a
humanize_bytes
that is more general case and handles short byte strings appropriately.To-Do
Cute Animal Picture