natural.data
¶
-
natural.data.
hexdump
(stream)¶ Display stream contents in hexadecimal and ASCII format. The
stream
specified must either be a file-like object that supports theread
method to receive bytes, or it can be a string.To dump a file:
>>> hexdump(file(filename))
Or to dump stdin:
>>> import sys >>> hexdump(sys.stdin)
Parameters: stream – stream input
-
natural.data.
printable
(sequence)¶ Return a printable string from the input
sequence
Parameters: sequence – byte or string sequence >>> printable('\x1b[1;34mtest\x1b[0m') '.[1;34mtest.[0m' >>> printable('\x00\x01\x02\x03\x04\x05\x06\x06') '........' >>> printable('12345678') '12345678' >>> printable('testing\n') 'testing.'
-
natural.data.
sparkline
(data)¶ Return a spark line for the given data set.
Value data: sequence of numeric values >>> print sparkline([1, 2, 3, 4, 5, 6, 5, 4, 3, 1, 5, 6]) ▁▂▃▄▅▆▅▄▃▁▅▆
-
natural.data.
throughput
(sample, window=1, format='decimal')¶ Return the throughput in (intelli)bytes per second.
Parameters: - sample – number of samples sent
- window – default 1, sample window in seconds or
datetime.timedelta
object - format – default ‘decimal’, see
natural.size.filesize()
>>> throughput(123456, 42) '2.87 kB/s'