[format.python] initial formatting of the python code

This patch was generated by black [1]::

    make format.python

[1] https://github.com/psf/black

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-12-27 09:26:22 +01:00
parent fcdc2c2cd2
commit 3d96a9839a
184 changed files with 2800 additions and 2836 deletions

View file

@ -35,10 +35,12 @@ api_key = ''
# https://newznab.readthedocs.io/en/latest/misc/api/#predefined-categories
torznab_categories = []
def init(engine_settings=None): # pylint: disable=unused-argument
def init(engine_settings=None): # pylint: disable=unused-argument
if len(base_url) < 1:
raise ValueError('missing torznab base_url')
def request(query, params):
search_url = base_url + '?t=search&q={search_query}'
@ -48,13 +50,12 @@ def request(query, params):
search_url += '&cat={torznab_categories}'
params['url'] = search_url.format(
search_query = quote(query),
api_key = api_key,
torznab_categories = ",".join([str(x) for x in torznab_categories])
search_query=quote(query), api_key=api_key, torznab_categories=",".join([str(x) for x in torznab_categories])
)
return params
def response(resp):
results = []
@ -103,8 +104,7 @@ def response(resp):
result["publishedDate"] = None
try:
result["publishedDate"] = datetime.strptime(
get_property(item, 'pubDate'), '%a, %d %b %Y %H:%M:%S %z')
result["publishedDate"] = datetime.strptime(get_property(item, 'pubDate'), '%a, %d %b %Y %H:%M:%S %z')
except (ValueError, TypeError) as e:
logger.debug("ignore exception (publishedDate): %s", e)
@ -134,9 +134,7 @@ def get_property(item, property_name):
def get_torznab_attr(item, attr_name):
element = item.find(
'.//torznab:attr[@name="{attr_name}"]'.format(attr_name=attr_name),
{
'torznab': 'http://torznab.com/schemas/2015/feed'
}
{'torznab': 'http://torznab.com/schemas/2015/feed'},
)
if element is not None: