Jesse Moody
d7de23fa65
Adjust eventloop -> event loop spelling ( #89931 )
...
eventloop -> event loop spelling
2023-03-19 21:53:21 +01:00
J. Nick Koston
5dbab21f9a
Fix missing f-string in filterable_job ( #89340 )
...
* Fix missing f-string in filterable_job
* remove bad test
2023-03-08 15:53:48 -05:00
J. Nick Koston
099f16f6b8
Fix missing f-string in async_listen ( #89336 )
2023-03-07 20:19:08 -05:00
Erik Montnemery
aa2267d68e
Rename hass context variable ( #89302 )
2023-03-07 23:21:47 +01:00
J. Nick Koston
11681f3f31
Pass a helpful name when creating common asyncio tasks in core ( #89171 )
2023-03-05 12:46:02 +01:00
J. Nick Koston
8f6cfc25c0
Use ulid-transform for constructing ulids ( #88939 )
...
* Use ulid-transform for constructing ulids
A future PR will use the new library to reduce the storage
overhead of ulids in the database
* tweak
* tweak
* bump
2023-02-28 21:09:47 -05:00
J. Nick Koston
b5223e1196
Restore previous behavior of only waiting for new tasks at shutdown ( #88740 )
...
* Restore previous behavior of only waiting for new tasks at shutdown
* cleanup
* do a swap instead
* await canceled tasks
* await canceled tasks
* fix
* not needed since we no longer clear
* log it
* reword
* wait for airvisual
* tests
2023-02-26 22:36:18 -05:00
J. Nick Koston
7b61d3763b
Log futures that are blocking shutdown stages ( #88736 )
2023-02-25 12:01:30 +01:00
Erik Montnemery
594b7b7e2c
Add clarifying comment about unit of elevation ( #88489 )
...
* Add clarifying comment about unit of elevation
* Make it a docstring
2023-02-22 09:06:43 -05:00
J. Nick Koston
5bc0636905
Replace fire_coroutine_threadsafe with asyncio.run_coroutine_threadsafe ( #88572 )
...
fire_coroutine_threadsafe did not hold a reference to the asyncio
task which meant the task had the risk of being prematurely
garbage collected
2023-02-21 21:16:18 -05:00
modrisb
9fd35d53e7
Change core return code processing ( #88326 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-17 20:56:02 -05:00
Paulus Schoutsen
3a32d2bdcb
Add background tasks to config entries ( #88335 )
...
* Use a set for config entries task tracking
* Allow adding background tasks to config entries
* Add tests for config entry add tasks
* Update docstrings on core create task
* Migrate roon and august
* Use in more places
* Guard for None
2023-02-17 13:50:05 -05:00
Paulus Schoutsen
6cab27f378
Add support for background tasks in HA ( #88265 )
...
* Add support for background tasks
* make name mandatory for background tasks
* Update docstring
* async_create_background_task
* Grammar
2023-02-16 20:39:29 -05:00
Paulus Schoutsen
d54f59478f
Keep task references while running ( #87970 )
...
* Keep task references while running
* Update pilight tests pointing at correct logger call
* Fix graphite tests
* Fix profiler tests
* More graphite test fixes
* Remove extra sleep
* Fix tests
* Shutdown background tasks as part of stage 1
* Remove unnecessary sleep in test
* Remove unused method on mock hass
* Skip on cancelled too
* Remove background tasks
* Test trigger variables without actually sleeping
* Fix graphite
* One more graphite grrrrrrr
2023-02-13 23:16:59 -05:00
J. Nick Koston
e41af8928b
Restore original aiohttp cancelation behavior ( #88046 )
2023-02-13 22:00:36 -06:00
Marc Mueller
342b406dc0
Add Self typing (1) [mypy 1.0] ( #87598 )
2023-02-06 22:29:47 -06:00
Franck Nijhof
ca1a12898c
Enable Ruff D212 ( #87347 )
2023-02-03 23:08:48 +01:00
J. Nick Koston
c612a92cfb
Use python defaults for comparing State, LazyState, and Event objects ( #86856 )
...
* Speed up comparing State and Event objects
Use default python implementation for State and Event __hash__ and __eq__
The default implementation compared based on the id() of the object
which is effectively what we want here anyways. These overrides are
left over from the days when these used to be attrs objects
By avoiding implementing these ourselves all of the equality checks
can happen in native code
* tweak
* adjust tests
* write out some more
* fix test to not compare objects
* more test fixes
* more test fixes
* correct stats tests
* fix more tests
* fix more tests
* update sensor recorder tests
2023-01-29 13:31:43 -05: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
45b4b0e990
Import `ParamSpec` from typing [Py310] ( #86413 )
...
* Import ParamSpec from typing [Py310]
* Update additional imports
2023-01-23 07:28:43 +01: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
J. Nick Koston
57239769ba
Only build compressed states once ( #85561 )
2023-01-09 12:07:32 -10: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
Marc Mueller
490aec0b11
Update pylint to 2.15.7 ( #82977 )
2022-11-30 12:20:18 +01:00
puddly
8c8994352d
Allow only specific packages to be skipped during startup dependency installation ( #82758 )
2022-11-30 08:38:52 +01:00
Erik Montnemery
67e4f2c202
Raise repairs issue if country is not configured ( #82685 )
2022-11-28 09:54:13 +01:00
Erik Montnemery
e1338adf1a
Allow configuring country and language in core config ( #81734 )
...
* Allow configuring country and language in core config
* Add script for updating list of countries
* Use black for formatting
* Fix quoting
* Move country codes to a separate file
* Address review comments
* Add generated/countries.py
* Get default language from owner account
* Remove unused variable
* Add script to generate list of supported languages
* Add tests
* Fix stale docsring
* Use format_python_namespace
* Correct async_user_store
* Improve typing
* Fix with_store decorator
* Initialize language in core store migration
* Fix startup
* Tweak
* Apply suggestions from code review
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Update storage.py
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-11-24 23:25:50 +01:00
epenet
67d1dde69f
Rename IMPERIAL_SYSTEM to US_CUSTOMARY_SYSTEM ( #80253 )
...
* Rename IMPERIAL_SYSTEM
* Deprecate is_metric property and adjust tests
* Adjust unit_system config validation
* Add yaml tests
* Add tests for private name
* Fix incorrect rebase
* Adjust docstring
* Add store migration
* Update unit_system.py
* Minimise test tweaks
* Fix tests
* Add conversion to migration
* Rename new key and adjust tests
* Adjust websocket_detect_config
* Move original_unit_system tracking to subclass
2022-10-19 13:31:08 +02:00
epenet
a26b3e7a34
Refactor access to ConfigStore ( #80467 )
...
* Refactore access to ConfigStore
* Make tests async
* Reset config during test
2022-10-17 13:59:04 +02:00
epenet
bbb0b2a0e1
Refactor the core config store ( #80457 )
...
* Add helper for config Store
* Use internal class
2022-10-17 10:13:53 +02:00
epenet
bff5d1123f
Deprecate CONF_UNIT_SYSTEM_*** constants ( #80320 )
...
* Deprecate CONF_UNIT_SYSTEM_*** constants
* Adjust pylint plugin
* Add tests
* Remove single-use function
* Revert logic change
* Revert "Revert logic change"
This reverts commit 60959a0050
.
* Tweak again
2022-10-14 16:50:04 +02:00
epenet
4dd0c079d5
Deprecate name property of unit system ( #80257 )
2022-10-14 12:06:14 +02:00
Marc Mueller
3a9ecab98a
Improve iterable typing (1) ( #79295 )
2022-10-01 00:12:39 +02:00
Erik Montnemery
61ff1b786b
Add a context variable holding a HomeAssistant reference ( #76303 )
...
* Add a context variable holding a HomeAssistant reference
* Move variable setup and update test
* Refactor
* Revert "Refactor"
This reverts commit 346d005ee6
.
* Set context variable when creating HomeAssistant object
* Update docstring
* Update docstring
Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-08-22 15:58:01 +02:00
Marc Mueller
dc47121f2c
Better type hass_job method calls ( #76053 )
2022-08-09 16:12:33 -04:00
epenet
16900dcef1
Make Store a generic class ( #74617 )
2022-07-09 22:32:57 +02:00
J. Nick Koston
32e0d9f47c
Speed up generation of template states ( #73728 )
...
* Speed up generation of template states
* tweak
* cache
* cache hash
* weaken
* Revert "weaken"
This reverts commit 4856f50080
.
* lower cache size as it tends to be the same ones over and over
* lower cache size as it tends to be the same ones over and over
* lower cache size as it tends to be the same ones over and over
* cover
* Update homeassistant/helpers/template.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* id reuse is possible
* account for iterting all sensors
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-06-24 17:28:26 -04:00
Marc Mueller
b417ae72e5
Add generic parameters to HassJob ( #70973 )
2022-05-30 09:22:37 +02:00
J. Nick Koston
049c06061c
Fix memory leak when firing state_changed events ( #72571 )
2022-05-26 20:54:26 -07:00
J. Nick Koston
9c3f949165
Add live streaming logbook websocket endpoint ( #72258 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-22 14:57:54 -05:00
Franck Nijhof
5f44d0f8f9
Clean up accessing storage.Store helper via hass ( #72009 )
2022-05-17 18:45:57 +02:00
J. Nick Koston
fb7aead756
Guard expensive `cast`s in performance sensitive spots with `if TYPE_CHECKING` ( #71960 )
2022-05-16 21:15:04 +02:00
J. Nick Koston
ebce5660e3
Sync event timed_fired and the context ulid time ( #71854 )
2022-05-14 12:12:08 -07:00
J. Nick Koston
d612b9e0b4
Reduce event loop overhead for listeners that already queue ( #71364 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-05 23:09:10 -04:00
J. Nick Koston
8a41370950
Add cache to split_entity_id ( #71345 )
2022-05-05 10:13:55 -07:00
J. Nick Koston
2a9f043039
Use ULID short format for context ids ( #71119 )
2022-05-01 21:44:54 -07:00
J. Nick Koston
69fa7b0d61
Reduce calls to asyncio.iscoroutine ( #71090 )
2022-04-29 21:24:26 -07:00
Marc Mueller
c1d2017988
Improve typing for core add_job and run_job methods ( #70702 )
2022-04-25 23:50:01 +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
J. Nick Koston
d03760d0bb
Switch to using ULIDs for context_ids ( #70246 )
2022-04-18 22:45:41 -07: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
53245c6523
Update pylint to 2.13.0 ( #68656 )
2022-03-25 15:14:48 -07:00
Marc Mueller
be7ef6115c
Make TypeVars private (1) ( #68205 )
2022-03-17 18:52:38 +01:00
J. Nick Koston
d3deae6288
Fix typing on Context.user_id ( #68019 )
2022-03-11 20:31:03 -08:00
Paulus Schoutsen
1bbc1f5f55
Validate in split_entity_id ( #66835 )
2022-02-18 16:11:17 -08:00
Marc Mueller
8d2fb72cc3
Add type ignore error codes [core] ( #66773 )
2022-02-17 23:09:22 -08:00
epenet
0a7b1dec7d
Adjust type hint in core add_job ( #66503 )
...
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-14 11:13:10 +01:00
Paulus Schoutsen
95a890c6e1
Get_url to prefer external URL if SSL configured ( #66039 )
2022-02-07 15:44:02 -08:00
Franck Nijhof
fa09cf663e
Update black to 22.1.0 ( #65788 )
2022-02-05 14:19:37 +01:00
Franck Nijhof
2f46382565
Remove async_timeout backcompat ( #65732 )
2022-02-04 21:33:31 -08:00
Paulus Schoutsen
5da923c341
Protect state.as_dict from mutation ( #65693 )
2022-02-04 14:45:25 -08: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
f3bc9fc740
Update Python version used for pylint ( #63895 )
2022-01-11 13:41:57 +01:00
Marc Mueller
54cb1e7556
Add strict typing to `core.py` (5) - Task ( #63243 )
2022-01-07 16:48:34 +01:00
Marc Mueller
8207665c3e
Add strict typing to core.py (1) - EventBus ( #63239 )
2022-01-06 03:14:42 +01:00
Marc Mueller
caaa1b32c1
Add strict typing to `core.py` (3) - Service ( #63241 )
2022-01-06 01:18:17 +01:00
Marc Mueller
3a32fe9a34
Add strict typing to `core.py` (2) - State ( #63240 )
2022-01-04 18:33:56 +01:00
Marc Mueller
cad09a9eda
Add strict typing to `core.py` (4) - Misc ( #63242 )
2022-01-03 13:18:15 +01:00
epenet
9971831b51
Improve typing in core service registration ( #63005 )
...
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-30 21:18:10 +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
Ville Skyttä
1ec8619687
Make core config source an enum ( #61966 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-12-19 18:02:52 +01:00
Erik Montnemery
773ac289dd
Tweak core add_job and async_add_job docstrings ( #62112 )
2021-12-16 22:08:13 +01:00
J. Nick Koston
96f7b0d910
Use atomicwrites for mission critical core files ( #59606 )
2021-11-15 11:19:31 +01:00
J. Nick Koston
10d6247fee
Bump to aiohttp 3.8.0 ( #58974 )
2021-11-04 10:07:50 -05:00
Paulus Schoutsen
fcd0a877d6
Identify onetime listeners ( #57751 )
2021-10-15 10:23:36 -07:00
Justin Goette
56b66d5124
typo ( #56477 )
2021-09-21 15:09:21 +01:00
Marc Mueller
7af67d34cf
Use assignment expressions 01 ( #56394 )
2021-09-18 13:31:35 -10:00
Marc Mueller
48bada5a18
Update pylint to 2.11.1 ( #56364 )
2021-09-18 13:52:59 +02:00
Martin Hjelmare
a1abd4f0d6
Fix external internal url core check ( #54310 )
2021-08-09 10:52:14 +02:00
Paulus Schoutsen
952d11cb03
Ensure internal/external URL have no path ( #54304 )
...
* Ensure internal/external URL have no path
* Fix comment typo
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-09 09:38:09 +02:00
Franck Nijhof
1968b95829
Add currency core configuration ( #53541 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-07-28 08:55:58 +02:00
Marc Mueller
46c3495ae0
Update pylint to 2.9.5 ( #53496 )
2021-07-26 16:17:15 +02:00
Daniel Hjelseth Høyer
fbad453c89
Pylint 2.9.3 ( #52972 )
...
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-07-14 21:44:57 -07:00
Paulus Schoutsen
f472219c68
Set up cloud semi-dependencies at start ( #51313 )
2021-06-01 01:35:31 +02:00
Raman Gupta
58e37435b3
Make more max lengths constants and add additional MaxLengthExceeded checks ( #50337 )
...
* Add more MaxLengthExceeded checks
* remove some validations to reduce performance impact
* check length of generated entity ID
* dont check entity ID twice and use single context id length constant
* fix test
* add missing test
2021-05-25 19:58:01 +02:00
Ruslan Sayfutdinov
391b2f8ccd
Add missing return type in Core constructors ( #50884 )
2021-05-20 18:53:29 +03:00
Ruslan Sayfutdinov
5ad71b5e45
Define sync hass.create_task function ( #50788 )
2021-05-17 14:54:06 -05:00
J. Nick Koston
bf2d40adfe
Migrate from pytz to python-dateutil ( #49643 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-07 22:46:26 -07: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
04a0ca14e0
Ensure shutdown does not deadlock ( #49282 )
2021-04-18 08:55:51 -10:00
Ville Skyttä
970cbcbe15
Type hint improvements ( #49320 )
2021-04-17 08:35:21 +02:00
J. Nick Koston
2cc9ae1af1
Use named constants for core shutdown timeouts ( #49146 )
...
This is intended to make them easier to reference outside the core
code base.
2021-04-13 12:21:52 +02:00
Raman Gupta
3ca69f5568
Raise an exception when event_type exceeds the max length ( #48115 )
...
* raise an exception when event_type exceeds the max length that the recorder supports
* add test
* use max length constant in recorder
* update config entry reloaded service name
* remove exception string function because it's not needed
* increase limit to 64 and revert event name change
* fix test
* assert exception args
* fix test
* add comment about migration
2021-04-08 20:46:28 +02:00
Marc Mueller
2956eb0902
Update pylint to 2.7.3 ( #48488 )
...
* Update pylint to 2.7.3
* Add class-const-naming-style
* Remove unused-import message
* Additional cleanup
2021-03-29 18:02:56 -10: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
4cb7718192
Update typing 16 ( #48087 )
2021-03-18 22:58:19 +01:00
Marc Mueller
e55702d635
Update typing 01 ( #48013 )
2021-03-17 17:34:55 +01:00