Skip to content

Commit

Permalink
Add check if init is running in the main thread (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ authored Mar 12, 2024
1 parent 97ef1fe commit cbaefbf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.3.0
rev: v0.3.2
hooks:
- id: ruff
args:
Expand All @@ -18,7 +18,7 @@ repos:
exclude_types: [csv, json]
exclude: ^tests/fixtures/|hahomematic/rega_scripts
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
rev: 1.7.8
hooks:
- id: bandit
args:
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 2024.3.1 (2024-03-09)
# Version 2024.3.1 (2024-03-12)

- Add additional parameter to HBW-LC4-IN4-DR
- Add check if init is running in the main thread

# Version 2024.3.0 (2024-03-01)

Expand Down
3 changes: 2 additions & 1 deletion hahomematic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import signal
import sys
import threading
from typing import Final

from hahomematic import central as hmcu
Expand All @@ -31,5 +32,5 @@ def signal_handler(sig, frame): # type: ignore[no-untyped-def]
asyncio.run_coroutine_threadsafe(central.stop(), asyncio.get_running_loop())


if sys.stdout.isatty():
if threading.current_thread() is threading.main_thread() and sys.stdout.isatty():
signal.signal(signal.SIGINT, signal_handler)
8 changes: 4 additions & 4 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

coverage==7.4.3
freezegun==1.4.0
mypy==1.8.0
mypy==1.9.0
pip==24.0
pre-commit==3.6.2
pydevccu==0.1.8
Expand All @@ -15,6 +15,6 @@ pytest-asyncio==0.23.5
pytest-cov==4.1.0
pytest-rerunfailures==13.0
pytest-socket==0.7.0
pytest-timeout==2.2.0
pytest==8.0.2
types-python-slugify==8.0.2.20240127
pytest-timeout==2.3.1
pytest==8.1.1
types-python-slugify==8.0.2.20240310
4 changes: 2 additions & 2 deletions requirements_test_pre_commit.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bandit==1.7.7
bandit==1.7.8
codespell==2.2.6
ruff==0.3.0
ruff==0.3.2
yamllint==1.35.1

0 comments on commit cbaefbf

Please sign in to comment.