fix pydocstyle lint errors

This commit is contained in:
Michael Pöhn 2022-09-30 06:08:00 +02:00
parent 036b788424
commit 7933623e93
2 changed files with 14 additions and 22 deletions

View file

@ -325,10 +325,7 @@ def fill_config_defaults(thisconfig):
def get_config(opts=None): def get_config(opts=None):
""" """Get config instace. This function takes care of initaling config data before returning it."""
helper function for getting access to commons.config while safely
initializing if it wasn't initialized yet.
"""
global config, options global config, options
if config is not None: if config is not None:

View file

@ -113,16 +113,12 @@ def get_embedded_classes(apkfile, depth=0):
def _datetime_now(): def _datetime_now():
""" """Get datetime.now(), using this funciton allows mocking it for testing."""
simple wrapper for datetime.now to allow mocking it for testing
"""
return datetime.now().astimezone() return datetime.now().astimezone()
def _scanner_cachedir(): def _scanner_cachedir():
""" """Get `Path` to fdroidserver cache dir."""
get `Path` to local cache dir
"""
cfg = common.get_config() cfg = common.get_config()
if not cfg: if not cfg:
raise ConfigurationException('config not initialized') raise ConfigurationException('config not initialized')
@ -163,17 +159,14 @@ class SignatureDataController:
raise SignatureDataVersionMismatchException() raise SignatureDataVersionMismatchException()
def check_last_updated(self): def check_last_updated(self):
''' """
NOTE: currently not in use Check if the last_updated value is ok and raise an exception if expired or inaccessible.
Checks if the last_updated value is ok. Raises an exception if
it's expired or inaccessible.
:raises SignatureDataMalformedException: when timestamp value is :raises SignatureDataMalformedException: when timestamp value is
inaccessible or not parse-able inaccessible or not parse-able
:raises SignatureDataOutdatedException: when timestamp is older then :raises SignatureDataOutdatedException: when timestamp is older then
`self.cache_duration` `self.cache_duration`
''' """
last_updated = self.data.get("last_updated", None) last_updated = self.data.get("last_updated", None)
if last_updated: if last_updated:
try: try:
@ -233,9 +226,11 @@ class SignatureDataController:
logging.debug("write '{}' to cache".format(self.filename)) logging.debug("write '{}' to cache".format(self.filename))
def verify_data(self): def verify_data(self):
''' """
cleans and validates and cleans `self.data` Clean and validate `self.data`.
'''
Right now this function does just a basic key sanitation.
"""
self.check_data_version() self.check_data_version()
valid_keys = ['timestamp', 'last_updated', 'version', 'signatures', 'cache_duration'] valid_keys = ['timestamp', 'last_updated', 'version', 'signatures', 'cache_duration']
@ -351,11 +346,11 @@ _SCANNER_TOOL = None
def _get_tool(): def _get_tool():
''' """
lazy loading factory for ScannerTool singleton Lazy loading function for getting a ScannerTool instance.
ScannerTool initialization need to access `common.config` values. Those are only available after initialization through `common.read_config()` So this factory assumes config was called at an erlier point in time ScannerTool initialization need to access `common.config` values. Those are only available after initialization through `common.read_config()` So this factory assumes config was called at an erlier point in time
''' """
if not scanner._SCANNER_TOOL: if not scanner._SCANNER_TOOL:
scanner._SCANNER_TOOL = ScannerTool() scanner._SCANNER_TOOL = ScannerTool()
return scanner._SCANNER_TOOL return scanner._SCANNER_TOOL