Skip to content

Commit

Permalink
use ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jschlyter committed May 3, 2024
1 parent 345d339 commit ef1e631
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 42 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Ruff

on: [ push, pull_request ]

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: chartboost/ruff-action@v1
27 changes: 0 additions & 27 deletions .github/workflows/test.yml

This file was deleted.

12 changes: 6 additions & 6 deletions custom_components/chargeamps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ async def _update_data(self, charge_point_id, force: bool = False):
charge_point_id, connector_status.connector_id
)
)
self.hass.data[DOMAIN_DATA]["connector_settings"][
key
] = connector_settings
self.hass.data[DOMAIN_DATA]["connector_settings"][key] = (
connector_settings
)
total_energy = sum(
[
v.total_consumption_kwh
Expand All @@ -327,9 +327,9 @@ async def _update_data(self, charge_point_id, force: bool = False):
round(total_energy, 2)
)
settings = await self.client.get_chargepoint_settings(charge_point_id)
self.hass.data[DOMAIN_DATA]["chargepoint_settings"][
charge_point_id
] = settings
self.hass.data[DOMAIN_DATA]["chargepoint_settings"][charge_point_id] = (
settings
)
except Exception as error: # pylint: disable=broad-except
_LOGGER.error("Could not update data - %s", error)

Expand Down
4 changes: 1 addition & 3 deletions custom_components/chargeamps/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None
): # pylint: disable=unused-argument
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): # pylint: disable=unused-argument
"""Setup light platform."""
lights = []
handler = hass.data[DOMAIN_DATA]["handler"]
Expand Down
4 changes: 1 addition & 3 deletions custom_components/chargeamps/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None
): # pylint: disable=unused-argument
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): # pylint: disable=unused-argument
"""Setup sensor platform."""
sensors = []
handler = hass.data[DOMAIN_DATA]["handler"]
Expand Down
4 changes: 1 addition & 3 deletions custom_components/chargeamps/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None
): # pylint: disable=unused-argument
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): # pylint: disable=unused-argument
"""Setup switch platform."""
switches = []
handler = hass.data[DOMAIN_DATA]["handler"]
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.isort]
profile = "black"

[tool.ruff]
line-length = 132

[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
]
ignore = ["I001"]

0 comments on commit ef1e631

Please sign in to comment.