Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cloneofghosts committed Aug 15, 2024
1 parent 3d1b168 commit 3de1574
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion custom_components/pirateweather/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
CONF_SCAN_INTERVAL: pw_scan_Int,
}

# Setup platforms
# Setup platforms
# If both platforms
if (PW_PLATFORMS[0] in pw_entity_platform) and (
PW_PLATFORMS[1] in pw_entity_platform
Expand Down
2 changes: 1 addition & 1 deletion custom_components/pirateweather/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async def async_step_init(self, user_input=None):
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL
),
),
): int,
): int,
vol.Required(
PW_PLATFORM,
default=self.config_entry.options.get(
Expand Down
6 changes: 3 additions & 3 deletions custom_components/pirateweather/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from datetime import fromtimestamp
from typing import Literal, NamedTuple

import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import homeassistant.helpers.template as template_helper
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
Expand Down Expand Up @@ -1162,8 +1162,8 @@ def get_state(self, data):
"precip_intensity_max",
]:
outState = round(state, roundingPrecip)
# Convert unix times to datetimes times

# Convert unix times to datetimes times
elif self.type in [
"temperature_high_time",
"temperature_low_time",
Expand Down
6 changes: 3 additions & 3 deletions custom_components/pirateweather/weather_update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ async def _async_update_data(self):

async def _get_pw_weather(self):
"""Poll weather data from PW."""

if self.latitude == 0.0:
requestLatitude = self.hass.config.latitude
else:
requestLatitude = self.latitude

if self.longitude == 0.0:
requestLongitude = self.hass.config.latitude
else:
requestLongitude = self.longitude

forecastString = (
"https://api.pirateweather.net/forecast/"
+ self._api_key
Expand Down

3 comments on commit 3de1574

@cloneofghosts
Copy link
Collaborator Author

@cloneofghosts cloneofghosts commented on 3de1574 Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander0042 I see you were having issues getting the code to lint so I fixed the issues for you. There's a lint script in the lint folder you can run to lint your code and will fix any errors it can for you. If you're using VS Studio Code you can also fix the errors there as well. 😄

Also maybe we need a script for running the format command so we don't have to have the action fix it every time.

@alexander0042
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why I should have done it by a PR! Thank you for saving the day here, since I was going crazy trying to figure out what it wanted.

I should get more familiar with Ruff, since it seems fantastic. You'll laugh, but I use Notepad++ for all the home assistant stuff, but could easily check it in VS Code

@cloneofghosts
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why I should have done it by a PR! Thank you for saving the day here, since I was going crazy trying to figure out what it wanted.

I like to create PRs since when you generate release notes it automatically adds them to the Whats Changed section

I should get more familiar with Ruff, since it seems fantastic. You'll laugh, but I use Notepad++ for all the home assistant stuff, but could easily check it in VS Code

Notepad++ works! The main reason to use VS Code is so you can setup a devcontainer for testing but I think you said you have a dev machine. You should be able to use the lint script to lint your code so you don't have to rely on GitHub to lint your code.

Please sign in to comment.