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
6ccfba06
Commit
6ccfba06
authored
Oct 17, 2014
by
Frédéric Escudié
Browse files
Fix bug with unit bytes in check file size.
parent
88038486
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/jflow/utils.py
View file @
6ccfba06
...
...
@@ -77,10 +77,15 @@ def get_nb_octet(size):
Return the number of bytes: value has to be formated like this: 5Mb, 20Gb ...
"""
octets_link
=
[
"bytes"
,
"Kb"
,
"Mb"
,
"Gb"
,
"Tb"
,
"Pb"
,
"Eb"
,
"Zb"
]
unit
=
size
[
len
(
size
)
-
2
:
len
(
size
)]
if
size
.
endswith
(
"bytes"
):
unit
=
"bytes"
isize
=
size
[:
len
(
size
)
-
5
]
else
:
unit
=
size
[
len
(
size
)
-
2
:
len
(
size
)]
isize
=
size
[:
len
(
size
)
-
2
]
pow_val
=
int
(
octets_link
.
index
(
unit
))
*
10
val
=
pow
(
2
,
pow_val
)
nb_octet
=
int
(
size
[:
len
(
size
)
-
2
]
)
*
val
nb_octet
=
float
(
isize
)
*
val
return
nb_octet
def
get_octet_string_representation
(
size
):
...
...
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