Fix pep8 whitespace errors

This commit is contained in:
Benedikt Brückmann 2021-06-07 12:49:16 +02:00
parent 1e943a22df
commit 01b9fb1549
12 changed files with 50 additions and 50 deletions

View file

@ -70,9 +70,9 @@ def print_help(available_plugins=None):
def preparse_plugin(module_name, module_dir): def preparse_plugin(module_name, module_dir):
"""No summary. """No summary.
Simple regex based parsing for plugin scripts. Simple regex based parsing for plugin scripts.
So we don't have to import them when we just need the summary, So we don't have to import them when we just need the summary,
but not plan on executing this particular plugin. but not plan on executing this particular plugin.
""" """

View file

@ -371,7 +371,7 @@ def zip_data(apkfile, count=1024):
""" """
Extract central directory, EOCD, and offsets from ZIP. Extract central directory, EOCD, and offsets from ZIP.
Returns Returns
------- -------
ZipData ZipData
""" """
@ -411,7 +411,7 @@ def patch_v2_sig(extracted_v2_sig, output_apk):
def patch_apk(extracted_meta, extracted_v2_sig, unsigned_apk, output_apk): def patch_apk(extracted_meta, extracted_v2_sig, unsigned_apk, output_apk):
"""Patch extracted_meta + extracted_v2_sig. """Patch extracted_meta + extracted_v2_sig.
Patches extracted_meta + extracted_v2_sig (if not None) Patches extracted_meta + extracted_v2_sig (if not None)
onto unsigned_apk and save as output_apk. onto unsigned_apk and save as output_apk.
""" """
date_time = copy_apk(unsigned_apk, output_apk) date_time = copy_apk(unsigned_apk, output_apk)

View file

