* Merge original changes from #23590
* guard
* adjust
* adjust
* adjust
* Update async_render_to_info for recent codebase changes
* no more protected access
* do not fire right away per review comments
* update test to not fire right away
* closer
* rework tests for non firing first
* augment coverage
* remove cruft
* test for complex listen add/remove
* update docs to match review feedback to not fire right away
* preserve existing behavior
* fix test
* Ensure listeners are cleaned up
* de-dupe and comment
* de-dupe and comment
* coverage
* test to login again if we go from exception to ok to exception
* Update homeassistant/core.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/helpers/event.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* rename _boolean_coerce to result_as_boolean and move it out of event
* additional coverage
* Add more tests (may still be able to trim this down)
Co-authored-by: Swamp-Ig <github@ninjateaparty.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Reduce time to reload yaml and check configuration
We spend a significant amount of time compiling templates
that we have already compiled.
Use an LRU cache to avoid re-compiling templates that
we frequently use.
* pylint
* switch to WeakValueDictionary
* preen
* Re-evaluate template on group member state change
* Use named groups for entity extraction regex
This will avoid unnecessary edits of match indices if the regex is
amended in the future
* Improve test coverage
* Add and improve core and config_entries type hints
* Complete and improve config_entries type hints
* More entity registry type hints
* Complete helpers.event type hints
* Type check all helpers, add inline exclusions for work in progress
* Remove unused Script._template_cache
* Add some missing type hints
* Remove unneeded type: ignore
* Type hint fixes
* Mypy assistance tweaks
* Don't look for None in deprecated config "at most once" check
* Avoid None name slugify attempt when generating entity id
* Avoid None state store attempt on entity remove
* Make entity_filter be a modifiable builder
* Add render_with_collect method
* Use sync render_with_collect and non-class based test case
* Refactor: Template renders to RenderInfo
* Freeze with exception too
* Finish merging test changes
* Removed unused sync interface
* Final bits of the diff
Handle the case of async_render_with_possible_json_value's value argument
being something other than a string. This can happen, e.g., when using the
SQL sensor to extract a datetime column such as last_changed and also using
its value_template to convert that datetime to another format. This was
causing a TypeError from json.loads, but async_render_with_possible_json_value
was only catching ValueError's.
* added additional filters
Added base64_encode, base64_decode and ordinal filters.
* added test cases
added test cases for base64_encode, base64_decode and ordinal filters.
* forgot to add filters :)
## Description:
More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).
## Checklist:
- [ ] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**