1
mirror of https://github.com/home-assistant/core synced 2024-10-01 05:30:36 +02:00
Commit Graph

187 Commits

Author SHA1 Message Date
Franck Nijhof
c3936e6f14
Replace isort with ruff (#94302) 2023-06-08 23:43:56 +02:00
Patrick Li
46103f56c4
Fix trusted_users group schema (#92847)
* Fix trusted_users group schema

* Add tests for CONFIG_SCHEMA
2023-05-23 20:11:25 +02:00
J. Nick Koston
32b70ea133
Bump PyJWT to 2.7.0 (#93128) 2023-05-16 10:26:04 +02:00
J. Nick Koston
ca576d45ac
Cache decode of JWT tokens (#90013) 2023-03-22 16:03:41 -10:00
epenet
f2b736fad0
Adjust entity registry access in core platforms (#88944)
* Adjust entity registry access in platforms

* Adjust more core components
2023-03-01 08:02:16 +01:00
J. Nick Koston
03eea7bd3f
Avoid subprocess memory copy when c library supports posix_spawn (#87958)
* use posix spawn on alpine

* Avoid subprocess memory copy when c library supports posix_spawn

By default python 3.10 will use the fork() which has to
copy all the memory of the parent process (in our case
this can be huge since Home Assistant core can use
hundreds of megabytes of RAM). By using posix_spawn
this is avoided.

In python 3.11 vfork will also be available
https://github.com/python/cpython/issues/80004#issuecomment-1093810689
https://github.com/python/cpython/pull/11671 but we won't
always be able to use it and posix_spawn is considered safer
https://bugzilla.kernel.org/show_bug.cgi?id=215813#c14

The subprocess library doesn't know about musl though
even though it supports posix_spawn https://git.musl-libc.org/cgit/musl/log/src/process/posix_spawn.c
so we have to teach it since it only has checks for glibc
1b736838e6/Lib/subprocess.py (L745)

The constant is documented as being able to be flipped here:
https://docs.python.org/3/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn

* Avoid subprocess memory copy when c library supports posix_spawn

By default python 3.10 will use the fork() which has to
copy memory of the parent process (in our case
this can be huge since Home Assistant core can use
hundreds of megabytes of RAM). By using posix_spawn
this is avoided and subprocess creation does not
get discernibly slow the larger the Home Assistant
python process grows.

In python 3.11 vfork will also be available
https://github.com/python/cpython/issues/80004#issuecomment-1093810689
https://github.com/python/cpython/pull/11671 but we won't
always be able to use it and posix_spawn is considered safer
https://bugzilla.kernel.org/show_bug.cgi?id=215813#c14

The subprocess library doesn't know about musl though
even though it supports posix_spawn https://git.musl-libc.org/cgit/musl/log/src/process/posix_spawn.c
so we have to teach it since it only has checks for glibc
1b736838e6/Lib/subprocess.py (L745)

The constant is documented as being able to be flipped here:
https://docs.python.org/3/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn

* missed some

* adjust more tests

* coverage
2023-02-13 09:02:51 -05:00
Franck Nijhof
ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
Marc Mueller
6397138589
Update Optional typing (1) [Py310] (#86417)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-01-23 09:56:10 +01:00
Marc Mueller
8abce25948
Update Union typing (4) [Py310] (#86427) 2023-01-23 09:04:40 +01:00
Franck Nijhof
64c2340fab
Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck Nijhof
b0cee0bc46
String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
Franck Nijhof
73a43bfd1d
Update pyotp to 2.8.0 (#84339) 2022-12-21 11:53:02 +01:00
Erik Montnemery
bf4c399b19
Improve data entry flow typing (#84030) 2022-12-15 12:41:20 +01:00
Erik Montnemery
22b4c445a0
Drop title from auth flows (#83628) 2022-12-12 10:53:28 +01:00
Aarni Koskela
8038485ca4
Use partition instead of split where possible in core (#81806) 2022-11-15 21:45:48 +01:00
Marc Mueller
0c8eeaa643
Update mypy to 0.990 (#81783)
* Update mypy to 0.990

* Remove type ignore - overriding attr with property (13475)

* Remove type ignores - hasattr (13544)

* Adjust type ignore - assignment (13549)

* New error code - type-abstract (13785)

* Disable annotation-unchecked (13851)
2022-11-08 14:41:39 +01:00
Franck Nijhof
cf138c7266
Update pyotp to 2.7.0 (#78500) 2022-09-15 11:53:16 +02:00
Marc Mueller
af7df260a0
Fix small type issues [core] (#75760) 2022-07-26 16:28:22 +02:00
epenet
16900dcef1
Make Store a generic class (#74617) 2022-07-09 22:32:57 +02:00
J. Nick Koston
211e5432ac
Add EVENT_USER_UPDATED (#71965) 2022-06-09 20:49:02 -07:00
epenet
f91aa33c5f
Add FlowResultType enum to data entry flow (#72955) 2022-06-07 22:02:44 -07:00
epenet
627d6f7803
Ensure description_placeholders is always typed (#72716) 2022-05-31 10:33:34 +02:00
Franck Nijhof
5f44d0f8f9
Clean up accessing storage.Store helper via hass (#72009) 2022-05-17 18:45:57 +02:00
Franck Nijhof
69cc6ab5f1
Clean up accessing entity_registry.async_get_registry helper via hass (#72005) 2022-05-17 16:40:45 +02:00
Marc Mueller
9b9b553521
Disable no-self-use [pylint] (#70641)
* Disable no-self-use

* Remove disable comments
2022-04-25 07:41:01 -07:00
Marc Mueller
ec980a574b
Improve typing [util.decorator] (#67087) 2022-02-23 20:58:42 +01:00
Marc Mueller
1ad023a63f
Add type ignore error codes [auth] (#66774) 2022-02-18 23:29:56 +01:00
Marc Mueller
9c5e0fc5e0
Fix auth type comment (#66522) 2022-02-14 20:10:18 +01:00
Marc Mueller
5e633498d2
Enable no_implicit_reexport for core files [mypy] (#63820) 2022-01-26 10:55:06 +01:00
Marc Mueller
12757a8cd2
Update typing - collections.abc (1) (#63933)
* Update typing - collections.abc (1)

* Additional typing updates
2022-01-12 07:56:35 +01:00
Marc Mueller
240c9979c7
Move disallow-any-generics to mypy.ini (#63917) 2022-01-11 13:33:25 -08:00
Marc Mueller
d3b7bd25ef
Update typing (1) (#63922) 2022-01-11 21:26:03 +01:00
Marc Mueller
021debb5c5
Resolve implicit imports (#63832) 2022-01-10 17:10:46 +01:00
Tobias Sauerwein
2c904c0974
Bump mypy to 0.930 (#62642)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-12-27 17:55:17 +01:00
Ruslan Sayfutdinov
55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Paulus Schoutsen
72d8882c79
Handle errors response to be None (#60679)
Co-authored-by: Philip Allgaier <mail@spacegaier.de>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-12-01 13:51:10 +01:00
Paulus Schoutsen
914f7f85ec
Add local only users (#57598) 2021-11-29 14:01:03 -08:00
J. Nick Koston
96f7b0d910
Use atomicwrites for mission critical core files (#59606) 2021-11-15 11:19:31 +01:00
Paulus Schoutsen
e30e4d5c6d
Block cloud explicitely from trusted networks (#59333)
* Block cloud explicitely from trusted networks

* Lint
2021-11-12 10:25:01 +01:00
Christian Bilevits
370c7a7ccf
Bump pyotp to 2.6.0 (#58413) 2021-10-26 20:41:12 +02:00
Marc Mueller
eab235173b
Use assignment expressions 28 (#58189) 2021-10-22 14:06:04 +02:00
Robert Hillis
488a636aec
Clean up unused loggers (#57662) 2021-10-14 10:03:38 -07:00
Paulus Schoutsen
ffbe4cffae
Guard linking credential that is already linked (#57595)
* Guard linking credential that is already linked

* Update test descriptions
2021-10-13 17:36:31 +02:00
Paulus Schoutsen
0ae1186554
Use gather ipv wait to remove credentials to catch exceptions (#57596) 2021-10-13 17:34:57 +02:00
David Boslee
7f966613bd
Disconnect websockets after token is revoked (#57091)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-10-08 09:38:22 -07:00
Paulus Schoutsen
2d374d65b6
Mark auth voluptuous schema fields as required (#57003) 2021-10-03 22:02:30 -07:00
Marc Mueller
77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Marc Mueller
7af67d34cf
Use assignment expressions 01 (#56394) 2021-09-18 13:31:35 -10:00
Ruslan Sayfutdinov
7195b8222b
Bump PyJWT to 2.1.0 (#55911) 2021-09-07 20:59:02 -07:00
Ville Skyttä
848c0be58a
Avoid some implicit generic Anys (#54577) 2021-08-16 23:12:06 +02:00