Skip to content

Commit

Permalink
Merge pull request #463 from xaviml/build-style-refactor
Browse files Browse the repository at this point in the history
Build style refactor
  • Loading branch information
xaviml committed Apr 17, 2022
2 parents 467ae21 + 5ed99d8 commit 9a91230
Show file tree
Hide file tree
Showing 107 changed files with 2,997 additions and 585 deletions.
8 changes: 0 additions & 8 deletions .cz.toml

This file was deleted.

16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Add a description of the bug. Detail the expected behaviour in contrast with the

## Additional information

* Devices involved:
* Model: [ eg. IKEA 1744 ] as [ Light | Media Player | Controller ]
* ...
* Integration: Choose from `z2m | deconz | zha`
* AppDaemon version: [ eg. v4.0.1 ]
* ControllerX version: [ eg. v2.2.1 ]
* HACS version (if installed from there): [ eg. v0.21.5 ]
* Home Assistant Core version: [ eg. v0.105.4 ]
- Devices involved:
- Model: [ eg. IKEA 1744 ] as [ Light | Media Player | Controller ]
- ...
- Integration: Choose from `z2m | deconz | zha`
- AppDaemon version: [ eg. v4.0.1 ]
- ControllerX version: [ eg. v2.2.1 ]
- HACS version (if installed from there): [ eg. v0.21.5 ]
- Home Assistant Core version: [ eg. v0.105.4 ]

## AppDaemon app configuration

Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: "[FEATURE REQUEST]"
labels: enhancement
assignees: xaviml

---

<!-- Make sure to read the FAQ before opening an issue. https://xaviml.github.io/controllerx/faq -->
Expand Down
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Add here your question.

## Additional information

* Devices involved:
* Model: [ eg. IKEA 1744 ] as [ Light | Media Player | Controller ]
* ...
* Integration: Choose from `z2m | deconz | zha`
* AppDaemon version: [ eg. v4.0.1 ]
* ControllerX version: [ eg. v2.2.1 ]
* HACS version (if installed from there): [ eg. v0.21.5 ]
* Home Assistant Core version: [ eg. v0.105.4 ]
- Devices involved:
- Model: [ eg. IKEA 1744 ] as [ Light | Media Player | Controller ]
- ...
- Integration: Choose from `z2m | deconz | zha`
- AppDaemon version: [ eg. v4.0.1 ]
- ControllerX version: [ eg. v2.2.1 ]
- HACS version (if installed from there): [ eg. v0.21.5 ]
- Home Assistant Core version: [ eg. v0.105.4 ]

## AppDaemon app configuration

Expand Down
58 changes: 29 additions & 29 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "11:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: black
versions:
- 21.4b0
- dependency-name: pytest-asyncio
versions:
- 0.15.0
- dependency-name: pre-commit
versions:
- 2.10.1
- 2.11.0
- 2.12.1
- dependency-name: commitizen
versions:
- 2.14.2
- 2.15.1
- 2.17.3
- dependency-name: appdaemon
versions:
- 4.0.6
- dependency-name: pytest
versions:
- 6.2.2
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "11:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: black
versions:
- 21.4b0
- dependency-name: pytest-asyncio
versions:
- 0.15.0
- dependency-name: pre-commit
versions:
- 2.10.1
- 2.11.0
- 2.12.1
- dependency-name: commitizen
versions:
- 2.14.2
- 2.15.1
- 2.17.3
- dependency-name: appdaemon
versions:
- 4.0.6
- dependency-name: pytest
versions:
- 6.2.2
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: "CodeQL"

on:
push:
branches: [ main, dev ]
branches: [main, dev]
pull_request:
# The branches below must be a subset of the branches above
branches: [ dev ]
branches: [dev]
schedule:
- cron: '30 6 * * 5'
- cron: "30 6 * * 5"

jobs:
analyze:
Expand All @@ -21,31 +21,31 @@ jobs:
strategy:
fail-fast: false
matrix:
python_version: [ '3.7', '3.8', '3.9' ]
python_version: ["3.7", "3.8", "3.9"]

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Install poetry
run: |
python -m pip install --upgrade poetry
- name: Install dependencies
run: |
poetry install
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: python
setup-python-dependencies: false

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Checkout repository
uses: actions/checkout@v2

# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Install poetry
run: |
python -m pip install --upgrade poetry
- name: Install dependencies
run: |
poetry install
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: python
setup-python-dependencies: false

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
14 changes: 7 additions & 7 deletions .github/workflows/update-license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Update copyright year(s) in license file
on:
workflow_dispatch:
schedule:
- cron: 0 0 1 1 *
- cron: 0 0 1 1 *

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: FantasticFiasco/action-update-license-year@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: FantasticFiasco/action-update-license-year@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,3 @@ dmypy.json
.vscode/*
!.vscode/settings.json
.idea

# Ignoring poetry.lock since we support different python versions
poetry.lock
15 changes: 14 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-mock-methods
- id: python-check-blanket-type-ignore
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.2
hooks:
- id: prettier
types_or: [markdown, yaml]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
Expand All @@ -27,4 +37,7 @@ repos:
rev: v0.942
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-mock]
additional_dependencies:
- types-PyYAML==6.0.6
- types-mock==4.0.13
- pytest==7.1.1
26 changes: 13 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/action_type/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, controller: "Controller", action: Dict[str, Any]) -> None:
self.controller = controller
self.initialize(**action)

def initialize(self, **kwargs) -> None:
def initialize(self, **kwargs: Any) -> None:
pass

@abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from cx_core.integration import EventData

if TYPE_CHECKING:
from cx_core.type_controller import TypeController
from cx_core.type_controller import Entity, TypeController


class CallServiceActionType(ActionType):
Expand All @@ -16,7 +16,7 @@ class CallServiceActionType(ActionType):
entity_id: Optional[str]
data: Dict[str, Any]

def initialize(self, **kwargs) -> None:
def initialize(self, **kwargs: Any) -> None:
self.service = kwargs["service"]
self.data = kwargs.get("data", {})

Expand All @@ -25,13 +25,13 @@ def initialize(self, **kwargs) -> None:
self.entity_id is None
and self._check_controller_isinstance_type_controller()
):
type_controller = cast("TypeController", self.controller)
type_controller = cast("TypeController[Entity]", self.controller)
if self._get_service_domain(self.service) in type_controller.domains:
self.entity_id = type_controller.entity.name
if "entity_id" in self.data:
del self.data["entity_id"]

def _check_controller_isinstance_type_controller(self):
def _check_controller_isinstance_type_controller(self) -> bool:
# This is checked dynamically without the isinstance to avoid
# circular dependency
class_names = [c.__name__ for c in type(self.controller).mro()]
Expand Down
4 changes: 2 additions & 2 deletions apps/controllerx/cx_core/action_type/delay_action_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Any, Optional

from cx_core.action_type.base import ActionType
from cx_core.integration import EventData
Expand All @@ -7,7 +7,7 @@
class DelayActionType(ActionType):
delay: int

def initialize(self, **kwargs) -> None:
def initialize(self, **kwargs: Any) -> None:
self.delay = kwargs["delay"]

async def run(self, extra: Optional[EventData] = None) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _raise_action_key_not_found(
"See more in: https://xaviml.github.io/controllerx/advanced/custom-controllers"
)

def initialize(self, **kwargs) -> None:
def initialize(self, **kwargs: Any) -> None:
self.predefined_action_key = kwargs.pop("action")
self.predefined_action_kwargs = kwargs
self.predefined_actions_mapping = (
Expand Down
4 changes: 2 additions & 2 deletions apps/controllerx/cx_core/action_type/scene_action_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Any, Optional

from cx_core.action_type.base import ActionType
from cx_core.integration import EventData
Expand All @@ -7,7 +7,7 @@
class SceneActionType(ActionType):
scene: str

def initialize(self, **kwargs) -> None:
def initialize(self, **kwargs: Any) -> None:
self.scene = kwargs["scene"]

async def run(self, extra: Optional[EventData] = None) -> None:
Expand Down

0 comments on commit 9a91230

Please sign in to comment.