Remove some passings of loop (#34995)

This commit is contained in:
Paulus Schoutsen
2020-04-30 21:34:51 -07:00
committed by GitHub
parent 225059f8ea
commit 8f9467492d
5 changed files with 4 additions and 12 deletions

View File

@@ -230,7 +230,7 @@ async def async_setup(hass, config):
) )
try: try:
with async_timeout.timeout(CONNECTION_TIMEOUT, loop=hass.loop): with async_timeout.timeout(CONNECTION_TIMEOUT):
transport, protocol = await connection transport, protocol = await connection
except ( except (

View File

@@ -56,7 +56,6 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
# pylint: disable=no-member # pylint: disable=no-member
create_process = asyncio.subprocess.create_subprocess_shell( create_process = asyncio.subprocess.create_subprocess_shell(
cmd, cmd,
loop=hass.loop,
stdin=None, stdin=None,
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,
@@ -69,7 +68,6 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
# pylint: disable=no-member # pylint: disable=no-member
create_process = asyncio.subprocess.create_subprocess_exec( create_process = asyncio.subprocess.create_subprocess_exec(
*shlexed_cmd, *shlexed_cmd,
loop=hass.loop,
stdin=None, stdin=None,
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,

View File

@@ -100,7 +100,6 @@ async def async_setup_entry(hass, entry):
entry.data[CONF_HOST], entry.data[CONF_HOST],
psk_id=entry.data[CONF_IDENTITY], psk_id=entry.data[CONF_IDENTITY],
psk=entry.data[CONF_KEY], psk=entry.data[CONF_KEY],
loop=hass.loop,
) )
async def on_hass_stop(event): async def on_hass_stop(event):

View File

@@ -178,7 +178,7 @@ async def get_gateway_info(hass, host, identity, key):
"""Return info for the gateway.""" """Return info for the gateway."""
try: try:
factory = APIFactory(host, psk_id=identity, psk=key, loop=hass.loop) factory = APIFactory(host, psk_id=identity, psk=key)
api = factory.request api = factory.request
gateway = Gateway() gateway = Gateway()

View File

@@ -64,10 +64,7 @@ def async_create_clientsession(
connector = _async_get_connector(hass, verify_ssl) connector = _async_get_connector(hass, verify_ssl)
clientsession = aiohttp.ClientSession( clientsession = aiohttp.ClientSession(
loop=hass.loop, connector=connector, headers={USER_AGENT: SERVER_SOFTWARE}, **kwargs,
connector=connector,
headers={USER_AGENT: SERVER_SOFTWARE},
**kwargs,
) )
if auto_cleanup: if auto_cleanup:
@@ -174,9 +171,7 @@ def _async_get_connector(
else: else:
ssl_context = False ssl_context = False
connector = aiohttp.TCPConnector( connector = aiohttp.TCPConnector(enable_cleanup_closed=True, ssl=ssl_context)
loop=hass.loop, enable_cleanup_closed=True, ssl=ssl_context
)
hass.data[key] = connector hass.data[key] = connector
async def _async_close_connector(event: Event) -> None: async def _async_close_connector(event: Event) -> None: