1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-26 12:55:16 +00:00
Commit Graph

99 Commits

Author SHA1 Message Date
Marc Mueller
87bb7ced79 Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
Marc Mueller
8f614fb06d Use HassKey for helpers (2) (#117013) 2024-05-07 11:24:13 -05:00
J. Nick Koston
4341b21a61 Migrate auth to use async_import_module to avoid blocking I/O in the event loop (#113387) 2024-03-14 10:44:36 +01:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Erik Montnemery
82efb3d35b Make FlowResult a generic type (#111952) 2024-03-07 12:41:14 +01:00
Erik Montnemery
3d3e9900c3 Add TypeVar default for FlowResult (#112345)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-03-05 22:52:11 +01:00
Erik Montnemery
a0e558c457 Add generic classes BaseFlowHandler and BaseFlowManager (#111814)
* Add generic classes BaseFlowHandler and BaseFlowManager

* Migrate zwave_js

* Update tests

* Update tests

* Address review comments
2024-02-29 16:52:39 +01:00
Robert Resch
cf9b0e804f Deprecate legacy api auth provider (#104409)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:16:18 +01:00
Robert Resch
852fb58ca8 Extend auth/providers endpoint and add /api/person/list endpoint for local ip requests (#103906)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-11-24 17:11:54 +01:00
Hejki
65a2f5bcd5 Support for group into command_line auth provider (#92906)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 13:19:25 +01:00
Marc Mueller
0b2b486754 Update mypy to 1.6.0 (#101780) 2023-10-11 13:25:11 +02:00
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
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
8abce25948 Update Union typing (4) [Py310] (#86427) 2023-01-23 09:04:40 +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
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
epenet
16900dcef1 Make Store a generic class (#74617) 2022-07-09 22:32:57 +02: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
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
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
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
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
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
Paulus Schoutsen
2d374d65b6 Mark auth voluptuous schema fields as required (#57003) 2021-10-03 22:02:30 -07:00
Marc Mueller
7af67d34cf Use assignment expressions 01 (#56394) 2021-09-18 13:31:35 -10:00
Ville Skyttä
848c0be58a Avoid some implicit generic Anys (#54577) 2021-08-16 23:12:06 +02:00
Marc Mueller
46c3495ae0 Update pylint to 2.9.5 (#53496) 2021-07-26 16:17:15 +02:00
Joakim Plate
d339e3bd8c Reject trusted network access from proxies (#52388) 2021-07-02 11:49:42 +02:00
Franck Nijhof
cdd1f6b2f0 Always load middle to handle forwarded proxy data (#51332) 2021-06-01 09:38:55 -07:00
Paulus Schoutsen
bd0373388d Trusted networks auth provider warns if detects a requests with x-forwarded-for header while the http integration is not configured for reverse proxies (#51319)
* Trusted networks auth provider to require http integration configured for proxies to allow logging in with requests with x-forwarded-for header

* Make it a warning
2021-06-01 12:51:44 +02:00
Ruslan Sayfutdinov
183220008d Rename FlowResultDict to FlowResult (#49847) 2021-04-29 13:40:51 +02:00
Ruslan Sayfutdinov
80f66f301b Define data flow result type (#49260)
* Define data flow result type

* Revert explicit definitions

* Fix tests

* Specific mypy ignore
2021-04-15 07:17:07 -10:00
Marc Mueller
fabd73f08b Update typing 03 (#48015) 2021-03-17 21:46:07 +01:00
Marc Mueller
16dcbf1467 Update pylint (#47205) 2021-02-28 22:09:01 -10:00
Franck Nijhof
9b7c39d20b Postponed evaluation of annotations in core (#46434)
* Postponed evaluation of annotations in core

* Remove unneeded future
2021-02-12 10:58:20 +01:00
tkdrob
04f39d7dd4 Use core constants for command_line auth provider (#45907) 2021-02-03 19:19:22 -05:00
Joakim Plate
38d2cacf7a Support blocking trusted network from new ip (#44630)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-28 12:06:20 +01:00
springstan
92379ad8d2 Use list literal without using dict.keys() (#42573) 2020-10-30 09:19:13 -05:00
Ville Skyttä
b4bac0f7a0 Exception chaining and wrapping improvements (#39320)
* Remove unnecessary exception re-wraps

* Preserve exception chains on re-raise

We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.

The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.

Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.

* Fix mistaken re-wrap in homematicip_cloud/hap.py

Missed the difference between HmipConnectionError and
HmipcConnectionError.

* Do not hide original error on plex new cert validation error

Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
2020-08-28 13:50:32 +02:00
Paulus Schoutsen
9979e465aa Fix hassio auth data (#39244)
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-08-25 14:22:50 +02:00
Paulus Schoutsen
13df3bce1b Allow owner users to change password of any user (#39242) 2020-08-25 13:49:32 +02:00