1
0
Fork 0
forked from github/pelican

chore: Simplify boolean if expression (#2944)

This commit is contained in:
Yasser Tahiri 2023-10-28 21:06:24 +01:00 committed by GitHub
commit b812f2ad1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 24 deletions

View file

@ -183,7 +183,7 @@ def install(path, v=False, u=False):
exists = os.path.exists(theme_path)
if exists and not u:
err(path + ' : already exists')
elif exists and u:
elif exists:
remove(theme_name, v)
install(path, v)
else:
@ -245,15 +245,14 @@ def clean(v=False):
c = 0
for path in os.listdir(_THEMES_PATH):
path = os.path.join(_THEMES_PATH, path)
if os.path.islink(path):
if is_broken_link(path):
if v:
print('Removing {}'.format(path))
try:
os.remove(path)
except OSError:
print('Error: cannot remove {}'.format(path))
else:
c += 1
if os.path.islink(path) and is_broken_link(path):
if v:
print('Removing {}'.format(path))
try:
os.remove(path)
except OSError:
print('Error: cannot remove {}'.format(path))
else:
c += 1
print("\nRemoved {} broken links".format(c))