Skip to content

Commit

Permalink
Merge pull request #18 from elahd/fix-aiohttp-conflict
Browse files Browse the repository at this point in the history
Fix aiohttp version conflict with Home Assistant + housekeeping.
  • Loading branch information
elahd authored Dec 8, 2022
2 parents 11c1472 + 1b25bc4 commit 4aab188
Show file tree
Hide file tree
Showing 11 changed files with 3,071 additions and 255 deletions.
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "ghcr.io/ludeeus/devcontainer/integration:latest",
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"name": "ha-nyc311",
"features": {
"github-cli": "latest"
Expand All @@ -8,7 +8,7 @@
"WORKSPACE_DIRECTORY": "/workspaces/ha-nyc311",
"POST_SET_VERSION_HOOK": "/workspaces/ha-nyc311/.devcontainer/post-set-version-hook.sh"
},
"postCreateCommand": "container install && pip install --upgrade pip && pip install -r requirements-dev.txt && pre-commit install && pre-commit install-hooks && pip install --editable /workspaces/nyc311calendar && chmod +x /workspaces/ha-nyc311/.devcontainer/post-set-version-hook.sh",
"postCreateCommand": "chmod +x /workspaces/ha-nyc311/.devcontainer/post-create-script.sh && sh /workspaces/ha-nyc311/.devcontainer/post-create-script.sh",
"appPort": ["8123:8123"],
"extensions": [
"ms-python.vscode-pylance",
Expand Down Expand Up @@ -40,7 +40,7 @@
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"files.trimTrailingWhitespace": false,
"python.linting.mypyEnabled": true,
"python.defaultInterpreterPath": "/usr/local/python/bin/python",
"python.formatting.blackPath": "/usr/local/python/bin/black",
Expand All @@ -49,7 +49,8 @@
"python.linting.mypyPath": "/usr/local/python/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/python/bin/pycodestyle",
"python.linting.pylintPath": "/usr/local/python/bin/pylint",
"python.sortImports.path": "/usr/local/python/bin/isort",
"isort.path": ["/usr/local/python/bin/isort"],
"python.pythonPath": "/usr/local/python/bin/python",
"typescript.tsc.autoDetect": "off",
"grunt.autoDetect": "off",
"jake.autoDetect": "off",
Expand Down
20 changes: 20 additions & 0 deletions .devcontainer/post-create-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

container install
pip install --upgrade pip
pip install -r requirements-dev.txt
pre-commit install
pre-commit install-hooks
chmod +x /workspaces/ha-nyc311/.devcontainer/post-set-version-hook.sh

lib_dir="/workspaces/nyc311calendar"
repo_url="https://github.com/elahd/nyc311calendar.git"

if [ ! -d $lib_dir ]; then
echo "Cloning nyc311calendar repository..."
git clone "$repo_url" "$lib_dir"
else
echo "nyc311calendar repository directory already exists."
fi

python /workspaces/nyc311calendar/setup.py develop
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@ repos:
args:
- --output-format=colorized
- -d W0511
- --fail-on=all
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"python.linting.mypyPath": "/usr/local/python/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/python/bin/pycodestyle",
"python.linting.pylintPath": "/usr/local/python/bin/pylint",
"python.sortImports.path": "/usr/local/python/bin/isort",
"npm.autoDetect": "off"
"isort.path": ["/usr/local/python/bin/isort"],
"npm.autoDetect": "off",
"python.analysis.extraPaths": ["/workspaces/nyc311calendar"]
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"label": "Run Home Assistant configuration against /config",
"type": "shell",
"command": "container check",
"command": "container check-config",
"problemMatcher": []
},
{
Expand Down
4 changes: 2 additions & 2 deletions custom_components/nyc311/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"config_flow": true,
"documentation": "https://www.github.com/elahd/ha-nyc311",
"issue_tracker": "https://www.github.com/elahd/ha-nyc311/issues",
"requirements": ["nyc311calendar==v0.4"],
"requirements": ["nyc311calendar==v0.4.1"],
"ssdp": [],
"zeroconf": [],
"homekit": {},
"dependencies": [],
"codeowners": ["@elahd"],
"iot_class": "cloud_polling",
"version": "v0.1.2"
"version": "v0.1.3"
}
14 changes: 6 additions & 8 deletions pylint/plugins/hass_constructor.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
"""Plugin for constructor definitions."""
from astroid import Const
from astroid import FunctionDef
from __future__ import annotations

from astroid import nodes
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter


class HassConstructorFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for __init__ definitions."""

__implements__ = IAstroidChecker

name = "hass_constructor"
priority = -1
msgs = {
"W0006": (
"W7411": (
'__init__ should have explicit return type "None"',
"hass-constructor-return",
"Used when __init__ has all arguments typed "
Expand All @@ -23,7 +21,7 @@ class HassConstructorFormatChecker(BaseChecker): # type: ignore[misc]
}
options = ()

def visit_functiondef(self, node: FunctionDef) -> None:
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
"""Called when a FunctionDef node is visited."""
if not node.is_method() or node.name != "__init__":
return
Expand All @@ -44,7 +42,7 @@ def visit_functiondef(self, node: FunctionDef) -> None:
return

# Check that return type is specified and it is "None".
if not isinstance(node.returns, Const) or node.returns.value is not None:
if not isinstance(node.returns, nodes.Const) or node.returns.value is not None:
self.add_message("hass-constructor-return", node=node)


Expand Down
Loading

0 comments on commit 4aab188

Please sign in to comment.