Refactor unnecessary else / elif when if block has a return statement (#485)

This commit is contained in:
0xMRTT 2022-09-23 18:54:26 +02:00 committed by GitHub
commit 7e0386bf2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,46 +194,43 @@ class FirefoxGnomeThemePlugin(IPlugin):
if len(profiles) == 0:
print("No profiles found")
return
else:
self.css = self.css.format(
d_1=self.palette["dark_"]["1"],
d_2=self.palette["dark_"]["2"],
d_3=self.palette["dark_"]["3"],
d_4=self.palette["dark_"]["4"],
l_1=self.palette["light_"]["1"],
l_2=self.palette["light_"]["2"],
l_3=self.palette["light_"]["3"],
l_4=self.palette["light_"]["4"],
bg=self.variables["window_bg_color"],
fg=self.variables["window_fg_color"],
red=self.palette["red_"]["5"],
grn=self.palette["green_"]["5"],
ylw=self.palette["yellow_"]["5"],
blu=self.palette["blue_"]["5"],
pnk=self.palette["purple_"]["5"],
cyn=self.palette["blue_"]["5"],
wht=self.palette["light_"]["5"],
blk=self.palette["dark_"]["5"],
b_red=self.palette["red_"]["1"],
b_grn=self.palette["green_"]["1"],
b_ylw=self.palette["yellow_"]["1"],
b_blu=self.palette["blue_"]["1"],
b_pnk=self.palette["purple_"]["1"],
b_cyn=self.palette["blue_"]["1"],
b_wht=self.palette["light_"]["1"],
b_blk=self.palette["dark_"]["1"],
)
for profile in profiles:
profile = (
profile / "chrome" / "firefox-gnome-theme" / "customChrome.css"
)
if profile.exists():
if self.custom_settings["overwrite"]:
with open(profile, "w", encoding="utf-8") as f:
f.write(self.css)
else:
self.css = self.css.format(
d_1=self.palette["dark_"]["1"],
d_2=self.palette["dark_"]["2"],
d_3=self.palette["dark_"]["3"],
d_4=self.palette["dark_"]["4"],
l_1=self.palette["light_"]["1"],
l_2=self.palette["light_"]["2"],
l_3=self.palette["light_"]["3"],
l_4=self.palette["light_"]["4"],
bg=self.variables["window_bg_color"],
fg=self.variables["window_fg_color"],
red=self.palette["red_"]["5"],
grn=self.palette["green_"]["5"],
ylw=self.palette["yellow_"]["5"],
blu=self.palette["blue_"]["5"],
pnk=self.palette["purple_"]["5"],
cyn=self.palette["blue_"]["5"],
wht=self.palette["light_"]["5"],
blk=self.palette["dark_"]["5"],
b_red=self.palette["red_"]["1"],
b_grn=self.palette["green_"]["1"],
b_ylw=self.palette["yellow_"]["1"],
b_blu=self.palette["blue_"]["1"],
b_pnk=self.palette["purple_"]["1"],
b_cyn=self.palette["blue_"]["1"],
b_wht=self.palette["light_"]["1"],
b_blk=self.palette["dark_"]["1"],
)
for profile in profiles:
profile = profile / "chrome" / "firefox-gnome-theme" / "customChrome.css"
if profile.exists():
if self.custom_settings["overwrite"]:
with open(profile, "w", encoding="utf-8") as f:
f.write(self.css)
else:
with open(profile, "w", encoding="utf-8") as f:
f.write(self.css)
def save(self):
return self.custom_settings