-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[homeassistant] Upgrade to Graal 25 #19518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,88 @@ | ||||||||||
| """Schema validation for Python data structures. | ||||||||||
|
|
||||||||||
| Given eg. a nested data structure like this: | ||||||||||
|
|
||||||||||
| { | ||||||||||
| 'exclude': ['Users', 'Uptime'], | ||||||||||
| 'include': [], | ||||||||||
| 'set': { | ||||||||||
| 'snmp_community': 'public', | ||||||||||
| 'snmp_timeout': 15, | ||||||||||
| 'snmp_version': '2c', | ||||||||||
| }, | ||||||||||
| 'targets': { | ||||||||||
| 'localhost': { | ||||||||||
| 'exclude': ['Uptime'], | ||||||||||
| 'features': { | ||||||||||
| 'Uptime': { | ||||||||||
| 'retries': 3, | ||||||||||
| }, | ||||||||||
| 'Users': { | ||||||||||
| 'snmp_community': 'monkey', | ||||||||||
| 'snmp_port': 15, | ||||||||||
| }, | ||||||||||
| }, | ||||||||||
| 'include': ['Users'], | ||||||||||
| 'set': { | ||||||||||
| 'snmp_community': 'monkeys', | ||||||||||
| }, | ||||||||||
| }, | ||||||||||
| }, | ||||||||||
| } | ||||||||||
|
|
||||||||||
| A schema like this: | ||||||||||
|
|
||||||||||
| >>> settings = { | ||||||||||
| ... 'snmp_community': str, | ||||||||||
| ... 'retries': int, | ||||||||||
| ... 'snmp_version': All(Coerce(str), Any('3', '2c', '1')), | ||||||||||
| ... } | ||||||||||
| >>> features = ['Ping', 'Uptime', 'Http'] | ||||||||||
| >>> schema = Schema({ | ||||||||||
| ... 'exclude': features, | ||||||||||
| ... 'include': features, | ||||||||||
| ... 'set': settings, | ||||||||||
| ... 'targets': { | ||||||||||
| ... 'exclude': features, | ||||||||||
| ... 'include': features, | ||||||||||
| ... 'features': { | ||||||||||
| ... str: settings, | ||||||||||
| ... }, | ||||||||||
| ... }, | ||||||||||
| ... }) | ||||||||||
|
|
||||||||||
| Validate like so: | ||||||||||
|
|
||||||||||
| >>> schema({ | ||||||||||
| ... 'set': { | ||||||||||
| ... 'snmp_community': 'public', | ||||||||||
| ... 'snmp_version': '2c', | ||||||||||
| ... }, | ||||||||||
| ... 'targets': { | ||||||||||
| ... 'exclude': ['Ping'], | ||||||||||
| ... 'features': { | ||||||||||
| ... 'Uptime': {'retries': 3}, | ||||||||||
| ... 'Users': {'snmp_community': 'monkey'}, | ||||||||||
| ... }, | ||||||||||
| ... }, | ||||||||||
| ... }) == { | ||||||||||
| ... 'set': {'snmp_version': '2c', 'snmp_community': 'public'}, | ||||||||||
| ... 'targets': { | ||||||||||
| ... 'exclude': ['Ping'], | ||||||||||
| ... 'features': {'Uptime': {'retries': 3}, | ||||||||||
| ... 'Users': {'snmp_community': 'monkey'}}}} | ||||||||||
| True | ||||||||||
| """ | ||||||||||
|
|
||||||||||
| # flake8: noqa | ||||||||||
| # fmt: off | ||||||||||
| from voluptuous.schema_builder import * | ||||||||||
| from voluptuous.util import * | ||||||||||
|
||||||||||
| from voluptuous.util import * | |
| from voluptuous.util import is_sequence, iter_sequence, flatten # Replace with actual used symbols |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import pollutes the enclosing namespace, as the imported module voluptuous.validators does not define 'all'.
| from voluptuous.validators import * | |
| from voluptuous.validators import ( | |
| All, Any, Coerce, ExactSequence, In, Length, Lower, Match, Maybe, Msg, NotIn, Number, Optional, Range, Required, Schema, Self, Upper, ALLOW_EXTRA, REMOVE_EXTRA, PREVENT_EXTRA | |
| ) |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import pollutes the enclosing namespace, as the imported module voluptuous.error does not define 'all'.
| from voluptuous.error import * # isort: skip | |
| from voluptuous.error import Error, MultipleInvalid, Invalid # isort: skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import pollutes the enclosing namespace, as the imported module voluptuous.schema_builder does not define 'all'.