Merge pull request #6236 from ceh-forks/mutable-default-values

Avoid modifying mutable default value
This commit is contained in:
Joffrey F 2018-10-08 10:22:02 +02:00 committed by GitHub
commit 5629f62644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -197,7 +197,9 @@ class Service(object):
def __repr__(self):
return '<Service: {}>'.format(self.name)
def containers(self, stopped=False, one_off=False, filters={}, labels=None):
def containers(self, stopped=False, one_off=False, filters=None, labels=None):
if filters is None:
filters = {}
filters.update({'label': self.labels(one_off=one_off) + (labels or [])})
result = list(filter(None, [