Commit cb7b8051 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Merge branch 'master' into candidate

parents 17b1f35e bbbf4abc
...@@ -105,11 +105,11 @@ def get_nb_string(value, length=6): ...@@ -105,11 +105,11 @@ def get_nb_string(value, length=6):
def get_nb_octet(size): def get_nb_octet(size):
""" """
Return the number of bytes: value has to be formated like this: 5Mb, 20Gb ... Return the number of Byte : value has to be formated like this: 5MB, 20GB ...
""" """
octets_link = ["bytes", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb"] octets_link = ["Bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB"]
if size.endswith("bytes"): if size.endswith("bytes"):
unit = "bytes" unit = "Bytes"
isize = size[:len(size)-5] isize = size[:len(size)-5]
else: else:
unit = size[len(size)-2:len(size)] unit = size[len(size)-2:len(size)]
...@@ -121,9 +121,9 @@ def get_nb_octet(size): ...@@ -121,9 +121,9 @@ def get_nb_octet(size):
def get_octet_string_representation(size): def get_octet_string_representation(size):
""" """
Return the string representation of a byte Return the string representation of a Byte
""" """
octets_link = ["bytes", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb"] octets_link = ["Bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB"]
p = int(math.ceil(float(len(str(size)))/float(3) - float(1))) p = int(math.ceil(float(len(str(size)))/float(3) - float(1)))
pow_needed = p * 10 pow_needed = p * 10
pow_needed = pow(2, pow_needed) pow_needed = pow(2, pow_needed)
...@@ -238,4 +238,4 @@ def validate_email(email, check_mx=False,verify=False): ...@@ -238,4 +238,4 @@ def validate_email(email, check_mx=False,verify=False):
continue continue
except (AssertionError, ServerError): except (AssertionError, ServerError):
return False return False
return True return True
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment