Skip to content

Commit 0d6f64e

Browse files
Fix lint error
1 parent c9338c8 commit 0d6f64e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.ruff.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ select = [
3131
"DTZ004", # Use datetime.fromtimestamp(ts, tz=) instead of datetime.utcfromtimestamp(ts)
3232
"E", # pycodestyle
3333
"F", # pyflakes/autoflake
34+
"F541", # f-string without any placeholders
3435
"FLY", # flynt
3536
"FURB", # refurb
3637
"G", # flake8-logging-format
@@ -47,6 +48,7 @@ select = [
4748
"PIE", # flake8-pie
4849
"PL", # pylint
4950
"PT", # flake8-pytest-style
51+
"PTH", # flake8-pathlib
5052
"PYI", # flake8-pyi
5153
"RET", # flake8-return
5254
"RSE", # flake8-raise
@@ -81,9 +83,12 @@ select = [
8183
"SLOT", # flake8-slots
8284
"T100", # Trace found: {name} used
8385
"T20", # flake8-print
84-
"TID251", # Banned imports
86+
"TC", # flake8-type-checking
87+
"TID", # Tidy imports
8588
"TRY", # tryceratops
8689
"UP", # pyupgrade
90+
"UP031", # Use format specifiers instead of percent format
91+
"UP032", # Use f-string instead of `format` call
8792
"W", # pycodestyle
8893
]
8994

@@ -102,7 +107,6 @@ ignore = [
102107
"PLR0915", # Too many statements ({statements} > {max_statements})
103108
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
104109
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
105-
"PT004", # Fixture {fixture} does not return anything, add leading underscore
106110
"PT011", # pytest.raises({exception}) is too broad, set the `match` parameter or use a more specific exception
107111
"PT018", # Assertion should be broken down into multiple parts
108112
"RUF001", # String contains ambiguous unicode character.
@@ -113,6 +117,12 @@ ignore = [
113117
"SIM103", # Return the condition {condition} directly
114118
"SIM108", # Use ternary operator {contents} instead of if-else-block
115119
"SIM115", # Use context handler for opening files
120+
121+
# Moving imports into type-checking blocks can mess with pytest.patch()
122+
"TC001", # Move application import {} into a type-checking block
123+
"TC002", # Move third-party import {} into a type-checking block
124+
"TC003", # Move standard library import {} into a type-checking block
125+
116126
"TRY003", # Avoid specifying long messages outside the exception class
117127
"TRY400", # Use `logging.exception` instead of `logging.error`
118128
# Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923

custom_components/pirateweather/forecast_models.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ def __init__(self, d=None):
9696

9797
def __unicode__(self):
9898
"""Return a string representation of the data block."""
99-
return "<ForecastioDataBlock instance: " "%s with %d ForecastioDataPoints>" % (
100-
self.summary,
101-
len(self.data),
102-
)
99+
return f"<PirateWeatherDataBlock instance: {self.summary} with {len(self.data)} PirateWeatherDataPoints>"
103100

104101

105102
class ForecastioDataPoint(UnicodeMixin):

0 commit comments

Comments
 (0)