Opened 6 years ago
Closed 6 years ago
#7158 closed enhancement (implemented)
String utilities for stem
Reported by: | atagar | Owned by: | neena |
---|---|---|---|
Priority: | Medium | Milestone: | |
Component: | Core Tor/Stem | Version: | |
Severity: | Keywords: | ||
Cc: | Actual Points: | ||
Parent ID: | Points: | ||
Reviewer: | Sponsor: |
Description
Hi Ravi, just pushed some new string utilities (mostly stolen from arm) to my 'str_tools' branch...
https://gitweb.torproject.org/user/atagar/stem.git/shortlog/refs/heads/str_tools
Child Tickets
Change History (4)
comment:1 Changed 6 years ago by
Status: | new → needs_review |
---|
comment:2 Changed 6 years ago by
comment:3 Changed 6 years ago by
+SIZE_UNITS_BYTES = ( + (1125899906842624.0, " PB", " Petabyte"), + (1099511627776.0, " TB", " Terabyte"), + (1073741824.0, " GB", " Gigabyte"), + (1048576.0, " MB", " Megabyte"), + (1024.0, " KB", " Kilobyte"), + (1.0, " B", " Byte"), +)
On OS X 10.6+, 1 kb = 1000 bytes, not 1024 bytes. Not sure if it'll break anything. Just, FYI - https://support.apple.com/kb/TS2419
comment:4 Changed 6 years ago by
Resolution: | → implemented |
---|---|
Status: | needs_review → closed |
If you don't mind importing datetime, that could be replaced with...
Oh, neat. I didn't know that you could do that. I don't mind importing datetime, but personally I find the present summation to be a little bit easier to read than constructing a throwaway datetime object. But that's certainly debatable.
On OS X 10.6+, 1 kb = 1000 bytes, not 1024 bytes. Not sure if it'll break anything. Just, FYI
Thanks for the heads up. This won't break anything - this is simply a function for getting human readable labels and, frankly speaking, OSX is wrong about this.
Looks good.
If you don't mind importing datetime, that could be replaced with...
That is all.