diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 007fc0a..af40d41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,19 @@ name: Test on: [push, pull_request] jobs: + mypy: + name: mypy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install mypy cryptography types-requests + - name: Run mypy + run: mypy pyfritzhome + tests: name: Python ${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/pyfritzhome/devicetypes/fritzhomeentitybase.py b/pyfritzhome/devicetypes/fritzhomeentitybase.py index 7a8e437..b15278f 100644 --- a/pyfritzhome/devicetypes/fritzhomeentitybase.py +++ b/pyfritzhome/devicetypes/fritzhomeentitybase.py @@ -1,4 +1,5 @@ """The entity base class.""" + # -*- coding: utf-8 -*- from __future__ import print_function @@ -16,8 +17,8 @@ class FritzhomeEntityBase(ABC): """The Fritzhome Entity class.""" _fritz = None - ain: str = None - _functionsbitmask = None + ain: str + _functionsbitmask: int = 0 supported_features = None def __init__(self, fritz=None, node=None): diff --git a/pyfritzhome/fritzhome.py b/pyfritzhome/fritzhome.py index da1972b..0488904 100644 --- a/pyfritzhome/fritzhome.py +++ b/pyfritzhome/fritzhome.py @@ -16,7 +16,7 @@ from .errors import InvalidError, LoginError, NotLoggedInError from .fritzhomedevice import FritzhomeDevice from .fritzhomedevice import FritzhomeTemplate -from typing import Dict +from typing import Dict, Optional _LOGGER = logging.getLogger(__name__) @@ -26,8 +26,8 @@ class Fritzhome(object): _sid = None _session = None - _devices: Dict[str, FritzhomeDevice] = None - _templates: Dict[str, FritzhomeTemplate] = None + _devices: Optional[Dict[str, FritzhomeDevice]] = None + _templates: Optional[Dict[str, FritzhomeTemplate]] = None def __init__(self, host, user, password, ssl_verify=True): """Create a fritzhome object."""