Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor clean logs #11

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ repos:
entry: scripts/run-in-env.sh mypy
language: script
types: [python]
require_serial: true
<<: *python-files
- id: pylint
name: Check with pylint
entry: scripts/run-in-env.sh pylint
language: script
types: [python]
require_serial: true
<<: *python-files
12 changes: 6 additions & 6 deletions deebot_client/commands/clean_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def handle_requested(self, event_bus: EventBus, response: Dict[str, Any]) -> boo
for log in resp_logs:
logs.append(
CleanLogEntry(
timestamp=log.get("ts"),
image_url=log.get("imageUrl"),
type=log.get("type"),
area=log.get("area"),
stop_reason=CleanJobStatus(int(log.get("stopReason", -2))),
total_time=log.get("last"),
timestamp=log["ts"],
image_url=log["imageUrl"],
type=log["type"],
area=log["area"],
stop_reason=CleanJobStatus(int(log["stopReason"])),
duration=log["last"],
)
)

Expand Down
12 changes: 6 additions & 6 deletions deebot_client/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class CleanJobStatus(DisplayNameIntEnum):
class CleanLogEntry:
"""Clean log entry representation."""

timestamp: Optional[int]
image_url: Optional[str]
type: Optional[str]
area: Optional[int]
stop_reason: Optional[CleanJobStatus]
total_time: Optional[int] # in seconds
timestamp: int
image_url: str
type: str
area: int
stop_reason: CleanJobStatus
duration: int # in seconds


@dataclass(frozen=True)
Expand Down