mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
New component: Python Script (#7950)
* Add initial version
* Fix requirements
* Prefer logging over printing
* Set executor thread name on >Py36 only
* Add tests
* Lint
* Add restrictedpython to test dependencies
* Create python_script.py
From doc:
```
However, an empty dict ({}) is treated as is. If you want to specify a list that can contain anything, specify it as dict:
>>> schema = Schema({}, extra=ALLOW_EXTRA) # don't do this
>>> try:
... schema({'extra': 1})
... raise AssertionError('MultipleInvalid not raised')
... except MultipleInvalid as e:
... exc = e
>>> str(exc) == "not a valid value"
True
>>> schema({})
{}
>>> schema = Schema(dict) # do this instead
>>> schema({})
{}
>>> schema({'extra': 1})
{'extra': 1}
```
This commit is contained in:
committed by
Pascal Vizeli
parent
640c692e1f
commit
db0efc647d
@@ -113,7 +113,13 @@ class HomeAssistant(object):
|
||||
else:
|
||||
self.loop = loop or asyncio.get_event_loop()
|
||||
|
||||
self.executor = ThreadPoolExecutor(max_workers=EXECUTOR_POOL_SIZE)
|
||||
executor_opts = {
|
||||
'max_workers': EXECUTOR_POOL_SIZE
|
||||
}
|
||||
if sys.version_info[:2] >= (3, 6):
|
||||
executor_opts['thread_name_prefix'] = 'SyncWorker'
|
||||
|
||||
self.executor = ThreadPoolExecutor(**executor_opts)
|
||||
self.loop.set_default_executor(self.executor)
|
||||
self.loop.set_exception_handler(async_loop_exception_handler)
|
||||
self._pending_tasks = []
|
||||
|
||||
Reference in New Issue
Block a user