213 Commits

Author SHA1 Message Date
Sid
2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
Sid
b456d97e65
Replace pylint protected-access with Ruff SLF001 (#115735) 2024-05-06 20:33:26 +02:00
Erik Montnemery
d31124d5d4
Avoid creating unneeded Context and Event objects when firing events (#113798)
* Avoid creating unneeded Context and Event objects when firing events

* Add test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-20 09:40:06 +01:00
Sid
6ee273a548
Clean up unneeded ruff noqa directives (#113616) 2024-03-16 09:48:37 -10:00
Marc Mueller
a6b842f818
Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +01:00
Marc Mueller
19ab3d6daf
Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Franck Nijhof
6ce16286d5
Update colorlog to 6.8.2 (#109072) 2024-01-29 23:24:17 +01:00
J. Nick Koston
ec15b0def2
Always load auth storage at startup (#108543) 2024-01-20 16:16:43 -10:00
Erik Montnemery
5b55c7da5f
Remove logic converting empty or falsy YAML to empty dict (#103912)
* Correct logic converting empty YAML to empty dict

* Modify according to github comments

* Add load_yaml_dict helper

* Update check_config script

* Update tests
2023-12-05 18:08:11 +01:00
Erik Montnemery
e2f6fbd59b
Fix colors in check_config script (#104069) 2023-11-17 13:21:04 -05:00
Erik Montnemery
3ba8a82243
Differentiate between warnings and errors in check_config helper (#102902)
* Differentiate between warnings and errors in check_config helper

* Update tests

* Treat configuration errors in frontend and its dependencies as errors

* Improve test coverage

* Address review comments

* Improve test coverage

* Improve test coverage

* Address review comments

* Add comment
2023-11-05 03:08:04 +01:00
Erik Montnemery
09ad1a9a36
Remove unnecessary block use of pylint disable in components p-z (#100192) 2023-09-12 20:47:48 +02:00
Erik Montnemery
7fcc2dd44e
Make the check_config script open issue_registry read only (#98545)
* Don't blow up if validators can't access the issue registry

* Make the check_config script open issue_registry read only

* Update tests/helpers/test_issue_registry.py

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

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-08-18 20:15:00 +02:00
Erik Montnemery
91faa53843
Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
Erik Montnemery
3b9d6f2dde
Add setup function to the component loader (#98148)
* Add setup function to the component loader

* Update test

* Setup the loader in safe mode and in check_config script
2023-08-15 10:59:42 +02:00
Franck Nijhof
38823bae71
Update colorlog to 6.7.0 (#96131) 2023-07-11 14:29:09 -04:00
epenet
ee781e4f49
Adjust registry access in scripts (#88884) 2023-02-28 21:58:47 -05:00
Franck Nijhof
79b52a2b41
Stricter pylint message control (#86154) 2023-01-20 13:47:55 +01:00
Franck Nijhof
64c2340fab
Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck Nijhof
d4f69a3652
String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
J. Nick Koston
8b067e83f7
Initial orjson support take 3 (#73849)
* Initial orjson support take 2

Still need to work out problem building wheels

--

Redux of #72754 / #32153 Now possible since the following is solved:
ijl/orjson#220 (comment)

This implements orjson where we use our default encoder.  This does not implement orjson where `ExtendedJSONEncoder` is used as these areas tend to be called far less frequently.  If its desired, this could be done in a followup, but it seemed like a case of diminishing returns (except maybe for large diagnostics files, or traces, but those are not expected to be downloaded frequently).

Areas where this makes a perceptible difference:
- Anything that subscribes to entities (Initial subscribe_entities payload)
- Initial download of registries on first connection / restore
- History queries
- Saving states to the database
- Large logbook queries
- Anything that subscribes to events (appdaemon)

Cavets:
orjson supports serializing dataclasses natively (and much faster) which
eliminates the need to implement `as_dict` in many places
when the data is already in a dataclass. This works
well as long as all the data in the dataclass can also
be serialized. I audited all places where we have an `as_dict`
for a dataclass and found only backups needs to be adjusted (support for `Path` needed to be added for backups).  I was a little bit worried about `SensorExtraStoredData` with `Decimal` but it all seems to work out from since it converts it before it gets to the json encoding cc @dgomes

If it turns out to be a problem we can disable this
with option |= [orjson.OPT_PASSTHROUGH_DATACLASS](https://github.com/ijl/orjson#opt_passthrough_dataclass) and it
will fallback to `as_dict`

Its quite impressive for history queries
<img width="1271" alt="Screen_Shot_2022-05-30_at_23_46_30" src="https://user-images.githubusercontent.com/663432/171145699-661ad9db-d91d-4b2d-9c1a-9d7866c03a73.png">

* use for views as well

* handle UnicodeEncodeError

* tweak

* DRY

* DRY

* not needed

* fix tests

* Update tests/components/http/test_view.py

* Update tests/components/http/test_view.py

* black

* templates
2022-06-22 21:59:51 +02:00
Martin Hjelmare
8049170e5a
Initialize hass.config_entries for check config (#73575) 2022-06-16 14:40:41 +02:00
J. Nick Koston
dca4d3cd61
Significantly improve yaml load times when the C loader is available (#73337) 2022-06-13 08:44:46 -10:00
J. Nick Koston
c365454afb
Revert "Initial orjson support (#72754)" (#72789)
This was causing the wheels to fail to build. We need
to workout why when we don't have release pressure

This reverts commit d9d22a95563c745ce6a50095f7de902eb078805d.
2022-05-31 13:51:55 -07:00
J. Nick Koston
d9d22a9556
Initial orjson support (#72754) 2022-05-31 12:18:11 -07:00
Franck Nijhof
8f4caf4141
Clean up accessing event helpers via hass (#72011) 2022-05-17 19:36:29 +02:00
J. Nick Koston
24d7a464e1
Refactor logbook to reduce overhead and complexity (#71509) 2022-05-08 21:47:26 -07:00
J. Nick Koston
b8442d9340
Add json decode caching to logbook (#71080) 2022-05-01 19:33:31 -05:00
J. Nick Koston
fe6a4bfb1d
Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC (#69643)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 09:05:54 -10:00
Marc Mueller
be7ef6115c
Make TypeVars private (1) (#68205) 2022-03-17 18:52:38 +01:00
Franck Nijhof
fa09cf663e
Update black to 22.1.0 (#65788) 2022-02-05 14:19:37 +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
Erik Montnemery
cb2c2d98c3
Remove unnecessary checks before calling os.makedirs (#62576) 2021-12-23 09:59:31 +01:00
Franck Nijhof
ca2f343c51
Upgrade colorlog to 6.6.0 (#59440) 2021-11-09 21:30:23 +02:00
Marc Mueller
77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Franck Nijhof
237efcf6b1
Upgrade colorlog to 6.4.1 (#56573) 2021-09-23 16:12:13 +02:00
Paulus Schoutsen
7111fc47c4
Better handle invalid trigger config (#55637) 2021-09-03 10:15:57 -07:00
Ville Skyttä
848c0be58a
Avoid some implicit generic Anys (#54577) 2021-08-16 23:12:06 +02:00
Marc Mueller
c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Franck Nijhof
63fa9f7dd8
Upgrade colorlog to 5.0.1 (#49221) 2021-04-14 23:56:32 +02:00
Franck Nijhof
6cead320de
Bump colorlog to 4.8.0 (#48218) 2021-03-22 13:10:01 +01:00
Marc Mueller
fabd73f08b
Update typing 03 (#48015) 2021-03-17 21:46:07 +01:00
Paulus Schoutsen
2df644c6cc
Clean up secret loading (#47034) 2021-03-02 12:58:53 -08:00
Paulus Schoutsen
633a7aeb22
Remove deprecated credstash + keyring (#47033) 2021-02-25 09:48:19 +01:00
J. Nick Koston
c9df42b69a
Add support for pre-filtering events to the event bus (#46371) 2021-02-14 09:42:55 -10:00
Fabian Affolter
d38d8a542d
Upgrade colorlog to 4.7.2 (#45840) 2021-02-01 19:01:19 -05:00
Fabian Affolter
2e62e0661b
Upgrade colorlog to 4.6.2 (#44652) 2020-12-30 17:12:51 +01:00
Franck Nijhof
2656e9b0f9
Upgrade colorlog to 4.5.0 (#42965) 2020-11-08 14:05:55 +01:00
Ville Skyttä
f28c3273c2
Upgrade mypy to 0.790 (#41595) 2020-10-12 19:17:30 -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