Skip to content
Snippets Groups Projects
Commit 220a30394e5d authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat: run flynt on the code base to convert everything into f-strings

parent 3f2e16ec343d
No related branches found
No related tags found
1 merge request!67feat: run flynt on the code base to convert everything into f-strings
Pipeline #195887 passed
......@@ -11,7 +11,7 @@
author = "LOGILAB S.A. (Paris, FRANCE)"
author_email = "contact@logilab.fr"
description = "Simple ElasticSearch indexing integration for CubicWeb"
web = "https://forge.extranet.logilab.fr/cubicweb/cubes/%s" % distname
web = f"https://forge.extranet.logilab.fr/cubicweb/cubes/{distname}"
__depends__ = {
"cubicweb": ">= 3.38.0, < 3.39.0",
......
......@@ -120,7 +120,7 @@
)
assert self.config.except_etypes not in etypes
if not self.config.etypes:
cnx.debug("found indexable types: {}".format(",".join(etypes)))
cnx.debug(f"found indexable types: {','.join(etypes)}")
for _ in parallel_bulk(
es,
self.bulk_actions(
......
......@@ -75,7 +75,7 @@
var = next(varmaker)
rql.append(f"{V} {attr} {var}")
selected.append(var)
return "Any {},{} {}".format(V, ",".join(selected), ",".join(rql))
return f"Any {V},{','.join(selected)} {','.join(rql)}"
def indexable_entities(cnx, etype, chunksize=100000):
......
......@@ -176,6 +176,6 @@
# TODO if no ES configuration, redirect or display warning
self.render_search_comp()
query_string = self._cw.form.get("q", self._cw.form.get("search", ""))
self.w("<h1>%s</h1>" % self._cw._(self.title))
self.w(f"<h1>{self._cw._(self.title)}</h1>")
response = self.do_search(query_string)
if response.hits.total.value:
......@@ -180,7 +180,7 @@
response = self.do_search(query_string)
if response.hits.total.value:
self.w("<h2>Resultats pour : <em>%s</em></h2>" % xml_escape(query_string))
self.w("Resultats: %s" % response.hits.total.value)
self.w(f"<h2>Resultats pour : <em>{xml_escape(query_string)}</em></h2>")
self.w(f"Resultats: {response.hits.total.value}")
if hasattr(response, "facets"):
self.display_facets(response)
self.display_results(response)
......@@ -226,5 +226,7 @@
)
self.customize_infos(infos)
try:
self.w('<a href="%(url)s">%(title)s</a> (%(_score).2f)<br/>' % (infos))
self.w(
f"<a href=\"{infos['url']}\">{infos['title']}</a> ({infos['_score']:.2f})<br/>"
)
if self._cw.form.get("debug-es"):
......@@ -230,3 +232,3 @@
if self._cw.form.get("debug-es"):
self.w(" [%(keys)s] <br/>" % infos)
self.w(f" [{infos['keys']}] <br/>")
except KeyError:
......@@ -232,4 +234,4 @@
except KeyError:
self.w("Missing key in : %s" % infos.keys())
self.w(f"Missing key in : {infos.keys()}")
try:
for fragment in result.meta.highlight.content:
......@@ -234,6 +236,6 @@
try:
for fragment in result.meta.highlight.content:
self.w("... %s" % BeautifulSoup(fragment, "lxml").get_text())
self.w(f"... {BeautifulSoup(fragment, 'lxml').get_text()}")
self.w(" ... <br/>")
except AttributeError:
pass
......
......@@ -50,9 +50,7 @@
requires = {}
for entry in ("__depends__",): # "__recommends__"):
requires.update(__pkginfo__.get(entry, {}))
install_requires = [
"{} {}".format(d, v and v or "").strip() for d, v in requires.items()
]
install_requires = [f"{d} {v and v or ''}".strip() for d, v in requires.items()]
setup(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment