Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio committed May 20, 2024
1 parent 26896e0 commit 6234e32
Show file tree
Hide file tree
Showing 300 changed files with 531 additions and 164 deletions.
1 change: 1 addition & 0 deletions examples/example_callback.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for running a callback when a devices state changed."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_climate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for Climate device."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_daemon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for daemon mode within XKNX."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_datetime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for DateTime device."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_devices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for internal devices storage."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_disconnect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example on how to disconnect/reset all available tunneling channels."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_fan_percent_mode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for Fan device."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_fan_step_mode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for Fan device."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_gatewayscanner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for GatewayScanner."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_light_dimm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for switching a light on and off."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_light_rgbw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for setting different colors on a RGBW remote value."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_light_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for reading the state from the KNX bus."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_light_switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for switching a light on and off."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_manual_connection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for connecting to a specific KNX interface."""

import asyncio
import logging
import time
Expand Down
1 change: 1 addition & 0 deletions examples/example_restart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example on how to connect to restart a KNX device."""

import asyncio
import sys

Expand Down
1 change: 1 addition & 0 deletions examples/example_scene.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for switching a light on and off."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_send_telegrams.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for sending generic telegrams to the KNX bus."""

import asyncio
import logging

Expand Down
1 change: 1 addition & 0 deletions examples/example_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for Sensor device. See docs/sensor.md and docs/binary_sensor.md for a detailed explanation."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for Switch device."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_telegram_monitor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for the telegram monitor callback."""

import asyncio
import getopt
import sys
Expand Down
1 change: 1 addition & 0 deletions examples/example_value_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example on how to read a value from KNX bus."""

import asyncio

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions examples/example_weather.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for Weather device. See docs/weather.md for a detailed explanation."""

import asyncio
import logging

Expand Down
1 change: 1 addition & 0 deletions examples/example_write_individual_address.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for writing an individual address to a KNX device."""

import asyncio
import sys

Expand Down
1 change: 1 addition & 0 deletions examples/example_write_serial_number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for writing an individual address to a KNX device."""

import asyncio
import sys

Expand Down
1 change: 1 addition & 0 deletions examples/ip_secure_calculations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cryptographical calculations of KNX specification example frames."""