@ -836,7 +836,7 @@ def trybuild(app, build, build_dir, output_dir, log_dir, also_check_dir,
Parameters Parameters
---------- ----------
output_dir output_dir
The directory where the build output will go. The directory where the build output will go.
Usually this is the 'unsigned' directory. Usually this is the 'unsigned' directory.
repo_dir repo_dir
The repo directory - used for checking if the build is necessary. The repo directory - used for checking if the build is necessary.
@ -895,7 +895,7 @@ def force_halt_build(timeout):
def parse_commandline(): def parse_commandline():
"""Parse the command line. """Parse the command line.
Returns Returns
------- -------
options options

View file

@ -363,7 +363,7 @@ def check_gplay(app):
def try_init_submodules(app, last_build, vcs): def try_init_submodules(app, last_build, vcs):
"""Try to init submodules if the last build entry used them. """Try to init submodules if the last build entry used them.
They might have been removed from the app's repo in the meantime, They might have been removed from the app's repo in the meantime,
so if we can't find any submodules we continue with the updates check. so if we can't find any submodules we continue with the updates check.
If there is any other error in initializing them then we stop the check. If there is any other error in initializing them then we stop the check.

View file

@ -972,7 +972,7 @@ class vcs:
def gotorevision(self, rev, refresh=True): def gotorevision(self, rev, refresh=True):
"""Take the local repository to a clean version of the given revision. """Take the local repository to a clean version of the given revision.
Take the local repository to a clean version of the given Take the local repository to a clean version of the given
revision, which is specificed in the VCS's native revision, which is specificed in the VCS's native
format. Beforehand, the repository can be dirty, or even format. Beforehand, the repository can be dirty, or even
@ -1031,7 +1031,7 @@ class vcs:
def gotorevisionx(self, rev): # pylint: disable=unused-argument def gotorevisionx(self, rev): # pylint: disable=unused-argument
"""No summary. """No summary.
Derived classes need to implement this. Derived classes need to implement this.
It's called once basic checking has been performed. It's called once basic checking has been performed.
@ -1109,7 +1109,7 @@ class vcs_git(vcs):
def checkrepo(self): def checkrepo(self):
"""No summary. """No summary.
If the local directory exists, but is somehow not a git repository, If the local directory exists, but is somehow not a git repository,
git will traverse up the directory tree until it finds one git will traverse up the directory tree until it finds one
that is (i.e. fdroidserver) and then we'll proceed to destroy that is (i.e. fdroidserver) and then we'll proceed to destroy
@ -1256,7 +1256,7 @@ class vcs_gitsvn(vcs):
def checkrepo(self): def checkrepo(self):
"""No summary. """No summary.
If the local directory exists, but is somehow not a git repository, If the local directory exists, but is somehow not a git repository,
git will traverse up the directory tree until it finds one that git will traverse up the directory tree until it finds one that
is (i.e. fdroidserver) and then we'll proceed to destory it! is (i.e. fdroidserver) and then we'll proceed to destory it!
@ -2499,7 +2499,7 @@ class KnownApks:
def getapp(self, apkname): def getapp(self, apkname):
"""Look up information - given the 'apkname'. """Look up information - given the 'apkname'.
Returns (app id, date added/None). Returns (app id, date added/None).
Or returns None for an unknown apk. Or returns None for an unknown apk.
""" """
@ -2587,7 +2587,7 @@ def is_apk_and_debuggable(apkfile):
---------- ----------
apkfile apkfile
full path to the APK to check full path to the APK to check
""" """
if get_file_extension(apkfile) != 'apk': if get_file_extension(apkfile) != 'apk':
return False return False
@ -2708,7 +2708,7 @@ def get_apk_id_aapt(apkfile):
def get_native_code(apkfile): def get_native_code(apkfile):
"""Aapt checks if there are architecture folders under the lib/ folder. """Aapt checks if there are architecture folders under the lib/ folder.
We are simulating the same behaviour. We are simulating the same behaviour.
""" """
arch_re = re.compile("^lib/(.*)/.*$") arch_re = re.compile("^lib/(.*)/.*$")
@ -2834,7 +2834,7 @@ def FDroidPopen(commands, cwd=None, envs=None, output=True, stderr_to_stdout=Tru
optionally specifies a working directory optionally specifies a working directory
envs envs
a optional dictionary of environment variables and their values a optional dictionary of environment variables and their values
Returns Returns
------- -------
A PopenResult. A PopenResult.
@ -3168,7 +3168,7 @@ def metadata_find_signing_files(appid, vercode):
Returns Returns
------- -------
List List
of 4-tuples for each signing key with following paths: of 4-tuples for each signing key with following paths:
(signature_file, signature_block_file, manifest, v2_files), where v2_files (signature_file, signature_block_file, manifest, v2_files), where v2_files
is either a (apk_signing_block_offset_file, apk_signing_block_file) pair or None is either a (apk_signing_block_offset_file, apk_signing_block_file) pair or None
@ -3207,7 +3207,7 @@ def metadata_find_developer_signing_files(appid, vercode):
Returns Returns
------- -------
List List
of 4-tuples for each signing key with following paths: of 4-tuples for each signing key with following paths:
(signature_file, signature_block_file, manifest, v2_files), where v2_files (signature_file, signature_block_file, manifest, v2_files), where v2_files
is either a (apk_signing_block_offset_file, apk_signing_block_file) pair or None is either a (apk_signing_block_offset_file, apk_signing_block_file) pair or None
@ -3337,7 +3337,7 @@ def apk_extract_signatures(apkpath, outdir):
def get_min_sdk_version(apk): def get_min_sdk_version(apk):
"""Wrap the androguard function to always return and int. """Wrap the androguard function to always return and int.
Fall back to 1 if we can't get a valid minsdk version. Fall back to 1 if we can't get a valid minsdk version.
Parameters Parameters
@ -3490,7 +3490,7 @@ def verify_apk_signature(apk, min_sdk_version=None):
Returns Returns
------- -------
Boolean Boolean
whether the APK was verified whether the APK was verified
""" """
if set_command_in_config('apksigner'): if set_command_in_config('apksigner'):
@ -3534,7 +3534,7 @@ def verify_old_apk_signature(apk):
Returns Returns
------- -------
Boolean Boolean
whether the APK was verified whether the APK was verified
""" """
@ -3635,7 +3635,7 @@ def compare_apks(apk1, apk2, tmp_dir, log_dir=None):
def set_command_in_config(command): def set_command_in_config(command):
"""Try to find specified command in the path, if it hasn't been manually set in config.yml. """Try to find specified command in the path, if it hasn't been manually set in config.yml.
If found, it is added to the config If found, it is added to the config
dict. The return value says whether the command is available. dict. The return value says whether the command is available.
@ -3782,7 +3782,7 @@ def load_stats_fdroid_signing_key_fingerprints():
Returns Returns
------- -------
dict dict
containing the signing-key fingerprints. containing the signing-key fingerprints.
""" """
jar_file = os.path.join('stats', 'publishsigkeys.jar') jar_file = os.path.join('stats', 'publishsigkeys.jar')
@ -3819,7 +3819,7 @@ def write_to_config(thisconfig, key, value=None, config_file=None):
config dictionary config dictionary
key key
variable name in config to be overwritten/added variable name in config to be overwritten/added
value value
optional value to be written, instead of fetched optional value to be written, instead of fetched
from 'thisconfig' dictionary. from 'thisconfig' dictionary.
""" """

View file

@ -48,7 +48,7 @@ REMOTE_HOSTNAME_REGEX = re.compile(r'\W*\w+\W+(\w+).*')
def update_awsbucket(repo_section): def update_awsbucket(repo_section):
"""Upload the contents of the directory `repo_section` (including subdirectories) to the AWS S3 "bucket". """Upload the contents of the directory `repo_section` (including subdirectories) to the AWS S3 "bucket".
The contents of that subdir of the The contents of that subdir of the
bucket will first be deleted. bucket will first be deleted.
@ -141,10 +141,10 @@ def update_awsbucket_s3cmd(repo_section):
def update_awsbucket_libcloud(repo_section): def update_awsbucket_libcloud(repo_section):
"""No summary. """No summary.
Upload the contents of the directory `repo_section` (including Upload the contents of the directory `repo_section` (including
subdirectories) to the AWS S3 "bucket". subdirectories) to the AWS S3 "bucket".
The contents of that subdir of the The contents of that subdir of the
bucket will first be deleted. bucket will first be deleted.

View file

@ -590,7 +590,7 @@ def _copy_to_local_copy_dir(repodir, f):
def v1_sort_packages(packages, fdroid_signing_key_fingerprints): def v1_sort_packages(packages, fdroid_signing_key_fingerprints):
"""Sort the supplied list to ensure a deterministic sort order for package entries in the index file. """Sort the supplied list to ensure a deterministic sort order for package entries in the index file.
This sort-order also expresses This sort-order also expresses
installation preference to the clients. installation preference to the clients.
(First in this list = first to install) (First in this list = first to install)
@ -1124,7 +1124,7 @@ def get_public_key_from_jar(jar):
---------- ----------
jar jar
a zipfile.ZipFile object a zipfile.ZipFile object
Returns Returns
------- -------
the public key from the jar and its fingerprint the public key from the jar and its fingerprint

View file

@ -56,7 +56,7 @@ def publish_source_tarball(apkfilename, unsigned_dir, output_dir):
def key_alias(appid): def key_alias(appid):
"""No summary. """No summary.
Get the alias which F-Droid uses to indentify the singing key Get the alias which F-Droid uses to indentify the singing key
for this App in F-Droids keystore. for this App in F-Droids keystore.
""" """
@ -101,7 +101,7 @@ def read_fingerprints_from_keystore():
def sign_sig_key_fingerprint_list(jar_file): def sign_sig_key_fingerprint_list(jar_file):
"""Sign the list of app-signing key fingerprints. """Sign the list of app-signing key fingerprints.
This is used primaryily by fdroid update to determine which APKs This is used primaryily by fdroid update to determine which APKs
where built and signed by F-Droid and which ones were where built and signed by F-Droid and which ones were
manually added by users. manually added by users.
@ -125,7 +125,7 @@ def sign_sig_key_fingerprint_list(jar_file):
def store_stats_fdroid_signing_key_fingerprints(appids, indent=None): def store_stats_fdroid_signing_key_fingerprints(appids, indent=None):
"""Store list of all signing-key fingerprints for given appids to HD. """Store list of all signing-key fingerprints for given appids to HD.
This list will later on be needed by fdroid update. This list will later on be needed by fdroid update.
""" """
if not os.path.exists('stats'): if not os.path.exists('stats'):
@ -172,9 +172,9 @@ def check_for_key_collisions(allapps):
Parameters Parameters
---------- ----------
allapps allapps
a dict of all apps to process a dict of all apps to process
Returns Returns
------- -------
a list of all aliases corresponding to allapps a list of all aliases corresponding to allapps

View file

@ -130,7 +130,7 @@ def scan_binary(apkfile):
def scan_source(build_dir, build=metadata.Build()): def scan_source(build_dir, build=metadata.Build()):
"""Scan the source code in the given directory (and all subdirectories). """Scan the source code in the given directory (and all subdirectories).
Returns Returns
------- -------
the number of fatal problems encountered. the number of fatal problems encountered.
@ -198,7 +198,7 @@ def scan_source(build_dir, build=metadata.Build()):
Parameters Parameters
---------- ----------
what: string what: string
describing the problem, will be printed in log messages describing the problem, will be printed in log messages
path_in_build_dir path_in_build_dir
path to the file relative to `build`-dir path to the file relative to `build`-dir
@ -218,13 +218,13 @@ def scan_source(build_dir, build=metadata.Build()):
Parameters Parameters
---------- ----------
what: string what: string
describing the problem, will be printed in log messages describing the problem, will be printed in log messages
path_in_build_dir path_in_build_dir
path to the file relative to `build`-dir path to the file relative to `build`-dir
filepath filepath
Path (relative to our current path) to the file Path (relative to our current path) to the file
Returns Returns
------- -------
0 as we deleted the offending file 0 as we deleted the offending file
@ -247,7 +247,7 @@ def scan_source(build_dir, build=metadata.Build()):
Parameters Parameters
---------- ----------
what: string what: string
describing the problem, will be printed in log messages describing the problem, will be printed in log messages
path_in_build_dir path_in_build_dir
path to the file relative to `build`-dir path to the file relative to `build`-dir
@ -265,18 +265,18 @@ def scan_source(build_dir, build=metadata.Build()):
def handleproblem(what, path_in_build_dir, filepath): def handleproblem(what, path_in_build_dir, filepath):
"""Dispatches to problem handlers (ignore, delete, warn). """Dispatches to problem handlers (ignore, delete, warn).
Or returns 1 for increasing the error count. Or returns 1 for increasing the error count.
Parameters Parameters
---------- ----------
what: string what: string
describing the problem, will be printed in log messages describing the problem, will be printed in log messages
path_in_build_dir path_in_build_dir
path to the file relative to `build`-dir path to the file relative to `build`-dir
filepath filepath
Path (relative to our current path) to the file Path (relative to our current path) to the file
Returns Returns
------- -------
0 if the problem was ignored/deleted/is only a warning, 1 otherwise 0 if the problem was ignored/deleted/is only a warning, 1 otherwise

View file

@ -7,14 +7,14 @@ python-tail can be used to monitor changes to a file.
Example Example
------- -------
>>> import tail >>> import tail
>>> >>>
>>> # Create a tail instance >>> # Create a tail instance
>>> t = tail.Tail('file-to-be-followed') >>> t = tail.Tail('file-to-be-followed')
>>> >>>
>>> # Register a callback function to be called when a new line is found in the followed file. >>> # Register a callback function to be called when a new line is found in the followed file.
>>> # If no callback function is registerd, new lines would be printed to standard out. >>> # If no callback function is registerd, new lines would be printed to standard out.
>>> t.register_callback(callback_function) >>> t.register_callback(callback_function)
>>> >>>
>>> # Follow the file with 5 seconds as sleep time between iterations. >>> # Follow the file with 5 seconds as sleep time between iterations.
>>> # If sleep time is not provided 1 second is used as the default time. >>> # If sleep time is not provided 1 second is used as the default time.
>>> t.follow(s=5) >>> t.follow(s=5)
@ -67,7 +67,7 @@ class Tail(object):
def follow(self, s=1): def follow(self, s=1):
"""Do a tail follow. """Do a tail follow.
If a callback function is registered it is called with every new line. If a callback function is registered it is called with every new line.
Else printed to standard out. Else printed to standard out.

View file

@ -671,7 +671,7 @@ def has_known_vulnerability(filename):
def insert_obbs(repodir, apps, apks): def insert_obbs(repodir, apps, apks):
"""Scan the .obb files in a given repo directory and adds them to the relevant APK instances. """Scan the .obb files in a given repo directory and adds them to the relevant APK instances.
OBB files have versionCodes like APK OBB files have versionCodes like APK
files, and they are loosely associated. If there is an OBB file files, and they are loosely associated. If there is an OBB file
present, then any APK with the same or higher versionCode will use present, then any APK with the same or higher versionCode will use
@ -1950,7 +1950,7 @@ def fill_missing_icon_densities(empty_densities, icon_filename, apk, repo_dir):
def apply_info_from_latest_apk(apps, apks): def apply_info_from_latest_apk(apps, apks):
"""No summary. """No summary.
Some information from the apks needs to be applied up to the application level. Some information from the apks needs to be applied up to the application level.
When doing this, we use the info from the most recent version's apk. When doing this, we use the info from the most recent version's apk.
@ -2236,7 +2236,7 @@ def prepare_apps(apps, apks, repodir):
list of apks that belong into repo, this gets modified in place list of apks that belong into repo, this gets modified in place
repodir repodir
the target repository directory, metadata files will be copied here the target repository directory, metadata files will be copied here
Returns Returns
------- -------
the relevant subset of apps (as a deepcopy) the relevant subset of apps (as a deepcopy)

View file

@ -80,7 +80,7 @@ def _check_output(cmd, cwd=None):
def get_build_vm(srvdir, provider=None): def get_build_vm(srvdir, provider=None):
"""No summary. """No summary.
Factory function for getting FDroidBuildVm instances. Factory function for getting FDroidBuildVm instances.
This function tries to figure out what hypervisor should be used This function tries to figure out what hypervisor should be used