From 024d309262749039495507ba384b8ac850b4be29 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 3 May 2023 19:20:45 +0200 Subject: [PATCH] index: rename app var to app_dict, its not an App instance Throughout the code, variables named "app" are instances of the App class. In this case, this is related, but it is a dict not an App instance, since it is being prepared for including in the index-v1.json. --- fdroidserver/index.py | 20 ++++++++++---------- fdroidserver/update.py | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fdroidserver/index.py b/fdroidserver/index.py index 812d5f3d..48b51ffe 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -843,10 +843,10 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ appslist = [] output['apps'] = appslist - for packageName, appdict in apps.items(): + for packageName, app_dict in apps.items(): d = collections.OrderedDict() appslist.append(d) - for k, v in sorted(appdict.items()): + for k, v in sorted(app_dict.items()): if not v: continue if k in ('Builds', 'metadatapath', @@ -872,20 +872,20 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ d[k] = v # establish sort order in lists, sets, and localized dicts - for app in output['apps']: - localized = app.get('localized') + for app_dict in output['apps']: + localized = app_dict.get('localized') if localized: lordered = collections.OrderedDict() for lkey, lvalue in sorted(localized.items()): lordered[lkey] = collections.OrderedDict() for ikey, iname in sorted(lvalue.items()): lordered[lkey][ikey] = iname - app['localized'] = lordered - antiFeatures = app.get('antiFeatures', []) - if apps[app["packageName"]].get("NoSourceSince"): + app_dict['localized'] = lordered + antiFeatures = app_dict.get('antiFeatures', []) + if apps[app_dict["packageName"]].get("NoSourceSince"): antiFeatures.append("NoSourceSince") if antiFeatures: - app['antiFeatures'] = sorted(set(antiFeatures)) + app_dict['antiFeatures'] = sorted(set(antiFeatures)) output_packages = collections.OrderedDict() output['packages'] = output_packages @@ -1067,8 +1067,8 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing root.appendChild(element) element.setAttribute('packageName', packageName) - for appid, appdict in apps.items(): - app = metadata.App(appdict) + for appid, app_dict in apps.items(): + app = metadata.App(app_dict) if app.get('Disabled') is not None: continue diff --git a/fdroidserver/update.py b/fdroidserver/update.py index a2564ac9..45d66d33 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -2343,10 +2343,10 @@ def main(): add_apks_to_per_app_repos(repodirs[0], apks) for appid, app in apps.items(): repodir = os.path.join(appid, 'fdroid', 'repo') - appdict = dict() - appdict[appid] = app + app_dict = dict() + app_dict[appid] = app if os.path.isdir(repodir): - index.make(appdict, apks, repodir, False) + index.make(app_dict, apks, repodir, False) else: logging.info(_('Skipping index generation for {appid}').format(appid=appid)) return