
class Result:

    def __init__(self, return_code, stdout, stderr):
        self.return_code = return_code
        self.stdout = stdout
        self.stderr = stderr
        self.succeeded = self.return_code == 0
        self.failed = not self.succeeded
        self.stdout_lines = stdout.splitlines() if stdout else []
        self.stderr_lines = stderr.splitlines() if stderr else []

from ..util import cached_property


class Result:

    def __init__(self, return_code, stdout, stderr):
        self.return_code = return_code
        self.stdout = stdout
        self.stderr = stderr
        self.succeeded = self.return_code == 0
        self.failed = not self.succeeded

    @cached_property
    def stdout_lines(self):
        return self.stdout.splitlines() if self.stdout else []

    @cached_property
    def stderr_lines(self):
        return self.stderr.splitlines() if self.stderr else []

Make Result.stdout_lines and stderr_lines cached properties
Make Result.stdout_lines and stderr_lines cached properties

I guess it probably doesn't matter much for performance, but we might as
well avoid splitting output into lines eagerly since it's typically not
used.
