Skip to content

Commit

Permalink
Fix UP007 (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Feb 21, 2024
1 parent 781008c commit 746067e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ repos:
types: [text]
entry: poetry run end-of-file-fixer
stages: [commit, push, manual]
- id: mypy
name: 🆎 Static type checking using mypy
language: system
types: [python]
entry: poetry run mypy
require_serial: true
- id: no-commit-to-branch
name: 🛑 Don't commit to main branch
language: system
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ ignore = [
"SIM102",
"SLF001",
"T201",
"UP007",
]
select = ["ALL"]

Expand Down
3 changes: 1 addition & 2 deletions roombapy/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import logging
import socket
from typing import Optional

from pydantic import ValidationError

Expand Down Expand Up @@ -81,7 +80,7 @@ def _start_server(self):
self.log.debug("Socket server started, port %s", self.udp_port)


def _decode_data(raw_response: bytes) -> Optional[RoombaInfo]:
def _decode_data(raw_response: bytes) -> RoombaInfo | None:
try:
data = raw_response.decode()
except UnicodeDecodeError:
Expand Down
15 changes: 10 additions & 5 deletions roombapy/roomba_info.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from __future__ import annotations

from functools import cached_property
from typing import Optional

try:
from pydantic.v1 import BaseModel, Field, field_validator
from pydantic.v1 import ( # type: ignore[attr-defined]
BaseModel,
Field,
field_validator,
)
except ImportError:
from pydantic import BaseModel, Field
from pydantic import validator as field_validator
from pydantic import BaseModel, Field # type: ignore[attr-defined]
from pydantic import (
validator as field_validator, # type: ignore[attr-defined]
)


class RoombaInfo(BaseModel):
Expand All @@ -18,7 +23,7 @@ class RoombaInfo(BaseModel):
robot_name: str = Field(alias="robotname")
sku: str
capabilities: dict[str, int] = Field(alias="cap")
password: Optional[str] = None
password: str | None = None

@field_validator("hostname")
@classmethod
Expand Down

0 comments on commit 746067e

Please sign in to comment.