44import logging
55from datetime import datetime
66from types import TracebackType
7- from typing import Any , List , Optional , Type , Union
7+ from typing import Any , Type
88
99from aiohttp .client import ClientSession
1010from requests import Session
@@ -32,7 +32,7 @@ def __init__(self, username: str = None, password: str = None):
3232 """
3333 self ._user : str | None = username
3434 self ._pass : str | None = password
35- self ._things : List [Thing ] | None = None
35+ self ._things : list [Thing ] | None = None
3636 self ._last_login : datetime | None = None
3737 self ._last_requested_position : dict [str , int ] | None = None
3838
@@ -140,9 +140,9 @@ def __enter__(self) -> BruntClient:
140140
141141 def __exit__ (
142142 self ,
143- exc_type : Optional [ Type [BaseException ]] ,
144- exc_value : Optional [ BaseException ] ,
145- traceback : Optional [ TracebackType ] ,
143+ exc_type : Type [BaseException ] | None ,
144+ exc_value : BaseException | None ,
145+ traceback : TracebackType | None ,
146146 ) -> None :
147147 """Exit the context manager."""
148148 self .close ()
@@ -163,7 +163,7 @@ def login(self, username: str = None, password: str = None) -> bool:
163163 self ._last_login = datetime .utcnow ()
164164 return True
165165
166- def get_things (self , force : bool = False ) -> List [Thing ]:
166+ def get_things (self , force : bool = False ) -> list [Thing ]:
167167 """Get all the things.
168168
169169 Check if there are things in memory. otherwise first do the getThings call
@@ -175,7 +175,7 @@ def get_things(self, force: bool = False) -> List[Thing]:
175175 return self ._get_things ()
176176 return self ._things
177177
178- def _get_things (self ) -> List [Thing ]:
178+ def _get_things (self ) -> list [Thing ]:
179179 """Get the things registered in your account.
180180
181181 :return: dict with things registered in the logged in account
@@ -211,7 +211,7 @@ def get_state(self, thing: str = None, thing_uri: str = None) -> Thing:
211211
212212 def change_key (
213213 self , key : str , value : Any , thing : str = None , thing_uri : str = None
214- ) -> Union [ dict , list ] :
214+ ) -> dict | list :
215215 """Change a variable of the thing. Mostly included for future additions.
216216
217217 :param key: The value you want to change
@@ -238,7 +238,7 @@ def change_key(
238238
239239 def change_request_position (
240240 self , request_position : int , thing : str = None , thing_uri : str = None
241- ) -> Union [ dict , list ] :
241+ ) -> dict | list :
242242 """Change the position of the thing.
243243
244244 :param request_position: The new position for the slide (0-100)
@@ -288,9 +288,9 @@ async def __aenter__(self) -> BruntClientAsync:
288288
289289 async def __aexit__ (
290290 self ,
291- exc_type : Optional [ Type [BaseException ]] ,
292- exc_value : Optional [ BaseException ] ,
293- traceback : Optional [ TracebackType ] ,
291+ exc_type : Type [BaseException ] | None ,
292+ exc_value : BaseException | None ,
293+ traceback : TracebackType | None ,
294294 ) -> None :
295295 """Exit the context manager."""
296296 await self .async_close ()
@@ -313,7 +313,7 @@ async def async_login(self, username: str = None, password: str = None) -> bool:
313313 self ._last_login = datetime .utcnow ()
314314 return True
315315
316- async def async_get_things (self , force : bool = False ) -> List [Thing ]:
316+ async def async_get_things (self , force : bool = False ) -> list [Thing ]:
317317 """Get the things registered in your account.
318318
319319 :param force: force a refresh from the server, otherwise get from variable.
@@ -323,7 +323,7 @@ async def async_get_things(self, force: bool = False) -> List[Thing]:
323323 return await self ._async_get_things ()
324324 return self ._things
325325
326- async def _async_get_things (self ) -> List [Thing ]:
326+ async def _async_get_things (self ) -> list [Thing ]:
327327 """Get the things.
328328
329329 Check if there are things in memory, otherwise first do the getThings call and
@@ -359,7 +359,7 @@ async def async_get_state(self, thing: str = None, thing_uri: str = None) -> Thi
359359
360360 async def async_change_key (
361361 self , key : str , value : Any , thing : str = None , thing_uri : str = None
362- ) -> Union [ dict , list ] :
362+ ) -> dict | list :
363363 """Change a variable of the thing. Mostly included for future additions.
364364
365365 :param key: The value you want to change
@@ -386,7 +386,7 @@ async def async_change_key(
386386
387387 async def async_change_request_position (
388388 self , request_position : int , thing : str = None , thing_uri : str = None
389- ) -> Union [ dict , list ] :
389+ ) -> dict | list :
390390 """Change the position of the thing.
391391
392392 :param request_position: The new position for the slide (0-100)
0 commit comments