mirror of
https://github.com/docker/compose.git
synced 2026-07-05 07:43:04 +00:00
Closes: #6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
29 lines
727 B
Python
29 lines
727 B
Python
class OperationFailedError(Exception):
|
|
def __init__(self, reason):
|
|
self.msg = reason
|
|
|
|
|
|
class StreamParseError(RuntimeError):
|
|
def __init__(self, reason):
|
|
self.msg = reason
|
|
|
|
|
|
class HealthCheckException(Exception):
|
|
def __init__(self, reason):
|
|
self.msg = reason
|
|
|
|
|
|
class HealthCheckFailed(HealthCheckException):
|
|
def __init__(self, container_id):
|
|
super().__init__(
|
|
'Container "{}" is unhealthy.'.format(container_id)
|
|
)
|
|
|
|
|
|
class NoHealthCheckConfigured(HealthCheckException):
|
|
def __init__(self, service_name):
|
|
super().__init__(
|
|
'Service "{}" is missing a healthcheck configuration'.format(
|
|
service_name
|
|
)
|
|
)
|