mirror of https://github.com/docker/docker-py.git
lint: fix outstanding flake8 violations
Since flake8 wasn't actually being run in CI, we'd accumulated some violations. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
This commit is contained in:
parent
ce40d4bb34
commit
3ffdd8a1c5
|
@ -153,7 +153,7 @@ class BuildApiMixin:
|
||||||
with open(dockerignore) as f:
|
with open(dockerignore) as f:
|
||||||
exclude = list(filter(
|
exclude = list(filter(
|
||||||
lambda x: x != '' and x[0] != '#',
|
lambda x: x != '' and x[0] != '#',
|
||||||
[l.strip() for l in f.read().splitlines()]
|
[line.strip() for line in f.read().splitlines()]
|
||||||
))
|
))
|
||||||
dockerfile = process_dockerfile(dockerfile, path)
|
dockerfile = process_dockerfile(dockerfile, path)
|
||||||
context = utils.tar(
|
context = utils.tar(
|
||||||
|
|
|
@ -256,7 +256,9 @@ class ContainerApiMixin:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
client.api.create_host_config(port_bindings={1111: ('127.0.0.1', 4567)})
|
client.api.create_host_config(
|
||||||
|
port_bindings={1111: ('127.0.0.1', 4567)}
|
||||||
|
)
|
||||||
|
|
||||||
Or without host port assignment:
|
Or without host port assignment:
|
||||||
|
|
||||||
|
@ -579,10 +581,13 @@ class ContainerApiMixin:
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
>>> client.api.create_host_config(privileged=True, cap_drop=['MKNOD'],
|
>>> client.api.create_host_config(
|
||||||
volumes_from=['nostalgic_newton'])
|
... privileged=True,
|
||||||
|
... cap_drop=['MKNOD'],
|
||||||
|
... volumes_from=['nostalgic_newton'],
|
||||||
|
... )
|
||||||
{'CapDrop': ['MKNOD'], 'LxcConf': None, 'Privileged': True,
|
{'CapDrop': ['MKNOD'], 'LxcConf': None, 'Privileged': True,
|
||||||
'VolumesFrom': ['nostalgic_newton'], 'PublishAllPorts': False}
|
'VolumesFrom': ['nostalgic_newton'], 'PublishAllPorts': False}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not kwargs:
|
if not kwargs:
|
||||||
|
|
|
@ -377,7 +377,8 @@ class ImageApiMixin:
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
>>> for line in client.api.pull('busybox', stream=True, decode=True):
|
>>> resp = client.api.pull('busybox', stream=True, decode=True)
|
||||||
|
... for line in resp:
|
||||||
... print(json.dumps(line, indent=4))
|
... print(json.dumps(line, indent=4))
|
||||||
{
|
{
|
||||||
"status": "Pulling image (latest) from busybox",
|
"status": "Pulling image (latest) from busybox",
|
||||||
|
@ -456,7 +457,12 @@ class ImageApiMixin:
|
||||||
If the server returns an error.
|
If the server returns an error.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
>>> for line in client.api.push('yourname/app', stream=True, decode=True):
|
>>> resp = client.api.push(
|
||||||
|
... 'yourname/app',
|
||||||
|
... stream=True,
|
||||||
|
... decode=True,
|
||||||
|
... )
|
||||||
|
... for line in resp:
|
||||||
... print(line)
|
... print(line)
|
||||||
{'status': 'Pushing repository yourname/app (1 tags)'}
|
{'status': 'Pushing repository yourname/app (1 tags)'}
|
||||||
{'status': 'Pushing','progressDetail': {}, 'id': '511136ea3c5a'}
|
{'status': 'Pushing','progressDetail': {}, 'id': '511136ea3c5a'}
|
||||||
|
|
|
@ -56,15 +56,18 @@ class VolumeApiMixin:
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
>>> volume = client.api.create_volume(name='foobar', driver='local',
|
>>> volume = client.api.create_volume(
|
||||||
driver_opts={'foo': 'bar', 'baz': 'false'},
|
... name='foobar',
|
||||||
labels={"key": "value"})
|
... driver='local',
|
||||||
>>> print(volume)
|
... driver_opts={'foo': 'bar', 'baz': 'false'},
|
||||||
|
... labels={"key": "value"},
|
||||||
|
... )
|
||||||
|
... print(volume)
|
||||||
{u'Driver': u'local',
|
{u'Driver': u'local',
|
||||||
u'Labels': {u'key': u'value'},
|
u'Labels': {u'key': u'value'},
|
||||||
u'Mountpoint': u'/var/lib/docker/volumes/foobar/_data',
|
u'Mountpoint': u'/var/lib/docker/volumes/foobar/_data',
|
||||||
u'Name': u'foobar',
|
u'Name': u'foobar',
|
||||||
u'Scope': u'local'}
|
u'Scope': u'local'}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
url = self._url('/volumes/create')
|
url = self._url('/volumes/create')
|
||||||
|
|
|
@ -761,7 +761,8 @@ class ContainerCollection(Collection):
|
||||||
{'/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'},
|
{'/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'},
|
||||||
'/var/www': {'bind': '/mnt/vol1', 'mode': 'ro'}}
|
'/var/www': {'bind': '/mnt/vol1', 'mode': 'ro'}}
|
||||||
|
|
||||||
Or a list of strings which each one of its elements specifies a mount volume.
|
Or a list of strings which each one of its elements specifies a
|
||||||
|
mount volume.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,10 @@ class Image(Model):
|
||||||
An image on the server.
|
An image on the server.
|
||||||
"""
|
"""
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<{}: '{}'>".format(self.__class__.__name__, "', '".join(self.tags))
|
return "<{}: '{}'>".format(
|
||||||
|
self.__class__.__name__,
|
||||||
|
"', '".join(self.tags),
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def labels(self):
|
def labels(self):
|
||||||
|
|
|
@ -117,7 +117,11 @@ class Plugin(Model):
|
||||||
if remote is None:
|
if remote is None:
|
||||||
remote = self.name
|
remote = self.name
|
||||||
privileges = self.client.api.plugin_privileges(remote)
|
privileges = self.client.api.plugin_privileges(remote)
|
||||||
yield from self.client.api.upgrade_plugin(self.name, remote, privileges)
|
yield from self.client.api.upgrade_plugin(
|
||||||
|
self.name,
|
||||||
|
remote,
|
||||||
|
privileges,
|
||||||
|
)
|
||||||
self.reload()
|
self.reload()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ URLComponents = collections.namedtuple(
|
||||||
'scheme netloc url params query fragment',
|
'scheme netloc url params query fragment',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_ipam_pool(*args, **kwargs):
|
def create_ipam_pool(*args, **kwargs):
|
||||||
raise errors.DeprecatedMethod(
|
raise errors.DeprecatedMethod(
|
||||||
'utils.create_ipam_pool has been removed. Please use a '
|
'utils.create_ipam_pool has been removed. Please use a '
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ConfigAPITest(BaseAPIIntegrationTest):
|
||||||
def test_create_config_with_templating(self):
|
def test_create_config_with_templating(self):
|
||||||
config_id = self.client.create_config(
|
config_id = self.client.create_config(
|
||||||
'favorite_character', 'sakuya izayoi',
|
'favorite_character', 'sakuya izayoi',
|
||||||
templating={ 'name': 'golang'}
|
templating={'name': 'golang'}
|
||||||
)
|
)
|
||||||
self.tmp_configs.append(config_id)
|
self.tmp_configs.append(config_id)
|
||||||
assert 'ID' in config_id
|
assert 'ID' in config_id
|
||||||
|
|
|
@ -11,6 +11,7 @@ from docker import auth, credentials, errors
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
class RegressionTest(unittest.TestCase):
|
class RegressionTest(unittest.TestCase):
|
||||||
def test_803_urlsafe_encode(self):
|
def test_803_urlsafe_encode(self):
|
||||||
auth_data = {
|
auth_data = {
|
||||||
|
|
|
@ -272,8 +272,8 @@ class ExcludePathsTest(unittest.TestCase):
|
||||||
assert self.exclude(['**/target/*/*']) == convert_paths(
|
assert self.exclude(['**/target/*/*']) == convert_paths(
|
||||||
self.all_paths - {
|
self.all_paths - {
|
||||||
'target/subdir/file.txt',
|
'target/subdir/file.txt',
|
||||||
'subdir/target/subdir/file.txt',
|
'subdir/target/subdir/file.txt',
|
||||||
'subdir/subdir2/target/subdir/file.txt'
|
'subdir/subdir2/target/subdir/file.txt'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -281,16 +281,16 @@ class ExcludePathsTest(unittest.TestCase):
|
||||||
assert self.exclude(['subdir/**']) == convert_paths(
|
assert self.exclude(['subdir/**']) == convert_paths(
|
||||||
self.all_paths - {
|
self.all_paths - {
|
||||||
'subdir/file.txt',
|
'subdir/file.txt',
|
||||||
'subdir/target/file.txt',
|
'subdir/target/file.txt',
|
||||||
'subdir/target/subdir/file.txt',
|
'subdir/target/subdir/file.txt',
|
||||||
'subdir/subdir2/file.txt',
|
'subdir/subdir2/file.txt',
|
||||||
'subdir/subdir2/target/file.txt',
|
'subdir/subdir2/target/file.txt',
|
||||||
'subdir/subdir2/target/subdir/file.txt',
|
'subdir/subdir2/target/subdir/file.txt',
|
||||||
'subdir/target',
|
'subdir/target',
|
||||||
'subdir/target/subdir',
|
'subdir/target/subdir',
|
||||||
'subdir/subdir2',
|
'subdir/subdir2',
|
||||||
'subdir/subdir2/target',
|
'subdir/subdir2/target',
|
||||||
'subdir/subdir2/target/subdir'
|
'subdir/subdir2/target/subdir'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue