Skip to content

Commit

Permalink
remove nullable declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
chemwolf6922 committed Dec 19, 2024
1 parent cd6d822 commit f810e76
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions custom_components/xiaomi_home/miot/miot_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@

class MIoTOauthClient:
"""oauth agent url, default: product env."""
_main_loop: asyncio.AbstractEventLoop = None
_session: aiohttp.ClientSession = None
_oauth_host: str = None
_main_loop: asyncio.AbstractEventLoop
_session: aiohttp.ClientSession
_oauth_host: str
_client_id: int
_redirect_url: str

Expand All @@ -94,11 +94,10 @@ def __init__(
self._oauth_host = DEFAULT_OAUTH2_API_HOST
else:
self._oauth_host = f'{cloud_server}.{DEFAULT_OAUTH2_API_HOST}'
self._session = asyncio.ClientSession()
self._session = aiohttp.ClientSession()

def __del__(self):
if self._session is not None:
self._session.close()
self._session.close()

def set_redirect_url(self, redirect_url: str) -> None:
if not isinstance(redirect_url, str) or redirect_url.strip() == '':
Expand Down Expand Up @@ -253,8 +252,7 @@ def __init__(
self._session = aiohttp.ClientSession()

def __del__(self):
if self._session is not None:
self._session.close()
self._session.close()

def update_http_header(
self, cloud_server: Optional[str] = None,
Expand Down

0 comments on commit f810e76

Please sign in to comment.