Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
jflow
Commits
78bc5bf8
Commit
78bc5bf8
authored
Jan 02, 2017
by
jmariette
Browse files
synchronize utils.py with ng6
parent
5c7bdf2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/jflow/utils.py
View file @
78bc5bf8
...
...
@@ -105,11 +105,11 @@ def get_nb_string(value, length=6):
def
get_nb_octet
(
size
):
"""
Return the number of
b
yte
s
: value has to be formated like this: 5M
b
, 20G
b
...
Return the number of
B
yte
: value has to be formated like this: 5M
B
, 20G
B
...
"""
octets_link
=
[
"
b
ytes"
,
"
Kb
"
,
"M
b
"
,
"G
b
"
,
"T
b
"
,
"P
b
"
,
"E
b
"
,
"Z
b
"
]
octets_link
=
[
"
B
ytes"
,
"
kB
"
,
"M
B
"
,
"G
B
"
,
"T
B
"
,
"P
B
"
,
"E
B
"
,
"Z
B
"
]
if
size
.
endswith
(
"bytes"
):
unit
=
"
b
ytes"
unit
=
"
B
ytes"
isize
=
size
[:
len
(
size
)
-
5
]
else
:
unit
=
size
[
len
(
size
)
-
2
:
len
(
size
)]
...
...
@@ -121,9 +121,9 @@ def get_nb_octet(size):
def
get_octet_string_representation
(
size
):
"""
Return the string representation of a
b
yte
Return the string representation of a
B
yte
"""
octets_link
=
[
"
b
ytes"
,
"
Kb
"
,
"M
b
"
,
"G
b
"
,
"T
b
"
,
"P
b
"
,
"E
b
"
,
"Z
b
"
]
octets_link
=
[
"
B
ytes"
,
"
kB
"
,
"M
B
"
,
"G
B
"
,
"T
B
"
,
"P
B
"
,
"E
B
"
,
"Z
B
"
]
p
=
int
(
math
.
ceil
(
float
(
len
(
str
(
size
)))
/
float
(
3
)
-
float
(
1
)))
pow_needed
=
p
*
10
pow_needed
=
pow
(
2
,
pow_needed
)
...
...
@@ -238,4 +238,4 @@ def validate_email(email, check_mx=False,verify=False):
continue
except
(
AssertionError
,
ServerError
):
return
False
return
True
\ No newline at end of file
return
True
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment