Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
ef452ed4
Kaydet (Commit)
ef452ed4
authored
Nis 24, 2015
tarafından
smothiki
Kaydeden (comit)
smothiki
May 08, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
make memory units compatible with native docker cli
Signed-off-by:
sivaram mothiki
<
smothiki@engineyard.com
>
üst
f28e90bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
utils.py
docker/utils/utils.py
+3
-0
utils_test.py
tests/utils_test.py
+7
-1
No files found.
docker/utils/utils.py
Dosyayı görüntüle @
ef452ed4
...
@@ -322,6 +322,9 @@ def parse_bytes(s):
...
@@ -322,6 +322,9 @@ def parse_bytes(s):
if
len
(
s
)
==
0
:
if
len
(
s
)
==
0
:
s
=
0
s
=
0
else
:
else
:
if
s
[
-
2
:
-
1
]
.
isalpha
()
and
s
[
-
1
]
.
isalpha
():
if
(
s
[
-
1
]
==
"b"
or
s
[
-
1
]
==
"B"
):
s
=
s
[:
-
1
]
units
=
BYTE_UNITS
units
=
BYTE_UNITS
suffix
=
s
[
-
1
]
.
lower
()
suffix
=
s
[
-
1
]
.
lower
()
...
...
tests/utils_test.py
Dosyayı görüntüle @
ef452ed4
...
@@ -6,7 +6,7 @@ from docker.client import Client
...
@@ -6,7 +6,7 @@ from docker.client import Client
from
docker.errors
import
DockerException
from
docker.errors
import
DockerException
from
docker.utils
import
(
from
docker.utils
import
(
parse_repository_tag
,
parse_host
,
convert_filters
,
kwargs_from_env
,
parse_repository_tag
,
parse_host
,
convert_filters
,
kwargs_from_env
,
create_host_config
,
Ulimit
,
LogConfig
create_host_config
,
Ulimit
,
LogConfig
,
parse_bytes
)
)
from
docker.utils.ports
import
build_port_bindings
,
split_port
from
docker.utils.ports
import
build_port_bindings
,
split_port
from
docker.auth
import
resolve_authconfig
from
docker.auth
import
resolve_authconfig
...
@@ -37,6 +37,12 @@ class UtilsTest(base.BaseTestCase):
...
@@ -37,6 +37,12 @@ class UtilsTest(base.BaseTestCase):
self
.
assertEqual
(
parse_repository_tag
(
"url:5000/repo:tag"
),
self
.
assertEqual
(
parse_repository_tag
(
"url:5000/repo:tag"
),
(
"url:5000/repo"
,
"tag"
))
(
"url:5000/repo"
,
"tag"
))
def
test_parse_bytes
(
self
):
self
.
assertEqual
(
parse_bytes
(
"512MB"
),
(
536870912
))
self
.
assertEqual
(
parse_bytes
(
"512M"
),
(
536870912
))
self
.
assertRaises
(
DockerException
,
parse_bytes
,
"512MK"
)
self
.
assertRaises
(
DockerException
,
parse_bytes
,
"512L"
)
def
test_parse_host
(
self
):
def
test_parse_host
(
self
):
invalid_hosts
=
[
invalid_hosts
=
[
'0.0.0.0'
,
'0.0.0.0'
,
...
...
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