from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric.x25519 import (
X25519PrivateKey,
Expand Down
1 change: 1 addition & 0 deletions test/cemi_tests/cemi_frame_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the CEMIFrame object."""

import pytest

from xknx.cemi import (
Expand Down
22 changes: 13 additions & 9 deletions test/cemi_tests/cemi_handler_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for CEMIHandler."""

import asyncio
from unittest.mock import AsyncMock, patch

Expand Down Expand Up @@ -136,9 +137,10 @@ def test_invalid_cemi(raw):
"""Test incoming invalid CEMI Frames."""
xknx = XKNX()

with patch("logging.Logger.warning") as mock_info, patch.object(
xknx.cemi_handler, "handle_cemi_frame"
) as mock_handle_cemi_frame:
with (
patch("logging.Logger.warning") as mock_info,
patch.object(xknx.cemi_handler, "handle_cemi_frame") as mock_handle_cemi_frame,
):
xknx.cemi_handler.handle_raw_cemi(raw)
mock_info.assert_called_once()
mock_handle_cemi_frame.assert_not_called()
Expand All @@ -157,9 +159,10 @@ def test_unsupported_cemi(raw):
"""Test incoming unsupported CEMI Frames."""
xknx = XKNX()

with patch("logging.Logger.info") as mock_info, patch.object(
xknx.cemi_handler, "handle_cemi_frame"
) as mock_handle_cemi_frame:
with (
patch("logging.Logger.info") as mock_info,
patch.object(xknx.cemi_handler, "handle_cemi_frame") as mock_handle_cemi_frame,
):
xknx.cemi_handler.handle_raw_cemi(raw)
mock_info.assert_called_once()
mock_handle_cemi_frame.assert_not_called()
Expand All @@ -173,9 +176,10 @@ def test_incoming_from_own_ia():
# L_Data.ind GroupValueWrite from 1.1.22 to to 5/1/22 with DPT9 payload 0C 3F
raw = bytes.fromhex("2900bcd011162916030080 0c 3f")

with patch("logging.Logger.debug") as mock_debug, patch.object(
xknx.cemi_handler, "telegram_received"
) as mock_telegram_received:
with (
patch("logging.Logger.debug") as mock_debug,
patch.object(xknx.cemi_handler, "telegram_received") as mock_telegram_received,
):
xknx.cemi_handler.handle_raw_cemi(raw)
mock_debug.assert_called_once()
mock_telegram_received.assert_called_once()
Expand Down
1 change: 1 addition & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Conftest for XKNX."""

import asyncio

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/core_tests/connection_manager_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for connection manager."""

from datetime import datetime
import threading
from unittest.mock import AsyncMock, patch
Expand Down
1 change: 1 addition & 0 deletions test/core_tests/exceptions_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for exceptions."""

import pytest

from xknx.exceptions import (
Expand Down
1 change: 1 addition & 0 deletions test/core_tests/state_updater_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for StateUpdater."""

from unittest.mock import Mock, patch

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/core_tests/task_registry_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for task registry."""

import asyncio
import sys

Expand Down
1 change: 1 addition & 0 deletions test/core_tests/telegram_queue_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for telegram received callback."""

import asyncio
from unittest.mock import AsyncMock, MagicMock, call, patch

Expand Down
1 change: 1 addition & 0 deletions test/core_tests/value_reader_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for value reader."""

import asyncio
from unittest.mock import MagicMock, patch

Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/binary_sensor_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for BinarySensor objects."""

from unittest.mock import AsyncMock, patch

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/climate_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Climate objects."""

from unittest.mock import AsyncMock, patch

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/cover_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Cover objects."""

from unittest.mock import AsyncMock, patch

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/datetime_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for DateTime object."""

import time
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/device_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Switch objects."""

from unittest.mock import AsyncMock, patch

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/devices_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for devices container within XKNX."""

from unittest.mock import AsyncMock, patch

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/expose_sensor_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Sensor objects."""

from unittest.mock import AsyncMock, call

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/fan_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Fan objects."""

from unittest.mock import AsyncMock, patch

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/light_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Light objects."""

from unittest.mock import AsyncMock, patch

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/notification_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Notification objects."""

from unittest.mock import AsyncMock, patch

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/numeric_value_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for NumericValue objects."""

from unittest.mock import AsyncMock

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/raw_value_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for RawValue objects."""

from unittest.mock import AsyncMock

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/scene_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Scene objects."""

from xknx import XKNX
from xknx.devices import Scene
from xknx.dpt import DPTArray
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/sensor_expose_loop_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Sensor and ExposeSensor objects."""

from unittest.mock import AsyncMock, call

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/sensor_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Sensor objects."""

from unittest.mock import AsyncMock

import pytest
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/switch_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Switch objects."""

from unittest.mock import AsyncMock, Mock

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/travelcalculator_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for TravelCalculator objects."""

from unittest.mock import patch

from xknx.devices import TravelCalculator, TravelStatus
Expand Down
1 change: 1 addition & 0 deletions test/devices_tests/weather_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for Weather objects."""

import datetime

from xknx import XKNX
Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_1byte_signed_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for KNX DPT 1 byte relative value objects."""

import pytest

from xknx.dpt import DPTArray, DPTPercentV8, DPTSignedRelativeValue, DPTValue1Count
Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_1byte_uint_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for KNX DPT 5.010 value."""

import pytest

from xknx.dpt import DPTArray, DPTTariff, DPTValue1Ucount
Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_2byte_signed_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for KNX 2 byte signed objects."""

import struct
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_2byte_uint_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for KNX 2 byte objects."""

import pytest

from xknx.dpt import DPTArray, DPTUElCurrentmA
Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_4bit_control_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for DPTControlStepCode objects."""

import pytest

from xknx.dpt import (
Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_4byte_int_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for KNX 4 byte objects."""

import struct
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions test/dpt_tests/dpt_color_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for KNX color objects."""

import pytest

from xknx.dpt.dpt_color import DPTArray, DPTColorXYY, XYYColor
Expand Down
Loading

0 comments on commit 6234e32

Please sign in to comment.