Skip to content

Commit

Permalink
fix linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
tillsteinbach committed Jan 5, 2025
1 parent 74deaea commit 357f862
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/carconnectivity_connectors/volkswagen/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from carconnectivity.attributes import BooleanAttribute, DurationAttribute
from carconnectivity_connectors.base.connector import BaseConnector
from carconnectivity_connectors.volkswagen.auth.session_manager import SessionManager, SessionUser, Service
from carconnectivity_connectors.volkswagen.auth.we_connect_session import WeConnectSession
from carconnectivity_connectors.volkswagen.vehicle import VolkswagenVehicle, VolkswagenElectricVehicle, VolkswagenCombustionVehicle, \
VolkswagenHybridVehicle
from carconnectivity_connectors.volkswagen.capability import Capability
Expand All @@ -32,8 +33,6 @@
if TYPE_CHECKING:
from typing import Dict, List, Optional, Any

from requests import Session

from carconnectivity.carconnectivity import CarConnectivity

LOG: logging.Logger = logging.getLogger("carconnectivity.connectors.volkswagen")
Expand Down Expand Up @@ -117,7 +116,10 @@ def __init__(self, connector_id: str, car_connectivity: CarConnectivity, config:
raise AuthenticationError('Username or password not provided')

self._manager: SessionManager = SessionManager(tokenstore=car_connectivity.get_tokenstore(), cache=car_connectivity.get_cache())
self._session: Session = self._manager.get_session(Service.WE_CONNECT, SessionUser(username=username, password=password))
session: requests.Session = self._manager.get_session(Service.WE_CONNECT, SessionUser(username=username, password=password))
if not isinstance(session, WeConnectSession):
raise AuthenticationError('Could not create session')
self._session: WeConnectSession = session
self._session.refresh()

self._elapsed: List[timedelta] = []
Expand Down Expand Up @@ -221,7 +223,7 @@ def fetch_vehicles(self) -> None:
seen_vehicle_vins.add(vehicle_dict['vin'])
vehicle: Optional[VolkswagenVehicle] = garage.get_vehicle(vehicle_dict['vin']) # pyright: ignore[reportAssignmentType]
if vehicle is None:
vehicle = VolkswagenVehicle(vin=vehicle_dict['vin'], garage=garage)
vehicle = VolkswagenVehicle(vin=vehicle_dict['vin'], garage=garage, managing_connector=self)
garage.add_vehicle(vehicle_dict['vin'], vehicle)

if 'nickname' in vehicle_dict and vehicle_dict['nickname'] is not None:
Expand Down

0 comments on commit 357f862

Please sign in to comment.