Skip to content

Commit

Permalink
refactor(black): remove trailing comma when there were more character…
Browse files Browse the repository at this point in the history
…s after it
  • Loading branch information
xaviml committed Oct 20, 2020
1 parent 0491228 commit 4648526
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = "==19.10b0"
black = "==20.8b1"
pytest = "==6.1.1"
pytest-asyncio = "==0.14.0"
pytest-cov = "==2.10.1"
Expand Down
8 changes: 2 additions & 6 deletions apps/controllerx/cx_core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ class Controller(Hass, Mqtt, abc.ABC):
"""

async def initialize(self) -> None:
self.log(
f"🎮 ControllerX {cx_version.__version__}", ascii_encode=False,
)
self.log(f"🎮 ControllerX {cx_version.__version__}", ascii_encode=False)
self.check_ad_version()

# Get arguments
Expand Down Expand Up @@ -232,9 +230,7 @@ async def call_service(self, service: str, **attributes) -> None:
for attribute, value in attributes.items():
if isinstance(value, float):
value = f"{value:.2f}"
self.log(
f" - {attribute}: {value}", level="INFO", ascii_encode=False,
)
self.log(f" - {attribute}: {value}", level="INFO", ascii_encode=False)
return await Hass.call_service(self, service, **attributes)

async def handle_action(self, action_key: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/feature_support/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CoverSupport(FeatureSupport):
SET_TILT_POSITION = 128

def __init__(
self, entity: str, controller: TypeController, update_supported_features: bool,
self, entity: str, controller: TypeController, update_supported_features: bool
) -> None:
super().__init__(
entity,
Expand Down
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/feature_support/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LightSupport(FeatureSupport):
WHITE_VALUE = 128

def __init__(
self, entity: str, controller: TypeController, update_supported_features: bool,
self, entity: str, controller: TypeController, update_supported_features: bool
) -> None:
super().__init__(
entity,
Expand Down
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/feature_support/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MediaPlayerSupport(FeatureSupport):
SELECT_SOUND_MODE = 65536

def __init__(
self, entity: str, controller: TypeController, update_supported_features: bool,
self, entity: str, controller: TypeController, update_supported_features: bool
) -> None:
super().__init__(
entity,
Expand Down
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/integration/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_actions_mapping(self) -> Optional[TypeActionsMapping]:

def listen_changes(self, controller_id: str) -> None:
Mqtt.listen_event(
self.controller, self.event_callback, topic=controller_id, namespace="mqtt",
self.controller, self.event_callback, topic=controller_id, namespace="mqtt"
)

async def event_callback(self, event_name: str, data: dict, kwargs: dict) -> None:
Expand Down
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/type/light_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def initialize(self) -> None:
def get_domain(self) -> List[str]:
return ["light"]

def get_type_actions_mapping(self,) -> TypeActionsMapping:
def get_type_actions_mapping(self) -> TypeActionsMapping:
return {
Light.ON: self.on,
Light.OFF: self.off,
Expand Down
4 changes: 1 addition & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ def _all_subclasses(cls):


def get_classes(file_, package_, class_, instantiate=False):
_import_modules(
file_, package_,
)
_import_modules(file_, package_)
subclasses = _all_subclasses(class_)
subclasses = [
cls_() if instantiate else cls_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/cx_core/controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def test_initialize(
)
@pytest.mark.asyncio
async def test_merge_mapping(
sut, monkeypatch, mocker, mapping, merge_mapping, actions_output, expected_error,
sut, monkeypatch, mocker, mapping, merge_mapping, actions_output, expected_error
):
actions_input = ["action1", "action2", "action3"]
actions = {action: action for action in actions_input}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/cx_core/custom_controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def test_custom_controllers(
)
@pytest.mark.asyncio
async def test_call_service_controller(
hass_mock, monkeypatch, mocker, integration, services, expected_calls,
hass_mock, monkeypatch, mocker, integration, services, expected_calls
):
sut = CallServiceController() # type: ignore
sut.args = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@pytest.mark.parametrize(
"number, expected_supported_features",
[
(1, {CoverSupport.OPEN},),
(1, {CoverSupport.OPEN}),
(
15,
{
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/cx_core/integration/zha_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
)
@pytest.mark.asyncio
async def test_get_integrations(
fake_controller, mocker, command, args, expected_called_with,
fake_controller, mocker, command, args, expected_called_with
):
data = {"command": command, "args": args}
handle_action_patch = mocker.patch.object(fake_controller, "handle_action")
Expand Down
6 changes: 2 additions & 4 deletions tests/unit_tests/cx_core/type/light_controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async def fake_get_entity_state(entity, attribute=None):
False,
51,
),
(0, "xy_color", Stepper.UP, CircularStepper(0, 30, 30), "on", False, False, 0,),
(0, "xy_color", Stepper.UP, CircularStepper(0, 30, 30), "on", False, False, 0),
(
499,
"color_temp",
Expand Down Expand Up @@ -616,9 +616,7 @@ async def fake_get_attribute(*args, **kwargs):
super_hold_patch.assert_called_with(attribute_input, expected_direction)


@pytest.mark.parametrize(
"value_attribute", [10, None],
)
@pytest.mark.parametrize("value_attribute", [10, None])
@pytest.mark.asyncio
async def test_hold_loop(sut, mocker, value_attribute):
attribute = "test_attribute"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async def test_hold_loop(
)
else:
called_service_patch.assert_called_once_with(
f"media_player/volume_{direction_input}", entity_id=sut.media_player,
f"media_player/volume_{direction_input}", entity_id=sut.media_player
)


Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/cx_core/type_controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def sut(hass_mock):
"entity, domains, entities, error_expected",
[
("light.kitchen", ["light"], [], False),
("light1.kitchen", ["light"], [], True,),
("media_player.kitchen", ["light"], [], True,),
("light1.kitchen", ["light"], [], True),
("media_player.kitchen", ["light"], [], True),
("media_player.bedroom", ["media_player"], [], False),
("group.all_lights", ["light"], ["light.light1", "light.light2"], False),
("group.all_lights", ["light"], ["light1.light1", "light2.light2"], True),
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/cx_devices/aqara_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
({"command": "shake"}, "shake"),
({"command": "knock"}, "knock"),
({"command": "slide"}, "slide"),
({"command": "flip", "args": {"flip_degrees": 90}}, "flip90",),
({"command": "flip", "args": {"flip_degrees": 90}}, "flip90"),
({"command": "flip", "args": {"flip_degrees": 180}}, "flip180"),
({"command": "rotate_left"}, "rotate_left"),
({"command": "rotate_right"}, "rotate_right"),
Expand Down

0 comments on commit 4648526

Please sign in to comment.