Outcome of a mailbox sync operation.
Source code in email_profile/core/abc.py
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 | @dataclass
class SyncResult:
"""Outcome of a mailbox sync operation."""
mailbox: str
inserted: int = 0
updated: int = 0
deleted: int = 0
skipped: int = 0
errors: list[str] = field(default_factory=list)
@property
def total_processed(self) -> int:
return self.inserted + self.updated + self.deleted + self.skipped
@property
def has_errors(self) -> bool:
return len(self.errors) > 0
def merge(self, other: SyncResult) -> SyncResult:
return SyncResult(
mailbox="*",
inserted=self.inserted + other.inserted,
updated=self.updated + other.updated,
deleted=self.deleted + other.deleted,
skipped=self.skipped + other.skipped,
errors=self.errors + other.errors,
)
|
deleted = 0
class-attribute
instance-attribute
errors = field(default_factory=list)
class-attribute
instance-attribute
inserted = 0
class-attribute
instance-attribute
mailbox
instance-attribute
skipped = 0
class-attribute
instance-attribute
updated = 0
class-attribute
instance-attribute
__init__(mailbox, inserted=0, updated=0, deleted=0, skipped=0, errors=list())
merge(other)
Source code in email_profile/core/abc.py
33
34
35
36
37
38
39
40
41 | def merge(self, other: SyncResult) -> SyncResult:
return SyncResult(
mailbox="*",
inserted=self.inserted + other.inserted,
updated=self.updated + other.updated,
deleted=self.deleted + other.deleted,
skipped=self.skipped + other.skipped,
errors=self.errors + other.errors,
)
|