blob: bb09579bfad1ec9b09a7c89d7a66685657982ffc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# ############################################################################ #
# #
# ::: :::::::: #
# captured.py :+: :+: :+: #
# +:+ +:+ +:+ #
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 12:16:25 by charles #+# #+# #
# Updated: 2021/03/02 10:32:19 by cacharle ### ########.fr #
# #
# ############################################################################ #
from typing import List, Optional, Union
class CapturedCommand:
def __init__(
self,
output: str,
status: int,
files_content: List[Optional[str]],
):
"""Captured command
:param output:
Command output
:param status:
Command return status code
:param files_content:
Content of the files altered by the command
"""
self.output = output
self.status = status
self.files_content = files_content
def __eq__(self, other: object) -> bool:
if not isinstance(other, CapturedCommand):
return False
return (
self.output == other.output and
self.status == other.status and
all(x == y for x, y in zip(self.files_content, other.files_content))
)
class CapturedTimeout():
"""Captured timeout"""
def __eq__(self, other: object) -> bool:
return isinstance(other, CapturedTimeout)
CapturedType = Union[CapturedCommand, CapturedTimeout]
|