Commit e82b9fd
Feature/predicate rewrite; Bus/Predicate documentation (#147)
* fix all examples/docs to use on_state_change and on_attribute_change
* remove some mypy style type ignore comments from copilot/codex
* rename test_tasks to test_task_bucket, move a test from core to it
* improve some websocket tests
* cleanup core tests
* fix test logic after splitting it into two
* be smarter about testing run_sync
* clean up predicate structure and predicate tests structure a bit
* predicate must be not be async
* should be frozen
* get rid of all async stuff
* totally rework the predicates system
* add collection membership check
* add back handling of NOT_PROVIDED, do not accept typing.Any
* correct return type and logic of get_service_data
* use ServiceMatches to handle glob logic
* fix init imports
* have codex rewrite tests, not yet reviewed
* Update tests/test_websocket_service.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update examples/apps/presence.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/hassette/__init__.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* remove old import
* fix a few more duplicate entries
* last duplicates?
* update known types to include sequence/mapping
* add another test method
* only export predicates module
* update docs
* remove duplicate
* improve bus documentation
* fix some more references to SystemDateTime
* refactor(types.py, utils.py): rename PredicateCallable to Condition and update related type aliases for clarity and consistency
refactor(utils.py): remove unnecessary checks for PredicateCallable to simplify the code and improve readability
* rename _KnownTypes to KnownTypeScalar
* add code conventions
* fix type by using TypeVar instead of union
* new tests + improve tets
* fix a type import
* update to use frozen=true like others
* do not check IsInstance for predicate, just callable. move imports to type check block
* fix an import
* add tests for get_path
* handle standard glom error without logging, logging for other errors
* remove no longer valid rule
* update docstring for ChangeType
* fix order of aguments to compare_value, fix all tests and usage
* add return type annotation, rename From/To to StateFrom/StateTo
* feat(predicates): add new conditions IsIn, NotIn, IsOrContains, and Intersects to enhance predicate functionality
refactor(predicates): reorganize imports and update existing predicates to utilize new conditions
fix(predicates): improve type checking and handling of collections in utility functions for better reliability
test(predicates): add unit tests for new conditions to ensure correct behavior and integration
refactor(tests): remove redundant tests and improve test coverage for predicates
feat(tests): add new predicates conditions to enhance functionality in tests
fix(tests): update service data where tests to use IsOrContains for better matching logic
* add return type to get_path
* remove immediately
* correct name
* switch these to classes instead of functions
* fix name
* clean up a few items in the docs
* add all the new modules to docs
* add blank line after complaint from sphinx
* change to TypeAliasType
* remove duplicate type guard function
* Update examples/apps/office_button_app.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* raise error if string passed to a collection condition, fix tests
* Update docs/bus.rst
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix docstrings to include args/kwargs, remove rendant import
* fix IsOrContains - i'd had that mixed up in my head
* fix docstring in compare_value
* remove unnecessary bit of bus docs
* fix examples in docstring
* update changelog
* pre-compile regex pattern
* add back log line for initialize/shutdown
* bump version
* add version to changelog
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 75c192f commit e82b9fd
43 files changed
Lines changed: 2927 additions & 821 deletions
File tree
- .github
- docs
- comparisons
- reference/core
- examples/apps
- src/hassette
- core/resources
- app
- bus
- predicates
- utils
- tests
- predicates
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
26 | 41 | | |
27 | 42 | | |
28 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
0 commit comments