## Description:
Make typing checks more strict: add `--strict-optional` flag that forbids implicit None return type. This flag will become default in the next version of mypy (0.600)
Add `homeassistant/util/` to checked dirs.
## Checklist:
- [x] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
* Fix colorlog on windows
Modified the way logging is initialized to fix two things.
1. If the import of `colorlog` fails the logs will still be formatted
using the expected HASS log format.
2. Ensure that `logging.basicConfig` is called AFTER `colorlog` is
imported so that the default handler generated will be writing to the
wrapped stream generated when `colorama` is initialized. This allows
colored logging to work on Windows.
Added support for a `--log-no-color` command line switch in the event
that someone just wants to disable colored log output entirely.
* Fix line lengths
* Switch default value
* Upgrade pylint to 1.8.1
* Fix no-else-return
* Fix bad-whitespace
* Fix too-many-nested-blocks
* Fix raising-format-tuple
See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst
* Fix len-as-condition
* Fix logging-not-lazy
Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string
* Fix stop-iteration-return
* Fix useless-super-delegation
* Fix trailing-comma-tuple
Both of these seem to simply be bugs:
* Nest: The value of self._humidity never seems to be used anywhere
* Dovado: The called API method seems to expect a "normal" number
* Fix redefined-argument-from-local
* Fix consider-using-enumerate
* Fix wrong-import-order
* Fix arguments-differ
* Fix missed no-else-return
* Fix no-member and related
* Fix signatures-differ
* Revert "Upgrade pylint to 1.8.1"
This reverts commit af78aa00f125a7d34add97b9d50c14db48412211.
* Fix arguments-differ
* except for device_tracker
* Cleanup
* Fix test using positional argument
* Fix line too long
I forgot to run flake8 - shame on me... 🙃
* Fix bad-option-value for 1.6.5
* Fix arguments-differ for device_tracker
* Upgrade pylint to 1.8.2
* 👕 Fix missed no-member
* Use pip install --user if venv not active
* Set PYTHONUSERBASE to deps directory, when installing with --user
option.
* Reset --prefix option to workaround incompatability when installing
with --user option. This requires pip version 8.0.0 or greater.
* Require pip version 8.0.3.
* Do not delete deps directory on home assistant upgrade.
* Fix local lib mount and check package exist.
* Update and add tests
* Fix upgrade from before version 0.46
* Extract function to get user site
* Add function(s) to package util to get user site.
* Use async subprocess for one of the functions to get user site.
* Add function to package util to check if virtual environment is
active.
* Add and update tests.
* Update version for last removal of deps dir
* Address comments
* Rewrite package util tests with pytest
* Rewrite all existing unittest class based tests for package util as
test functions, and capitalize pytest fixtures.
* Add test for installing with target inside venv.
* Fire EVENT_HOMEASSISTANT_START automations off right away while starting
* Actually have core state be set to 'starting' during boot
* Fix correct start implementation
* Test and deprecate event automation platform on start
* Fix doc strings
* Remove shutting down exception
* More strict when to mark an instance as finished
* Add automation platform to listen for start/shutdown
* When we stop we should wait till it's all done
* Fix testing
* Fix async bugs in tests
* Only set UVLOOP when hass starts from CLI
* This hangs normal asyncio event loop
* Clean up Z-Wave node entity test
* Core cleanup: two stage shutdown
* fix spell
* fix
* add async logger to close
* change aiohttp to use CLOSE
* address paulus comments
* Fix tests
* Add unittest
* Add timeout to platform/component
* Revert "Add timeout to platform/component"
This reverts commit 280a311e48.
* Add logging data
* Change log message with paulus comments
* Bugfix windows have a other default loop now
* fix handling with 3.4.2 that not support ensure_future
* make the same as ensure_future does
* fix spell
* fix lazy test
* Lazy initialise the worker pool
* Minimize pool initialization in core tests
* Fix tests on Python 3.4
* Remove passing in thread count to mock HASS
* Tests: Allow pool by default for threaded, disable for async
* Remove JobPriority for thread pool
* Fix wrong block_till_done
* EmulatedHue: Remove unused test code
* Zigbee: do not touch hass.pool
* Init loop in add_job
* Fix core test
* Fix random sensor test
requests/urllib3 is notorious for using the INFO log level for very
DEBUG kinds of information. Given the configurability of python
logging it's actually pretty easy to just set requests to WARN by
default. This cleans out a bunch of largely unuseful log lines from
home assistant output.
* Add event loop to the core
* Add block_till_done to HA core object
* Fix some tests
* Linting core
* Fix statemachine tests
* Core test fixes
* fix block_till_done to wait for loop and queue to empty
* fix test_core for passing, and correct start/stop/block_till_done
* Fix remote tests
* Fix tests: block_till_done
* Fix linting
* Fix more tests
* Fix final linting
* Fix remote test
* remove unnecessary import
* reduce sleep to avoid slowing down the tests excessively
* fix remaining tests to wait for non-threadsafe operations
* Add async_ doc strings for event loop / coroutine info
* Fix command line test to block for the right timeout
* Fix py3.4.2 loop var access
* Fix SERVICE_CALL_LIMIT being in effect for other tests
* Fix lint errors
* Fix lint error with proper placement
* Fix slave start to not start a timer
* Add asyncio compatible listeners.
* Increase min Python version to 3.4.2
* Move async backports to util
* Add backported async tests
* Fix linting
* Simplify Python version check
* Fix lint
* Remove unneeded try/except and queue listener appproriately.
* Fix tuple vs. list unorderable error on version compare.
* Fix version tests
* Allow reloading groups without restart
* Test to make sure automation listeners are removed.
* Remove unused imports for group tests
* Simplify group config validation
* Add prepare_reload function to entity component
* Migrate group to use entity_component.prepare_reload
* Migrate automation to use entity_component.prepare_reload
* Clean up group.get_entity_ids
* Use cv.boolean for group config validation
* Move secret cache out of loader so it can be referenced by other folders
* Unit test to verify secrets from another folder work & see if it overrides parent secret
* Clear secret cache after load
* Fix: Circular dependencies of internal files
* Change: dt.date for Date and dt.datetime for DateTime
* Use NewType if available
* FIX: Wrong version test
* Remove: Date and DateTime types due to error
* Change to HomeAssistantType
* General Improvement of Typing
* Improve typing config_validation
* Improve typing script
* General Typing Improvements
* Improve NewType check
* Improve typing db_migrator
* Improve util/__init__ typing
* Improve helpers/location typing
* Regroup imports and remove pylint: disable=ungrouped-imports
* General typing improvements
* Add __main__ type hints
* Fix most errors of __main__
* Add ignore for script.run()
* Add type annotations for from_config_dict and from_config_file
* Fix errors
* Fix requirement error
* Add mypy type check to tests
* Enable travis typing check
* Messed up the tox deps
* Laxer type checker
* Stick version numbers
* Move elevation to core config
* Migrate forecast test to requests-mock
* Migrate YR tests to requests-mock
* Add requests_mock to requirements_test.txt
* Move conf code from bootstrap to config
* More config fixes
* Fix some more issues
* Add test for set config and failing auto detect
Instead of nested tracebacks, show a simpler error message.
Config directory: /home/user/.homeassistant
ERROR:homeassistant.util.yaml:duplicate key: "script"
in "/home/user/.homeassistant/configuration.yaml", line 95, column 0
in "/home/user/.homeassistant/configuration.yaml", line 108, column 0
This revision of event decorators removes much of the complexity. The
decorated functions are no longer wrapped with a class that tracks
last_run, etc. Bootstrap now gives hass to the event_decorators module
before initializing components so the decorators no longer require
activation.
1) helpers/event should not import the sun component unless it is
requested. This prevents circular import.
2) fixed import typo in bootstrap
2) bootstrap cannot import event_decorators until it is needed because
this leads to a circular import.
Created event decorators for custom components. Decorators were created
for the events: track_state_change, track_sunrise, track_sunset, and
track_time_change.
Since the requirements only change when the software is updated,
this adds a command line switch to disable pip installs on
startup. The default behavior is maintained when the switch is
not specified. Skipping pip helps a lot with startup on older RPi
hardware.
Created three additional flags for the hass command:
-v - Toggle verbose log file output
—pid-file - Specify PID file path
—daemon - Launch as daemon (nix only)
The core now binds to SIGQUIT on nix systems to trigger a clean
shutdown.
Modified HTTP server to write logging messages through the logging
module.
Rewrote imports of exceptions to be from the exceptions module.
Made nmap scanner check for libnmap dependency without crashing.
Various flake8 and pylint updates.
Revised main to use frontend and demo strings rather than importing
their domains.
Removed submodule validation.
Moved local library mounting to the bootstrap module and out of core.
Added requirements_all.txt for all dependencies.
Made core dependencies looser.
Small updates to setup.py.
Cleaned up default config directory determination.
Made bootstrap creators for HA always set config directory.
Made bootstrap creators set the local library in the Python Path.
Moved all exceptions to their own file to make imports easier.
Moved default configuration directory be in the users’ profile.
Moved pip installs to be done to a lib folder in the config directory.
Reduced requirements.txt to only the barebones reqs.