1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-01 11:46:40 +01:00
Commit Graph

67 Commits

Author SHA1 Message Date
epenet 7169d52010 Remove import annotations from core (#169547) 2026-04-30 20:34:43 +02:00
Abílio Costa f8113ae80b Allow excluding modules from noisy logs check (#142020)
* Allow excluding modules from noisy logs check

* Cache non-excluded modules; hardcode self module name; optimize call

* Address review comments
2025-04-02 15:07:00 +02:00
Abílio Costa d12b4a1460 Log a warning for modules that log too often (#139708)
* Log a warning for modules that log too often

* Improve var naming

* Increase time window; improve log info

* Fix zha type

* Fix typo

* Ignore debug logs

* Use timer to avoid now() calls

* Switch to async_track_time_interval

* Allow using base QueueLister

* Add test for counters reset

* Make var names consistent; reduce message/time ratio

* Use log times instead of timer

* Simplify reset test

* Warn only once per module

* Remove uneeded counter reset
2025-03-20 14:53:53 -10:00
Alberto Montes 28ece89272 Update string formatting to use f-string on core codebase (#125988)
* Update string formatting to use f-string on core codebase

* Small change given review feedback
2024-09-19 14:31:13 +02:00
Marc Mueller 4cf0a3f154 Use PEP 695 for function annotations (3) (#117660) 2024-05-18 11:43:32 +02:00
Sid 2cc916db6d Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
J. Nick Koston 8f1761343e Only work out job type once when setting up dispatcher (#116030) 2024-04-23 22:24:36 +02:00
J. Nick Koston 164d29d4d9 Remove prepare override in HomeAssistantQueueHandler (#115064) 2024-04-06 13:53:36 -10:00
Sid 0d66d298ec Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
Joost Lekkerkerker 6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller 19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Ville Skyttä 24b1e01d71 Update Ruff to 0.1.8, avoid linter/formatter conflicts (#106080)
* Disable Ruff rules that may conflict with the formatter

* Upgrade Ruff to 0.1.8

- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8

* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00
Marc Mueller b671de8942 Improve logging util typing (#105968) 2023-12-18 14:54:12 +01:00
J. Nick Koston 47f8e08261 Reduce overhead to connect dispatcher (#105715)
Reduce overhead connect dispatcher

- We tend to have 1000s (or 10000s) of connected dispatchers which
  makes these prime targets to reduce overhead/memory

- Instead of creating new functions to wrap log exceptions each time
  use partials which reuses the function body and only create new
  arguments

Previous optimizations #103307 #93602
2023-12-16 10:16:58 +01:00
Erik Montnemery e6e190e7e2 Remove unused HideSensitiveDataFilter (#101689) 2023-10-09 12:02:52 +02:00
Franck Nijhof ca1a12898c Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
epenet 61734f04b8 Re-enable Ruff D418 (#87302) 2023-02-03 16:33:03 +01:00
Erik Montnemery f93bbd55ba Improve logging shutdown (#85812)
* Improve logging shutdown

* Update test
2023-01-17 20:06:25 +01:00
Jan Bouwhuis 35221e9a61 Correct return typing for catch_log_exception (#78399) 2022-09-17 17:27:22 +02:00
Marc Mueller 81d1786a16 Remove unused logging args parameter (#75619) 2022-08-01 10:13:05 +02:00
Marc Mueller 9a3908d21d Improve typing [util.logging] (#70894) 2022-04-27 22:26:56 +02:00
Marc Mueller 30e2411761 Add type ignore error codes [last ones] (#66816) 2022-02-18 18:15:57 +01:00
Erik Montnemery 2538af4b06 Add workaround for python bug to HAQueueHandler (#66541) 2022-02-15 10:49:14 +01: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 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 d71f913a12 Ensure original log handlers are restored at close (#49230)
Error messages after close were not being logged
2021-04-15 10:53:48 +02:00
Erik Montnemery d1df6e6fba Don't get code_context when calling inspect.stack (#48849)
* Don't get code_context when calling inspect.stack

* Update homeassistant/helpers/config_validation.py
2021-04-09 07:26:09 +02:00
Paulus Schoutsen 051531d9c1 Clean up mobile app (#48607)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-01 16:22:08 -07:00
Marc Mueller fabd73f08b Update typing 03 (#48015) 2021-03-17 21:46:07 +01:00
Erik Montnemery fb68bf85ae Don't defer formatting of log messages (#44873)
* Make fast logging optional

* Remove fast logging support
2021-02-06 13:40:15 +01:00
Ville Skyttä d13b58a4e6 Upgrade mypy to 0.800 (#45485)
* Upgrade mypy to 0.800

https://mypy-lang.blogspot.com/2021/01/mypy-0800-released.html

* Fix issues flagged by mypy 0.800

* Add overloads + small changes

* Apply grammar

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-01-30 22:33:53 +01:00
Franck Nijhof 2f486543df Drop Python 3.7 support (#43805) 2021-01-01 13:47:01 +01:00
Ville Skyttä f28c3273c2 Upgrade mypy to 0.790 (#41595) 2020-10-12 19:17:30 -05:00
springstan a2c3c33b22 Use core GitHub URL in all files (#41089) 2020-10-03 00:04:11 +02:00
Ville Skyttä 1bf2c4d976 Upgrade pylint to 2.6.0 (#39363) 2020-08-29 07:59:24 +02:00
J. Nick Koston 36b157b85a Ensure verbose logging flag is respected. (#36444) 2020-06-04 09:51:06 -07:00
J. Nick Koston 1297a09344 Avoid locking in the logging queue handler (#35700)
* Avoid locking in the logging queue handler

We do not need a lock here as the underlying queue is already
thread safe.

* Add coverage for logging handle
2020-05-17 14:39:27 +02:00
J. Nick Koston 73616520c0 Use built in queue log handlers to avoid formatting logs in the event loop (#35633)
* Use built in queue log handlers to avoid formatting logs in the event loop

Logging is now formatted and written in another thread to
ensure there is minimal impact on the event loop when
a log message is processed.

This change replaces the existing AsyncHandler log handler
as python 3.7+ now offers an off the shelf solution

* add a simple test

* s/async_migrate_log_handlers_to_queue/async_activate_log_queue_handler/g
2020-05-16 09:29:58 -05:00
Ville Skyttä b4404b071f Pylint cleanups (#35409)
* Avoid some outer name redefinitions

* Remove unneeded directives

* Narrow directive scope

* Don't disable redefined-variable-type
2020-05-09 14:08:40 +03:00
Erik Montnemery f1ecac92df Fail tests if wrapped callbacks or coroutines throw (#35010) 2020-05-06 14:14:57 -07:00
Franck Nijhof 7653dc947a Enable pylint unnecessary-pass (#33650)
* Enable pylint unnecessary-pass

* Process review suggestions

* Fix smhi tests
2020-04-05 10:33:07 +02:00
Paulus Schoutsen beee1298c5 Extend safe mode (#31927)
* Extend safe mode

* Add safe mode boolean to config JSON output and default Lovelace

* Add safe mode to frontend

* Update accent color
2020-02-18 11:52:38 -08:00
Franck Nijhof 2e17ad86af Adds guards for missing information in call stack frames (#27217) 2019-10-05 11:59:33 +02:00
Pascal Vizeli c1851a2d94 Cleanup coroutine threadsafe (#27080)
* Cleanup coroutine threadsafe

* fix lint

* Fix typing

* Fix tests

* Fix black
2019-10-01 16:59:06 +02:00
Ville Skyttä fde128d66c Upgrade mypy to 0.730, address raised issues (#26959)
https://mypy-lang.blogspot.com/2019/09/mypy-730-released.html
2019-09-27 22:57:59 +03:00
Franck Nijhof 2f0eb07624 Migrate legacy typehints in core to PEP-526 (#26403)
* Migrate legacy typehints in core to PEP-526

* Fix one type
2019-09-03 20:36:04 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Ville Skyttä e8a5306c23 Upgrade mypy to 0.711, drop no longer needed workarounds (#24998)
https://mypy-lang.blogspot.com/2019/06/mypy-0711-released.html
2019-07-07 03:58:33 +02:00
Ville Skyttä a6eef22fbc Upgrade mypy to 0.710 (#24666)
* Upgrade mypy to 0.710

* Address mypy 0.710 errors
2019-06-22 10:19:36 +03:00
Paulus Schoutsen f995ab9d54 Don't pass in loop (#23984)
* Don't pass in loop

* Revert some changes

* Lint + Axis revert

* reinstate loop

* Fix a test

* Set loop

* Update camera.py

* Lint
2019-05-22 21:09:59 -07:00