Commit Graph

70 Commits (5da629b3e59bca2cf7ca1236ffe82c49e89b85a0)

Author SHA1 Message Date
J. Nick Koston 5d421e249f
YAML loader performance improvements (#111199)
* YAML loader performance improvements

- Cache the name of the loader since we call it multiple
  times for every line

- Add a fast path for scalar tags since they are the
  most common

* Update homeassistant/util/yaml/loader.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* remove unreachable code

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-02-23 13:37:09 -05:00
Erik Montnemery 1cb5bbf865
Fix empty files included by !include_dir_named (#108489)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-01-20 15:12:32 +01:00
Marc Mueller afcb7a26cd
Enable strict typing for config (#108023) 2024-01-18 09:20:19 +01:00
Pedro Lamas 6cab4486f7
Fix loading empty yaml files with include_dir_named (#107853) 2024-01-16 10:23:04 +01:00
Marc Mueller 43fa51b696
Enable strict typing for blueprint (#106887) 2024-01-02 20:48:51 +01: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 5b59e043fa
Don't use deprecated_class decorator on deprecated YAML classes (#105063) 2023-12-05 11:36:26 +01:00
Erik Montnemery ae002e2f38
Remove breaks_in_ha_version from deprecated YAML classes (#105062) 2023-12-05 10:48:31 +01:00
Erik Montnemery db51a8e1f7
Allow passing breaks_in_ha_version to deprecation helper decorators (#104985) 2023-12-04 11:52:10 +01:00
Erik Montnemery 00e57ab9a4
Use deprecated_class decorator in deprecated YAML loader classes (#104835) 2023-11-30 22:43:34 +01:00
Erik Montnemery abc05451a2
Restore renamed yaml loader classes and warn when used (#104818) 2023-11-30 18:14:48 +01:00
Erik Montnemery 12902b8a68
Add NodeStrClass.__voluptuous_compile__ (#104808) 2023-11-30 17:45:27 +01:00
Aarni Koskela 706add4a57
Switch formatting from black to ruff-format (#102893)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:38:59 +01:00
Erik Montnemery 88698d8dfe
Fix docstring in yaml util (#104240) 2023-11-20 11:34:14 +01:00
Erik Montnemery f89194784d
Fix including yaml files with scalar values (#103914) 2023-11-13 15:23:50 +01:00
Erik Montnemery e49f6b41ee
Rename YAML loader classes (#103609) 2023-11-08 00:26:54 +01:00
Erik Montnemery c29b0cd05b
Correct line numbers in yaml node annotations (#103605) 2023-11-07 23:22:23 +01:00
Erik Montnemery 05deae09fc
Add file and line annotation to strings when loading yaml (#103586) 2023-11-07 17:10:15 +01:00
Marc Mueller 11e8bf0b9c
Update types packages (#100850) 2023-09-25 18:53:22 +02:00
Ville Skyttä 6399d74c15
Remove unnnecessary pylint configs from core (#98704) 2023-08-22 23:12:12 +02:00
rlippmann 3a72054f93
Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
Paulus Schoutsen 3f32c5d2ad
Yaml use dict (#88977)
* Use built-in dict instead of OrderedDict

* Use dict instead of OrderedDict in YAML
2023-03-01 12:29:57 -05:00
Marc Mueller 8abce25948
Update Union typing (4) [Py310] (#86427) 2023-01-23 09:04:40 +01:00
Franck Nijhof 7adb8d5ddc
Code styling tweaks to core utils & YAML loader (#85433)
Code styling tweaks to core utils
2023-01-08 22:01:55 -08: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
Marc Mueller 19acbf0d2a
Update types packages (#84381) 2022-12-21 19:15:55 +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
J. Nick Koston 48e82ff62f
Fix failure to raise on bad YAML syntax from include files (#75510)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-07-20 19:25:17 +02:00
J. Nick Koston 034c0c0593
Improve YAML Dump times with C Dumper (#73424) 2022-06-13 13:14:30 -07: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
Marc Mueller be7ef6115c
Make TypeVars private (1) (#68205) 2022-03-17 18:52:38 +01:00
Marc Mueller 0188e8b319
Add type ignore error codes [util] (#66777) 2022-02-18 11:30:59 +01:00
Marc Mueller 7af67d34cf
Use assignment expressions 01 (#56394) 2021-09-18 13:31:35 -10:00
Franck Nijhof 13bf5dbee4
Upgrade mypy to 0.902 (#51907) 2021-06-16 14:35:32 +02:00
Ruslan Sayfutdinov 391b2f8ccd
Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03:00
Marc Mueller f1d48ddfe3
Update pylint to 2.8.0 (#49637) 2021-04-24 14:39:24 -10: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
J. Nick Koston c820dd4cb5
Have pylint warn when user visible log messages do not start with capital letter or end with a period (#48064)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-19 09:26:36 -05:00
Marc Mueller fabd73f08b
Update typing 03 (#48015) 2021-03-17 21:46:07 +01:00
Franck Nijhof 208a104e96
Fix secrets in files included via include_dir_list (#47350) 2021-03-04 09:33:35 -08: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
Tom Parker-Shemilt 27d16af36b
Don't allow recursive secrets loading (#41812)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-02-14 14:23:31 +01: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
Paulus Schoutsen 58648019c6
Deprecate the use of keyring and credstash (#43854) 2020-12-02 16:55:33 +01:00
Paulus Schoutsen 1c9c99571e
Use !input instead of !placeholder (#43820)
* Use !input instead of !placeholder

* Update input name

* Lint

* Move tests around
2020-12-01 18:21:36 +01:00
Paulus Schoutsen 0fb587727c
Add initial blueprint support (#42469)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-11-02 15:00:13 +01: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
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Bram Kragten 28332f23b3
Don't sort keys when dumping json and yaml (#39214) 2020-08-24 16:58:27 +02:00