diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-12-27 09:26:22 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-12-27 09:26:22 +0100 |
commit | 3d96a9839a12649874b6d4cf9466bd3616b0a03c (patch) | |
tree | e7d54d1e345b1e792d538ddc250f4827bb2fd9b9 /searx/engines/pdbe.py | |
parent | fcdc2c2cd26e24c2aa3f064d93cee3e29dc2a30c (diff) | |
download | searxng-3d96a9839a12649874b6d4cf9466bd3616b0a03c.tar.gz searxng-3d96a9839a12649874b6d4cf9466bd3616b0a03c.zip |
[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>
Diffstat (limited to 'searx/engines/pdbe.py')
-rw-r--r-- | searx/engines/pdbe.py | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/searx/engines/pdbe.py b/searx/engines/pdbe.py index b9bbfaf1b..34c8d3227 100644 --- a/searx/engines/pdbe.py +++ b/searx/engines/pdbe.py @@ -34,10 +34,7 @@ def request(query, params): params['url'] = pdbe_solr_url params['method'] = 'POST' - params['data'] = { - 'q': query, - 'wt': "json" # request response in parsable format - } + params['data'] = {'q': query, 'wt': "json"} # request response in parsable format return params @@ -53,12 +50,21 @@ def construct_body(result): if result['journal']: content = content.format( title=result['citation_title'], - authors=result['entry_author_list'][0], journal=result['journal'], volume=result['journal_volume'], - page=result['journal_page'], year=result['citation_year']) + authors=result['entry_author_list'][0], + journal=result['journal'], + volume=result['journal_volume'], + page=result['journal_page'], + year=result['citation_year'], + ) else: content = content.format( title=result['citation_title'], - authors=result['entry_author_list'][0], journal='', volume='', page='', year=result['release_year']) + authors=result['entry_author_list'][0], + journal='', + volume='', + page='', + year=result['release_year'], + ) img_src = pdbe_preview_url.format(pdb_id=result['pdb_id']) except (KeyError): content = None @@ -96,20 +102,21 @@ def response(resp): # since we can't construct a proper body from the response, we'll make up our own msg_superseded = gettext("This entry has been superseded by") content = '{msg_superseded}: {url} ({pdb_id})'.format( - msg_superseded=msg_superseded, - url=superseded_url, - pdb_id=result['superseded_by']) + msg_superseded=msg_superseded, url=superseded_url, pdb_id=result['superseded_by'] + ) # obsoleted entries don't have preview images img_src = None else: title, content, img_src = construct_body(result) - results.append({ - 'url': pdbe_entry_url.format(pdb_id=result['pdb_id']), - 'title': title, - 'content': content, - 'img_src': img_src - }) + results.append( + { + 'url': pdbe_entry_url.format(pdb_id=result['pdb_id']), + 'title': title, + 'content': content, + 'img_src': img_src, + } + ) return results |