mirror of https://github.com/flaggo/pydu.git
add doc for unit
This commit is contained in:
parent
9c4cef040f
commit
759dff99e4
|
@ -36,3 +36,4 @@ Content
|
||||||
request
|
request
|
||||||
set
|
set
|
||||||
string
|
string
|
||||||
|
unit
|
|
@ -0,0 +1,15 @@
|
||||||
|
Unit
|
||||||
|
----
|
||||||
|
|
||||||
|
.. py:class:: pydu.unit.Bytes(bytes)
|
||||||
|
|
||||||
|
Supply several methods dealing with bytes.
|
||||||
|
|
||||||
|
.. py:method:: convert(self, unit=None, multiple=1024)
|
||||||
|
|
||||||
|
Convert bytes in give ``unit``.
|
||||||
|
If ``unit`` is None, convert bytes in suitable unit.
|
||||||
|
Convert ``multiple`` is default to be 1024.
|
||||||
|
|
||||||
|
>>> Bytes(1024).convert()
|
||||||
|
(1, 'KB')
|
|
@ -12,7 +12,7 @@ class Bytes(object):
|
||||||
|
|
||||||
def convert(self, unit=None, multiple=1024):
|
def convert(self, unit=None, multiple=1024):
|
||||||
"""
|
"""
|
||||||
Convert bytes in give unit.
|
Convert bytes in give ``unit``.
|
||||||
If `unit` is None, convert bytes in suitable unit.
|
If `unit` is None, convert bytes in suitable unit.
|
||||||
Convert `multiple` is default to be 1024.
|
Convert `multiple` is default to be 1024.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue