Skip to content

Commit

Permalink
Merge pull request #81 from unixorn/add-poetry-hooks
Browse files Browse the repository at this point in the history
Add poetry hooks
  • Loading branch information
unixorn authored Mar 23, 2023
2 parents 2d8aa1e + 4e7680b commit 243423a
Show file tree
Hide file tree
Showing 15 changed files with 256 additions and 70 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ repos:
rev: v2.2.0
hooks:
- id: doctoc

- repo: https://github.com/python-poetry/poetry
rev: "1.4.1"
hooks:
- id: poetry-check
- id: poetry-lock
14 changes: 12 additions & 2 deletions ha_mqtt_discoverable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Copyright 2022 Joe Block <[email protected]>
# Copyright 2022-2023 Joe Block <[email protected]>
#
# License: Apache 2.0 (see root of the repo)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import logging
Expand Down
15 changes: 13 additions & 2 deletions ha_mqtt_discoverable/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#!/usr/bin/env python3
#
# Common cli functions for hmd tooling
#
# Copyright 2022, Joe Block <[email protected]>
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

Expand Down
16 changes: 14 additions & 2 deletions ha_mqtt_discoverable/sensors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#
# Copyright 2022 Joe Block <[email protected]>
# License: Apache 2.0
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Required to define a class itself as type https://stackoverflow.com/a/33533514
from __future__ import annotations
import logging
Expand Down
15 changes: 15 additions & 0 deletions ha_mqtt_discoverable/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from ha_mqtt_discoverable.utils import read_yaml_file
Expand Down
17 changes: 14 additions & 3 deletions ha_mqtt_discoverable/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/usr/bin/env python3
#
# Copyright 2022 Joe Block <[email protected]>
# License: Apache 2.0
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import re

Expand Down
122 changes: 61 additions & 61 deletions poetry.lock

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions tests/test_binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
from ha_mqtt_discoverable import Settings
from ha_mqtt_discoverable.sensors import BinarySensor, BinarySensorInfo
Expand Down
15 changes: 15 additions & 0 deletions tests/test_button.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
from ha_mqtt_discoverable import Settings
from ha_mqtt_discoverable.sensors import Button, ButtonInfo
Expand Down
15 changes: 15 additions & 0 deletions tests/test_device_trigger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
from ha_mqtt_discoverable import DeviceInfo, Settings
from ha_mqtt_discoverable.sensors import DeviceTrigger, DeviceTriggerInfo
Expand Down
15 changes: 15 additions & 0 deletions tests/test_discoverable.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import asyncio
from concurrent.futures import ThreadPoolExecutor
import logging
Expand Down
15 changes: 15 additions & 0 deletions tests/test_package.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from ha_mqtt_discoverable import __version__


Expand Down
15 changes: 15 additions & 0 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
from ha_mqtt_discoverable import Settings
from ha_mqtt_discoverable.sensors import Sensor, SensorInfo
Expand Down
16 changes: 16 additions & 0 deletions tests/test_subscriber.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import logging
from threading import Event
import time
Expand Down
15 changes: 15 additions & 0 deletions tests/test_switch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright 2022-2023 Joe Block <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
from ha_mqtt_discoverable import Settings
from ha_mqtt_discoverable.sensors import Switch, SwitchInfo
Expand Down

0 comments on commit 243423a

Please sign in to comment.