Commit Graph

453 Commits (dab66990c0f27fd3afa681c7c1d57fcc18d89565)

Author SHA1 Message Date
Max 702d53ca30
Correct deprecation warning `async_register_static_paths` (#120592) 2024-06-26 20:55:25 +02:00
Marc Mueller bcd1243686
Use VolDictType to improve schema typing (#120417) 2024-06-25 15:15:59 +02:00
J. Nick Koston 6a3778c48e
Deprecate register_static_path in favor of async_register_static_paths (#119895)
* Deprecate register_static_path in favor of async_register_static_path

`hass.http.register_static_path` is deprecated because it does blocking I/O in the event loop, instead call `await hass.http.async_register_static_path([StaticPathConfig(url_path, path, cache_headers)])`

The arguments to `async_register_static_path` are the same as `register_static_path` except they are wrapped in the `StaticPathConfig` dataclass and an iterable of them is accepted to allow registering multiple paths at once to avoid multiple executor jobs.

* add date

* spacing
2024-06-18 21:51:24 -04:00
J. Nick Koston 419dcbf9a1
Fix typo in KEY_ALLOW_CONFIGRED_CORS (#119905) 2024-06-18 12:44:27 -05:00
J. Nick Koston faa55de538
Fix blocking I/O in the event loop when registering static paths (#119629) 2024-06-18 08:18:31 +02:00
J. Nick Koston e6b7301367
Fix blocking I/O in CachingStaticResource (#119663) 2024-06-14 08:27:50 +02:00
J. Nick Koston 6ba8b7a5d6
Remove isal from after_dependencies in http (#119000) 2024-06-07 09:21:53 +02:00
Robert Resch cb62f4242e
Remove strict connection (#117933) 2024-05-24 15:50:22 +02:00
Marc Mueller dd22ee3dac
Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
Marc Mueller 7998f874c0
Use PEP 695 for function annotations with scoping (#117787) 2024-05-20 12:43:39 +02:00
Marc Mueller 34ea781031
Use PEP 695 for decorator typing with type aliases (1) (#117662) 2024-05-18 11:42:39 +02:00
Marc Mueller 34bd291615
Use PEP 695 for decorator typing (1) (#117638) 2024-05-17 16:27:02 +02:00
Sid b456d97e65
Replace pylint protected-access with Ruff SLF001 (#115735) 2024-05-06 20:33:26 +02:00
J. Nick Koston 673bbc1372
Switch out aiohttp-isal for aiohttp-fast-zlib to make isal optional (#116814)
* Switch out aiohttp-isal for aiohttp-fast-zlib to make isal optional

aiohttp-isal does not work on core installs where the system has 32bit userland and a 64bit kernel because we have no way to detect this configuration or handle it.

fixes #116681

* Update homeassistant/components/isal/manifest.json

* Update homeassistant/components/isal/manifest.json

* hassfest

* isal

* fixes

* Apply suggestions from code review

* make sure isal is updated before http

* fix tests

* late import
2024-05-05 17:06:12 -04:00
Robert Resch 630ddd6a8c
Revert "Remove strict connection" (#116416) 2024-04-29 21:26:40 +02:00
Robert Resch dfc198cae0
Remove strict connection (#116396) 2024-04-29 19:33:31 +02:00
Erik Montnemery 59dc394ac7
Fix language in strict connection guard page (#116154) 2024-04-25 10:48:32 +02:00
Robert Resch bcc2dd99b2
Rename strict connection static page to guard page (#116085) 2024-04-24 10:29:59 +02:00
Robert Resch a4829330f6
Add strict connection for cloud (#115814)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-24 09:57:38 +02:00
J. Nick Koston 0a78e9d4aa
Replace aiohttp-zlib-ng[isal] with aiohttp-isal (#115777)
* Replace aiohttp-zlib-ng[isal] with aiohttp-isal

The extra was causing wheel builds to fail

Since isal works on all of our supported platforms we can
always use it and drop the need for zlib-ng

https://github.com/home-assistant/core/actions/runs/8725019072

https://github.com/bdraco/aiohttp-isal

* typo
2024-04-17 19:46:15 +02:00
J. Nick Koston a6a47c0b44
Make aiohttp_cors a top level import (#115563)
* Make aiohttp_cors a top level import

This was moved to a late import in #27935 but there is no
longer any need to import it late in the event loop as aiohttp_cors
is listed in pyproject.toml so it will always be available

* drop requirements as they are all top level now

* drop requirements as they are all top level now

* adjust
2024-04-15 21:06:59 +02:00
Bram Kragten f16ee2ded9
Update strict connection static page (#115473) 2024-04-12 23:35:59 +02:00
Robert Resch 348e1df949
Add strict connection (#112387)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-12 14:47:46 +02:00
Sid 0d66d298ec
Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
J. Nick Koston 7a2e529bb7
Avoid executor job to start http if server_host is unspecified (#114609)
* Avoid executor job to start http if server_host is unspecified

Same as #112522 for http

* adjust test

* CONF_SERVER_HOST is always set now
2024-04-04 07:51:18 +02:00
Sid a5b609f081
Enable ruff TRY401 (#114395)
* Enable ruff TRY401

* fix tests
2024-03-29 07:20:36 +01:00
Sid f7b7f74d10
Enable Ruff TRY201 (#114269)
* Enable Ruff TRY201

* remove redundant rules
2024-03-28 10:18:07 +01:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller d779333bef
Use TypeVarTuple for add_job and run_job methods (#114122) 2024-03-24 18:52:39 +01:00
J. Nick Koston c615b52840
Refactor integration startup time to show wall clock time (#113707)
* Refactor setup time tracking to exclude time waiting on other operations

We now exclude the import time and th time waiting on
base platforms to setup from the setup times

* tweak

* tweak

* tweak

* tweak

* adjust

* fixes

* fixes

* preen

* preen

* tweak

* tweak

* adjust

* tweak

* reduce

* do not count integrtion platforms against their parent integration

* handle legacy tts platforms

* stt as well

* one more wait

* use the same pattern in all the legacy

* fix tts and stt legacy

* fix

* fix

* reduce

* preen

* entity comp does not wait for platforms

* scene blocks as well

* fix test

* test fixes

* coverage

* coverage

* coverage

* fix test

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/test_setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* strip

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* remove complexity

* Apply suggestions from code review

* no longer works that way

* fixes

* fixes

* fixes

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-03-18 21:45:34 -04:00
Sid 82a60fe8ad
Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Marc Mueller 8809d3aa88
Add empty line after module docstring [g-i] (#112699) 2024-03-08 08:52:48 -05:00
Marc Mueller 2d701d5a7d
Use aiohttp.AppKey for http cors keys (#112658) 2024-03-08 11:51:59 +01:00
Marc Mueller eb8f8e1ae4
Use aiohttp.AppKey for http ban keys (#112657) 2024-03-08 11:13:24 +01:00
Erik Montnemery 49d20eedd4
Remove local imports of hass-nabucasa (#112634) 2024-03-07 20:37:35 +01:00
Marc Mueller 531e25cbc6
Change KEY_HASS to be an aiohttp AppKey (#111954) 2024-03-07 13:37:48 +01:00
J. Nick Koston 9be4fb0574
Start fetching the source ip sooner in http to reduce setup time (#112461) 2024-03-05 21:32:02 -05:00
J. Nick Koston c1750f7c3a
Fix circular imports in core integrations (#111875)
* Fix circular imports in core integrations

* fix circular import

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* adjust

* fix

* increase timeout

* remove unused logger

* keep up to date

* make sure its reprod
2024-02-29 21:04:41 -05:00
J. Nick Koston b54e282801
Remove follow symlinks support from CachingStaticResource (#109015) 2024-01-28 10:07:12 -10:00
J. Nick Koston 9de8409f48
Speed up security filter middleware (#108703)
* Speed up security filter middleware

Check the path and query string with the filter expression once instead
of checking the path and query string seperately. If we get a hit than
we check the query string to ensure we give a more verbose error about
where the filter hit.

Additionally since we see the same urls over and over, cache the unquote

* request.url is to expensive, cheaper to join

* aiohttp has a path_qs fast path

* construct the string outselves so it functions exactly as before
2024-01-26 00:17:18 -05:00
J. Nick Koston c01e8288c1
Convert http auth internals to normal functions (#108815)
Nothing was being awaited here anymore, these can be normal functions
2024-01-24 22:34:52 -05:00
J. Nick Koston 2eea658fd8
Convert getting and removing access tokens to normal functions (#108670) 2024-01-22 20:51:33 -10:00
Marc Mueller 25b7bb4a4f
Adjust require_admin decorator typing (#108306)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-01-18 14:12:14 -10:00
J. Nick Koston 86603b332a
Bump aiohttp-zlib-ng to 0.3.1 (#107595) 2024-01-08 13:24:57 -10:00
J. Nick Koston 8645d9c717
Bump aiohttp-zlib-ng to 0.3.0 (#107184) 2024-01-05 14:28:29 +01:00
J. Nick Koston 40d034cd8c
Revert "Bump aiohttp-zlib-ng to 0.2.0 (#106691)" (#107109) 2024-01-04 15:34:43 +01:00
J. Nick Koston e1f078b70a
Bump aiohttp-zlib-ng to 0.2.0 (#106691) 2024-01-02 20:50:26 +01:00
J. Nick Koston 093c952c38
Bump aiohttp-zlib-ng to 0.1.3 (#106489)
Reverts the workaround that was created for #105254 since the original
issue is fixed in zlib_ng 0.3.0+ which the lib now requires as a minimum
version
2023-12-27 08:04:07 -10:00
J. Nick Koston e75357980a
Bump aiohttp-zlib-ng to 0.1.2 (#106193)
fixes #105254
2023-12-22 00:03:42 +01:00
Ville Skyttä 24b1e01d71
Update Ruff to 0.1.8, avoid linter/formatter conflicts (#106080)
* Disable Ruff rules that may conflict with the formatter

* Upgrade Ruff to 0.1.8

- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8

* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00