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
7b2fd8cf
Kaydet (Commit)
7b2fd8cf
authored
May 20, 2015
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #562 from smothiki/mems
make memory units compatible with native docker cli
üst
08444cf3
ef452ed4
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 @
7b2fd8cf
...
...
@@ -322,6 +322,9 @@ def parse_bytes(s):
if
len
(
s
)
==
0
:
s
=
0
else
:
if
s
[
-
2
:
-
1
]
.
isalpha
()
and
s
[
-
1
]
.
isalpha
():
if
(
s
[
-
1
]
==
"b"
or
s
[
-
1
]
==
"B"
):
s
=
s
[:
-
1
]
units
=
BYTE_UNITS
suffix
=
s
[
-
1
]
.
lower
()
...
...
tests/utils_test.py
Dosyayı görüntüle @
7b2fd8cf
...
...
@@ -6,7 +6,7 @@ from docker.client import Client
from
docker.errors
import
DockerException
from
docker.utils
import
(
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.auth
import
resolve_authconfig
...
...
@@ -37,6 +37,12 @@ class UtilsTest(base.BaseTestCase):
self
.
assertEqual
(
parse_repository_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
):
invalid_hosts
=
[
'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