forked from amosyuen/ha-tplink-deco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'amosyuen:main' into master
- Loading branch information
Showing
18 changed files
with
164 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
// See https://aka.ms/vscode-remote/devcontainer.json for format details. | ||
{ | ||
"image": "ghcr.io/ludeeus/devcontainer/integration:stable", | ||
"name": "TP-Link Deco integration development", | ||
"context": "..", | ||
"appPort": ["9123:8123"], | ||
"postCreateCommand": ".devcontainer/setup.sh", | ||
"mounts": [ | ||
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached" | ||
], | ||
"extensions": [ | ||
"ms-python.python", | ||
"github.vscode-pull-request-github", | ||
"ryanluker.vscode-coverage-gutters", | ||
"ms-python.vscode-pylance", | ||
"esbenp.prettier-vscode" | ||
], | ||
"settings": { | ||
"files.eol": "\n", | ||
"editor.tabSize": 4, | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"python.pythonPath": "/usr/bin/python3", | ||
"python.analysis.autoSearchPaths": false, | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.enabled": true, | ||
"python.formatting.provider": "black", | ||
"editor.formatOnPaste": false, | ||
"editor.formatOnSave": true, | ||
"editor.formatOnType": true, | ||
"files.trimTrailingWhitespace": true | ||
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye", | ||
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", | ||
"postAttachCommand": ".devcontainer/setup.sh", | ||
"forwardPorts": [8123], | ||
"portsAttributes": { | ||
"8123": { | ||
"label": "Home Assistant", | ||
"onAutoForward": "notify" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"esbenp.prettier-vscode", | ||
"github.vscode-pull-request-github", | ||
"ms-vscode-remote.remote-containers", | ||
"ms-python.black-formatter", | ||
"ms-python.vscode-pylance", | ||
"ryanluker.vscode-coverage-gutters" | ||
] | ||
} | ||
}, | ||
"remoteUser": "vscode", | ||
"features": { | ||
"ghcr.io/devcontainers/features/rust:1": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
# Create config dir if not present | ||
if [[ ! -d "${PWD}/config" ]]; then | ||
mkdir -p "${PWD}/config" | ||
hass --config "${PWD}/config" --script ensure_config | ||
fi | ||
|
||
# Set the path to custom_components | ||
## This let's us have the structure we want <root>/custom_components/integration_blueprint | ||
## while at the same time have Home Assistant configuration inside <root>/config | ||
## without resulting to symlinks. | ||
export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components" | ||
|
||
# Start Home Assistant | ||
hass --config "${PWD}/config" --debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,18 +22,18 @@ jobs: | |
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip install --constraint=requirements.txt pip | ||
pip --version | ||
- name: Install Python modules | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports | ||
pip install --constraint=requirements.txt pre-commit black flake8 reorder-python-imports | ||
- name: Run pre-commit on all files | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
# artifacts | ||
__pycache__ | ||
pythonenv* | ||
.python-version | ||
.pytest* | ||
*.egg-info | ||
*/build/* | ||
*/dist/* | ||
|
||
# misc | ||
.coverage | ||
venv | ||
.venv | ||
coverage.xml | ||
|
||
# Home Assistant configuration | ||
config/* | ||
!config/configuration.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml | ||
|
||
target-version = "py310" | ||
|
||
select = [ | ||
"B007", # Loop control variable {name} not used within loop body | ||
"B014", # Exception handler with duplicate exception | ||
"C", # complexity | ||
"D", # docstrings | ||
"E", # pycodestyle | ||
"F", # pyflakes/autoflake | ||
"ICN001", # import concentions; {name} should be imported as {asname} | ||
"PGH004", # Use specific rule codes when using noqa | ||
"PLC0414", # Useless import alias. Import alias does not rename original package. | ||
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass | ||
"SIM117", # Merge with-statements that use the same scope | ||
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys() | ||
"SIM201", # Use {left} != {right} instead of not {left} == {right} | ||
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a} | ||
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'. | ||
"SIM401", # Use get from dict with default instead of an if block | ||
"T20", # flake8-print | ||
"TRY004", # Prefer TypeError exception for invalid type | ||
"RUF006", # Store a reference to the return value of asyncio.create_task | ||
"UP", # pyupgrade | ||
"W", # pycodestyle | ||
] | ||
|
||
ignore = [ | ||
"D202", # No blank lines allowed after function docstring | ||
"D203", # 1 blank line required before class docstring | ||
"D213", # Multi-line docstring summary should start at the second line | ||
"D404", # First word of the docstring should not be This | ||
"D406", # Section name should end with a newline | ||
"D407", # Section name underlining | ||
"D411", # Missing blank line before section | ||
"E501", # line too long | ||
"E731", # do not assign a lambda expression, use a def | ||
] | ||
|
||
[flake8-pytest-style] | ||
fixture-parentheses = false | ||
|
||
[pyupgrade] | ||
keep-runtime-typing = true | ||
|
||
[mccabe] | ||
max-complexity = 25 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
{ | ||
"python.linting.pylintArgs": ["--rcfile=setup.cfg"], | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.enabled": true, | ||
"python.pythonPath": "venv/bin/python", | ||
"files.associations": { | ||
"*.yaml": "home-assistant" | ||
"analysis.autoSearchPaths": false, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
}, | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 4, | ||
"files.eol": "\n", | ||
"files.trimTrailingWhitespace": true, | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.