Skip to content

Commit fb80b2d

Browse files
style: run ruff and fix line length
1 parent ca4d0ce commit fb80b2d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

ohsome_quality_api/indicators/attribute_completeness/indicator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ def compute_units_for_all_and_matched(self):
197197
all = f"{int(self.absolute_value_1)} elements"
198198
matched = f"{int(self.absolute_value_2)} elements"
199199
elif self.topic.aggregation_type == "area":
200-
all = f"{str(round(self.absolute_value_1/1000000, 2))} km²"
201-
matched = f"{str(round(self.absolute_value_2/1000000, 2))} km²"
200+
all = f"{str(round(self.absolute_value_1 / 1000000, 2))} km²"
201+
matched = f"{str(round(self.absolute_value_2 / 1000000, 2))} km²"
202202
elif self.topic.aggregation_type == "length":
203-
all = f"{str(round(self.absolute_value_1/1000, 2))} km"
204-
matched = f"{str(round(self.absolute_value_2/1000, 2))} km"
203+
all = f"{str(round(self.absolute_value_1 / 1000, 2))} km"
204+
matched = f"{str(round(self.absolute_value_2 / 1000, 2))} km"
205205
else:
206206
raise ValueError("Invalid aggregation_type")
207207
return all, matched

ohsome_quality_api/indicators/road_comparison/indicator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def calculate(self) -> None:
121121
self.result.description += self.warnings[key] + "\n"
122122
self.result.description += (
123123
f"{self.data_ref[key]['name']} has a road length of "
124-
f"{(self.length_total[key]/1000):.2f} km, of which "
125-
f"{(self.length_matched[key]/1000):.2f} km are covered by roads in "
124+
f"{(self.length_total[key] / 1000):.2f} km, of which "
125+
f"{(self.length_matched[key] / 1000):.2f} km are covered by roads in "
126126
f"OSM. "
127127
)
128128

@@ -169,6 +169,10 @@ def create_figure(self) -> None:
169169
for i, (name, ratio, date) in enumerate(
170170
zip(ref_name, ref_ratio, ref_processingdate)
171171
):
172+
hovertext = (
173+
f"OSM Covered: {(self.length_matched[name] / 1000):.2f} km "
174+
+ f"({date:%b %d, %Y})"
175+
)
172176
fig.add_trace(
173177
pgo.Bar(
174178
x=[name],
@@ -179,8 +183,7 @@ def create_figure(self) -> None:
179183
line=dict(color=Color.GREY.value, width=1),
180184
),
181185
width=0.4,
182-
hovertext=f"OSM Covered: {(self.length_matched[name]/1000):.2f} km"
183-
f" ({date:%b %d, %Y})",
186+
hovertext=hovertext,
184187
hoverinfo="text",
185188
)
186189
)

tests/integrationtests/indicators/test_road_comparison.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ def test_get_sources(self, topic_major_roads_length, feature_malta):
8484
indicator = RoadComparison(topic_major_roads_length, feature_malta)
8585
source = indicator.format_sources()
8686
assert (
87-
"<a href='https://github.com/microsoft/RoadDetections'>"
88-
"Microsoft Roads</a>"
87+
"<a href='https://github.com/microsoft/RoadDetections'>Microsoft Roads</a>"
8988
) in source
9089

9190
def test_attribution(self, topic_major_roads_length, feature_malta):

0 commit comments

Comments
 (0)