9da192c752
Avoid use of datetime.utc* methods deprecated in Python 3.12 ( #93684 )
...
Co-authored-by: Marc Mueller <[email protected] >
2023-08-24 16:38:22 +02:00
Ville Skyttä and GitHub
6399d74c15
Remove unnnecessary pylint configs from core ( #98704 )
2023-08-22 23:12:12 +02:00
Franck Nijhof and GitHub
868a5f377f
Ruff: isort don't split imports based on trailing comma ( #98162 )
2023-08-10 14:27:03 +02:00
Meow and GitHub
6fd60024cc
Refactored deprecated UNITS ( #97368 )
2023-08-03 21:12:01 +02:00
Marc Mueller and GitHub
1daac46635
Replace deprecated pkg_resources with importlib.metadata ( #97628 )
2023-08-03 09:14:00 +02:00
Franck Nijhof and GitHub
30058297cf
Migrate backported StrEnum to built-in StrEnum ( #97101 )
2023-07-23 23:19:24 +02:00
Franck Nijhof and GitHub
18dddd6342
Update Ruff to v0.0.277 ( #96108 )
2023-07-09 10:10:23 -04:00
Ville Skyttä and GitHub
ca936d0b38
Replace bandit with ruff ( #93200 )
2023-06-08 22:46:04 +02:00
4a3f341444
Language codes for Hebrew ( #93681 )
...
* Language codes for Hebrew
There is 2 optional code for Hebrew:
he-IL is the new code
iw-IL is the old code , the google cloud STT for example is using the old code (iw)
* Update language.py
* Update test_language.py
* Update test_language.py
* Update test_language.py
* Simplify duplicate language check
---------
Co-authored-by: Paulus Schoutsen <[email protected] >
2023-05-30 22:27:32 -04:00
J. Nick Koston and GitHub
2f1f32f0bb
Make unit converter use a factory to avoid looking up the ratios each conversion ( #93706 )
2023-05-29 20:50:40 +02:00
Erik Montnemery and GitHub
9a70f47049
Teach UnitlessRatioConverter about ppm and ppb ( #92989 )
2023-05-12 16:46:37 +02:00
Michael Hansen and GitHub
5d6ccd6a32
Allow "no" to match "nb" in language util ( #92862 )
...
* Allow "no" to match "nb"
* Adjust comparison for speed
2023-05-09 13:46:57 -05:00
Michael Hansen and GitHub
b4bd3b97f8
Use order in preferred regions list ( #91959 )
...
* Use order in preferred regions list
* Use float for score (inf = exact match)
2023-04-24 14:12:38 -04:00
Michael Hansen and GitHub
5075281add
Fix zh Hant/Hans ( #91390 )
...
* Fix zh Hant/Hans
* Fix comments
2023-04-24 16:55:08 +02:00
Michael Hansen and GitHub
9fdc794b36
Prefer country over language family + MATCH_ALL ( #91753 )
...
* Prefer country over language family
* More test fixes
2023-04-20 13:55:26 -04:00
Michael and GitHub
67c4de90f3
Add option to select list of accepted ssl ciphers in httpx client ( #91389 )
2023-04-15 09:32:30 -10:00
f0c625b2ad
Add language util ( #91290 )
...
* Add language util
* Add no match tests
* Update tests/util/test_language.py
Co-authored-by: Paulus Schoutsen <[email protected] >
---------
Co-authored-by: Paulus Schoutsen <[email protected] >
2023-04-12 20:27:09 -05:00
Erik Montnemery and GitHub
ead88cc3f8
Add preferred wind speed unit to unit systems ( #90504 )
...
* Add preferred wind speed unit to unit systems
* Tweak
* Update tests
2023-03-30 12:54:12 +02:00
epenet and GitHub
ab4a726e6c
Add tmpdir to known fixtures in pylint ( #89844 )
2023-03-17 10:22:02 +01:00
epenet and GitHub
a0f725dfcb
Add type hints to tests ( #89497 )
2023-03-10 12:06:50 +01:00
epenet and GitHub
ed3cdd8fb9
Fix lingering task in timeout test ( #88953 )
2023-03-01 09:42:55 +01:00
epenet and GitHub
aa20c902db
Add typed helpers and improve type hints in util/json ( #88534 )
...
* Add type hints to load_json
* Adjust ios
* Adjust nest
* Add use of load_json_array
* Add tests
* Adjust test patch
* Add test_load_json_os_error
2023-02-22 10:09:28 +01:00
J. Nick Koston and GitHub
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
epenet and GitHub
a51cc75f03
Add type hints to core tests (part 2) ( #88492 )
2023-02-21 09:27:13 +01:00
4f6a25b470
Allow parameterizing YAML config in tests ( #87981 )
...
* Add fixture to parameterize yaml config
* Apply to more tests
* Re-add @fixture label
* Add fixtures to patch yaml content and targets
* Typo
* Improve docstr
Co-authored-by: epenet <[email protected] >
* Update references to mock_yaml_configuration
* Apply new fixtures
* Apply to check_config tests
* Follow up comments
* Rename fixtures, update docstr
* Split paths
* Patch load_yaml_config_file instead
* sort
* Fix tests
* improve docst
* Rename fixtures
* sorting
Co-authored-by: epenet <[email protected] >
* Improve docstr
Co-authored-by: epenet <[email protected] >
* Improve docstr
Co-authored-by: epenet <[email protected] >
* Improve docstr
Co-authored-by: epenet <[email protected] >
* Improve docstr
Co-authored-by: Erik Montnemery <[email protected] >
* Improve docstr
Co-authored-by: Erik Montnemery <[email protected] >
* Improve docstr
Co-authored-by: Erik Montnemery <[email protected] >
---------
Co-authored-by: epenet <[email protected] >
Co-authored-by: Erik Montnemery <[email protected] >
2023-02-20 16:57:12 +01:00
epenet and GitHub
5f25b71df7
Add type hints to core tests ( #88478 )
2023-02-20 11:42:56 +01:00
Franck Nijhof and GitHub
1e05697080
Enable Ruff B007 ( #88356 )
...
* Enable Ruff B007
* Adjust existing cases
2023-02-17 21:08:18 -05:00
epenet and GitHub
3873484849
Refactor json tests to align with new code ( #88247 )
...
* Refactor json tests to align with new code
* Use tmp_path
2023-02-16 21:34:19 +01:00
epenet and GitHub
8c821c8969
Add JSON support to load_fixture ( #88076 )
...
* Add JSON support to load_fixture
* More tests
* Remove lru_cache on load_json
2023-02-16 19:40:47 +01:00
c79157208b
Add python 3.11 to the CI ( #88038 )
...
* Remove profiler.memory service
guppy3 is not python3.11 compat
https://github.com/zhuyifei1999/guppy3/issues/41
This service will return if and when guppy3 becomes
python3.11 compat
* squash
* temp remove
* temp dump tests
* temp dump tests
* drop a few more to get a run
* drop a few more to get a run
* Account for changed python3.11 enum.IntFlag behavior in zha
There may be additional changes needed, but I could only
see what needed to be updated based on the tests
* merge
* restore
* restore
* legacy value
* tweak a bit for the python 3.11 timings
* block cchardet
* conditional
* adjust est
* test
* not yet
* tweak
* give a little leeway for timing
* Fix otbr tests
* Increase database test timeout
It looks like we need a little more time to run
with the addiitonal tests in #87019
* Increase database test timeout
It looks like we need a little more time to run
with the addiitonal tests in #87019
* Fix aprs tests with python 3.11
* merge fix
* hints
* Update homeassistant/package_constraints.txt
* Update script/gen_requirements_all.py
* Constrain uamqp for Python 3.10 only
* Bump vulcan-api to 2.3.0
see https://github.com/kapi2289/vulcan-api/pull/126
see https://github.com/home-assistant/core/pull/88038
see https://github.com/home-assistant/docker/pull/260
* add ban
* Bump python-matter-server to 2.1.1
* revert
* Update tests/asyncio_legacy.py
---------
Co-authored-by: Erik <[email protected] >
Co-authored-by: Franck Nijhof <[email protected] >
Co-authored-by: Marcel van der Veldt <[email protected] >
2023-02-16 12:38:32 -05:00
epenet and GitHub
ba23816a0c
Inverse json import logic ( #88099 )
...
* Fix helpers and util
* Adjust components
* Move back errors
* Add report
* mypy
* mypy
* Assert deprecation messages
* Move test_json_loads_object
* Adjust tests
* Fix rebase
* Adjust pylint plugin
* Fix plugin
* Adjust references
* Adjust backup tests
2023-02-16 11:37:57 +01:00
Franck Nijhof and GitHub
f67ebcade1
Enable Ruff SIM201 ( #88171 )
2023-02-15 14:43:02 +01:00
Franck Nijhof and GitHub
ed79265843
Enable Ruff PT006 ( #88165 )
...
* Enable Ruff PT006
* Adjust existing cases
* Fix tests
* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
J. Nick Koston and GitHub
0c35c6a313
Fix enum try_parse test for python3.11 ( #88131 )
2023-02-14 15:29:44 -06:00
J. Nick Koston and GitHub
03eea7bd3f
Avoid subprocess memory copy when c library supports posix_spawn ( #87958 )
...
* use posix spawn on alpine
* Avoid subprocess memory copy when c library supports posix_spawn
By default python 3.10 will use the fork() which has to
copy all the memory of the parent process (in our case
this can be huge since Home Assistant core can use
hundreds of megabytes of RAM). By using posix_spawn
this is avoided.
In python 3.11 vfork will also be available
https://github.com/python/cpython/issues/80004#issuecomment-1093810689
https://github.com/python/cpython/pull/11671 but we won't
always be able to use it and posix_spawn is considered safer
https://bugzilla.kernel.org/show_bug.cgi?id=215813#c14
The subprocess library doesn't know about musl though
even though it supports posix_spawn https://git.musl-libc.org/cgit/musl/log/src/process/posix_spawn.c
so we have to teach it since it only has checks for glibc
https://github.com/python/cpython/blob/1b736838e6ae1b4ef42cdd27c2708face908f92c/Lib/subprocess.py#L745
The constant is documented as being able to be flipped here:
https://docs.python.org/3/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn
* Avoid subprocess memory copy when c library supports posix_spawn
By default python 3.10 will use the fork() which has to
copy memory of the parent process (in our case
this can be huge since Home Assistant core can use
hundreds of megabytes of RAM). By using posix_spawn
this is avoided and subprocess creation does not
get discernibly slow the larger the Home Assistant
python process grows.
In python 3.11 vfork will also be available
https://github.com/python/cpython/issues/80004#issuecomment-1093810689
https://github.com/python/cpython/pull/11671 but we won't
always be able to use it and posix_spawn is considered safer
https://bugzilla.kernel.org/show_bug.cgi?id=215813#c14
The subprocess library doesn't know about musl though
even though it supports posix_spawn https://git.musl-libc.org/cgit/musl/log/src/process/posix_spawn.c
so we have to teach it since it only has checks for glibc
https://github.com/python/cpython/blob/1b736838e6ae1b4ef42cdd27c2708face908f92c/Lib/subprocess.py#L745
The constant is documented as being able to be flipped here:
https://docs.python.org/3/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn
* missed some
* adjust more tests
* coverage
2023-02-13 09:02:51 -05:00
Erik Montnemery and GitHub
45ac8c515e
Update unit system unit conversions ( #87632 )
...
* Update unit system unit conversions
* Tweak tests
2023-02-08 10:52:54 +01:00
epenet and GitHub
c98b4e3204
Add typing to tests with single hass argument (2) ( #87675 )
...
* Add typing to tests with single hass argument (2)
* a few more
2023-02-08 08:51:43 +01:00
epenet and GitHub
4142f0d15d
Add return type to tests without arguments ( #87613 )
...
* Add return type to tests without arguments
* Black
* Cancel fixture amends
2023-02-07 14:20:06 +01:00
epenet and GitHub
aa00114c2f
Add return type to async tests without arguments ( #87612 )
2023-02-07 10:26:56 +01:00
Franck Nijhof and GitHub
ca1a12898c
Enable Ruff D212 ( #87347 )
2023-02-03 23:08:48 +01:00
epenet and GitHub
810367b757
Fix can not typo ( #87254 )
2023-02-03 11:37:16 +01:00
epenet and GitHub
1225c5e97d
Add enum util ( #87082 )
...
* Add enum helper
* docstring
* Move to util
* Add use case
2023-02-01 15:00:27 +01:00
Franck Nijhof and GitHub
c56832bb2c
Enable Ruff SIM300 ( #86793 )
2023-01-30 11:03:23 +01:00
Franck Nijhof and GitHub
89c0b27b42
Migrates tests to use UnitOfPressure enum ( #86785 )
2023-01-27 12:13:27 +01:00
epenet and GitHub
561fc2d771
Remove deprecated unit system properties ( #86643 )
...
* Remove deprecated unit system properties
* Fix tests
2023-01-27 12:09:26 +01:00
Franck Nijhof and GitHub
49148421cb
Migrates tests to use UnitOfSpeed enum ( #86777 )
2023-01-27 10:58:55 +01:00
e50a531cd9
Code styling tweaks to the tests - Part 2 ( #86662 )
...
Co-authored-by: jjlawren <[email protected] >
2023-01-26 01:23:53 +01:00
0ccab19d2c
Add Mega Joule as valid unit of energy ( #86055 )
...
* Add Mega joule
* Reorder valid energy types
Alphabetical
* Add Mega Joule
* Add Mega Joule as valid energy unit
* Add Mega Joule
* Add Mega Joule as a Unit of Measurement to Energy
* Update tests
* Update tests
* Update number docstring
Co-authored-by: Roving Ronin <[email protected] >
Co-authored-by: Erik Montnemery <[email protected] >
2023-01-25 14:13:42 +01:00
epenet and GitHub
64535175b1
Add missing conversion tests in unit conversion ( #86434 )
2023-01-23 10:11:11 +01:00
epenet and GitHub
30bf0634fe
Add per-file-ignore to pylint ( #86289 )
2023-01-22 17:26:24 +01:00