Skip to content

Commit

Permalink
Merge pull request #54 from kirei/ruff
Browse files Browse the repository at this point in the history
Ruff
  • Loading branch information
jschlyter authored May 3, 2024
2 parents a6722db + 521259e commit b1f21a6
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/checkout@v4"
- uses: home-assistant/actions/hassfest@master
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@v4
- uses: chartboost/ruff-action@v1
38 changes: 0 additions & 38 deletions .github/workflows/test.yml

This file was deleted.

18 changes: 9 additions & 9 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 @@ -323,13 +323,13 @@ async def _update_data(self, charge_point_id, force: bool = False):
charge_point_id,
total_energy,
)
self.hass.data[DOMAIN_DATA]["chargepoint_total_energy"][
charge_point_id
] = round(total_energy, 2)
self.hass.data[DOMAIN_DATA]["chargepoint_total_energy"][charge_point_id] = (
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 @@ -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 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 b1f21a6

Please sign in to comment.