Commit Graph

14 Commits

Author SHA1 Message Date
Marc Mueller
900b6211ef Use PEP 695 for function annotations (2) (#117659) 2024-05-18 11:44:39 +02:00
J. Nick Koston
3963b3994b Small cleanups to the rate limit helper (#115621) 2024-04-15 13:42:28 +02:00
J. Nick Koston
b574220247 Refactor rate limit helper to track time in seconds (#113898)
* Refactor rate limit helper to track time in seconds

Currently we created datetime and timedelta objects to enforce the
rate limit. When the rate limit was being hit hard, this got expensive.

We now use floats everywhere instead as they are much cheaper which
is important when we are running up against a rate limit, which is
by definition a hot path

The rate limit helper is currently only used for templates and
we do not have any code in the code base that directly passes
in a rate limit so the impact to custom components is expected
to be negligible if any

* misesd two
2024-03-20 19:49:37 -04:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
J. Nick Koston
664285b9d4 Small performance improvement in tracking template results (#110622)
- Avoid inner function creation each refresh
- remove extra unneeded checks from ratelimit
2024-02-17 18:08:24 +01:00
Marc Mueller
aac02d7b84 Add first TypeVarTuple annotations (#105379) 2023-12-18 00:38:07 +01:00
Marc Mueller
238b488642 Use assignment expressions 03 (#57710) 2021-10-17 20:08:11 +02:00
Marc Mueller
77ee72cbb9 Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Ruslan Sayfutdinov
391b2f8ccd Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03: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
Marc Mueller
6fb2e63e49 Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Anders Melchiorsen
650c57db5b Fix async_track_utc_time_change firing too early (#42176) 2020-11-05 16:34:56 +01:00
J. Nick Koston
21cc23244d Improve template ratelimit performance (#41741) 2020-10-15 12:02:05 +02:00
J. Nick Koston
b45215f1d2 Implement template rate_limit directive (#40667) 2020-10-01 21:39:44 +02:00