Skip to content

Commit 1ff1699

Browse files
committed
Use f-strings
1 parent 8625b9d commit 1ff1699

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

svg_wheel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def add_annular_sectors(wheel, packages, total):
5959
attrib={"class": result["css_class"]},
6060
)
6161
title = et.SubElement(sector, "title")
62-
title.text = "{0} {1}".format(result["name"], result["icon"])
62+
title.text = f"{result['name']} {result['icon']}"
6363

6464

6565
def angles(index, total):
@@ -95,10 +95,10 @@ def add_fraction(wheel, packages, total):
9595
y=str(CENTER - OFFSET),
9696
attrib=text_attributes,
9797
)
98-
packages_with_wheels.text = "{0}".format(wheel_packages)
98+
packages_with_wheels.text = f"{wheel_packages}"
9999

100100
title = et.SubElement(packages_with_wheels, "title")
101-
percentage = "{:.0%}".format(wheel_packages / total)
101+
percentage = f"{wheel_packages / float(total):.0%}"
102102
title.text = percentage
103103

104104
# Dividing line
@@ -120,7 +120,7 @@ def add_fraction(wheel, packages, total):
120120
y=str(CENTER + OFFSET),
121121
attrib=text_attributes,
122122
)
123-
total_packages.text = "{0}".format(total)
123+
total_packages.text = f"{total}"
124124

125125
title = et.SubElement(total_packages, "title")
126126
title.text = percentage
@@ -129,7 +129,7 @@ def add_fraction(wheel, packages, total):
129129
def generate_svg_wheel(packages, total):
130130
wheel = et.Element(
131131
"svg",
132-
viewBox="0 0 {0} {0}".format(2 * CENTER),
132+
viewBox=f"0 0 {2 * CENTER} {2 * CENTER}",
133133
version="1.1",
134134
xmlns="http://www.w3.org/2000/svg",
135135
)

0 commit comments

Comments
 (0)