File: status_update.py

package info (click to toggle)
python-aio-geojson-client 0.20-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 268 kB
  • sloc: python: 1,368; makefile: 4
file content (73 lines) | stat: -rw-r--r-- 2,048 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""Status Update."""
from __future__ import annotations

from datetime import datetime


class StatusUpdate:
    """Status Update class."""

    def __init__(
        self,
        status: str,
        last_update: datetime | None,
        last_update_successful: datetime | None,
        last_timestamp: datetime | None,
        total: int,
        created: int,
        updated: int,
        removed: int,
    ):
        """Initialise this status update."""
        self._status = status
        self._last_update = last_update
        self._last_update_successful = last_update_successful
        self._last_timestamp = last_timestamp
        self._total = total
        self._created = created
        self._updated = updated
        self._removed = removed

    def __repr__(self):
        """Return string representation of this entry."""
        return f"<{self.__class__.__name__}({self.status}@{self.last_update})>"

    @property
    def status(self) -> str:
        """Return the status."""
        return self._status

    @property
    def last_update(self) -> datetime | None:
        """Return the time when the feed was last updated."""
        return self._last_update

    @property
    def last_update_successful(self) -> datetime | None:
        """Return the time when the feed was last updated successfully."""
        return self._last_update_successful

    @property
    def last_timestamp(self) -> datetime | None:
        """Return the timestamp the latest entry in the feed."""
        return self._last_timestamp

    @property
    def total(self) -> int:
        """Return the total number of managed entries."""
        return self._total

    @property
    def created(self) -> int:
        """Return the number of created entries."""
        return self._created

    @property
    def updated(self) -> int:
        """Return the number of updated entries."""
        return self._updated

    @property
    def removed(self) -> int:
        """Return the number of removed entries."""
        return self._removed