Less indentation

merge-requests/30/head
Bob Mottram 2024-07-19 12:56:05 +01:00
parent 7c52e3a7ca
commit 7c70fe6f57
1 changed files with 37 additions and 31 deletions

View File

@ -105,7 +105,8 @@ def _load_dfc_ids(base_dir: str, system_language: str,
continue
if not label.get('@value'):
continue
if label['@language'] == system_language:
if label['@language'] != system_language:
continue
item_id = \
item['@id'].replace('http://static.datafoodconsortium.org',
http_prefix + '://' + domain_full)
@ -155,8 +156,10 @@ def remove_shared_item2(base_dir: str, nickname: str, domain: str,
if shares_json[item_id]['imageUrl']:
formats = get_image_extensions()
for ext in formats:
if shares_json[item_id]['imageUrl'].endswith('.' + ext):
if os.path.isfile(item_idfile + '.' + ext):
if not shares_json[item_id]['imageUrl'].endswith('.' + ext):
continue
if not os.path.isfile(item_idfile + '.' + ext):
continue
try:
os.remove(item_idfile + '.' + ext)
except OSError:
@ -358,7 +361,8 @@ def add_share(base_dir: str,
acct_dir(base_dir, nickname, domain) + '/upload'
formats = get_image_extensions()
for ext in formats:
if os.path.isfile(shares_image_filename + '.' + ext):
if not os.path.isfile(shares_image_filename + '.' + ext):
continue
image_filename = shares_image_filename + '.' + ext
move_image = True
@ -486,7 +490,8 @@ def _expire_shares_for_account(base_dir: str, nickname: str, domain: str,
item_idfile = base_dir + '/sharefiles/' + nickname + '/' + item_id
formats = get_image_extensions()
for ext in formats:
if os.path.isfile(item_idfile + '.' + ext):
if not os.path.isfile(item_idfile + '.' + ext):
continue
try:
os.remove(item_idfile + '.' + ext)
except OSError:
@ -2297,7 +2302,8 @@ def actor_attached_shares_as_html(actor_json: {},
html_str = ''
ctr = 0
for attach_item in actor_json['attachment']:
if _is_valueflows_attachment(attach_item):
if not _is_valueflows_attachment(attach_item):
continue
if not html_str:
html_str = '<ul>\n'
html_str += \