fix: fix 'no-else-return' for pylint
This commit is contained in:
parent
6424432f1b
commit
fdeb0eeeb2
4 changed files with 32 additions and 34 deletions
|
@ -4,6 +4,7 @@
|
||||||
disable=all
|
disable=all
|
||||||
enable=
|
enable=
|
||||||
inconsistent-return-statements,
|
inconsistent-return-statements,
|
||||||
|
no-else-return,
|
||||||
too-many-branches,
|
too-many-branches,
|
||||||
too-many-instance-attributes,
|
too-many-instance-attributes,
|
||||||
too-many-return-statements,
|
too-many-return-statements,
|
||||||
|
|
|
@ -401,57 +401,57 @@ def get_liburl( # pylint: disable=too-many-return-statements,too-many-branches
|
||||||
return liburl + static.buefy_js.relpath
|
return liburl + static.buefy_js.relpath
|
||||||
return f"https://unpkg.com/buefy@{version}/dist/buefy.min.js"
|
return f"https://unpkg.com/buefy@{version}/dist/buefy.min.js"
|
||||||
|
|
||||||
elif key == "buefy.css":
|
if key == "buefy.css":
|
||||||
if static and hasattr(static, "buefy_css"):
|
if static and hasattr(static, "buefy_css"):
|
||||||
return liburl + static.buefy_css.relpath
|
return liburl + static.buefy_css.relpath
|
||||||
return f"https://unpkg.com/buefy@{version}/dist/buefy.min.css"
|
return f"https://unpkg.com/buefy@{version}/dist/buefy.min.css"
|
||||||
|
|
||||||
elif key == "vue":
|
if key == "vue":
|
||||||
if static and hasattr(static, "vue_js"):
|
if static and hasattr(static, "vue_js"):
|
||||||
return liburl + static.vue_js.relpath
|
return liburl + static.vue_js.relpath
|
||||||
return f"https://unpkg.com/vue@{version}/dist/vue.min.js"
|
return f"https://unpkg.com/vue@{version}/dist/vue.min.js"
|
||||||
|
|
||||||
elif key == "vue_resource":
|
if key == "vue_resource":
|
||||||
if static and hasattr(static, "vue_resource_js"):
|
if static and hasattr(static, "vue_resource_js"):
|
||||||
return liburl + static.vue_resource_js.relpath
|
return liburl + static.vue_resource_js.relpath
|
||||||
return f"https://cdn.jsdelivr.net/npm/vue-resource@{version}"
|
return f"https://cdn.jsdelivr.net/npm/vue-resource@{version}"
|
||||||
|
|
||||||
elif key == "fontawesome":
|
if key == "fontawesome":
|
||||||
if static and hasattr(static, "fontawesome_js"):
|
if static and hasattr(static, "fontawesome_js"):
|
||||||
return liburl + static.fontawesome_js.relpath
|
return liburl + static.fontawesome_js.relpath
|
||||||
return f"https://use.fontawesome.com/releases/v{version}/js/all.js"
|
return f"https://use.fontawesome.com/releases/v{version}/js/all.js"
|
||||||
|
|
||||||
elif key == "bb_vue":
|
if key == "bb_vue":
|
||||||
if static and hasattr(static, "bb_vue_js"):
|
if static and hasattr(static, "bb_vue_js"):
|
||||||
return liburl + static.bb_vue_js.relpath
|
return liburl + static.bb_vue_js.relpath
|
||||||
return f"https://unpkg.com/vue@{version}/dist/vue.esm-browser.prod.js"
|
return f"https://unpkg.com/vue@{version}/dist/vue.esm-browser.prod.js"
|
||||||
|
|
||||||
elif key == "bb_oruga":
|
if key == "bb_oruga":
|
||||||
if static and hasattr(static, "bb_oruga_js"):
|
if static and hasattr(static, "bb_oruga_js"):
|
||||||
return liburl + static.bb_oruga_js.relpath
|
return liburl + static.bb_oruga_js.relpath
|
||||||
return f"https://unpkg.com/@oruga-ui/oruga-next@{version}/dist/oruga.mjs"
|
return f"https://unpkg.com/@oruga-ui/oruga-next@{version}/dist/oruga.mjs"
|
||||||
|
|
||||||
elif key == "bb_oruga_bulma":
|
if key == "bb_oruga_bulma":
|
||||||
if static and hasattr(static, "bb_oruga_bulma_js"):
|
if static and hasattr(static, "bb_oruga_bulma_js"):
|
||||||
return liburl + static.bb_oruga_bulma_js.relpath
|
return liburl + static.bb_oruga_bulma_js.relpath
|
||||||
return f"https://unpkg.com/@oruga-ui/theme-bulma@{version}/dist/bulma.js"
|
return f"https://unpkg.com/@oruga-ui/theme-bulma@{version}/dist/bulma.js"
|
||||||
|
|
||||||
elif key == "bb_oruga_bulma_css":
|
if key == "bb_oruga_bulma_css":
|
||||||
if static and hasattr(static, "bb_oruga_bulma_css"):
|
if static and hasattr(static, "bb_oruga_bulma_css"):
|
||||||
return liburl + static.bb_oruga_bulma_css.relpath
|
return liburl + static.bb_oruga_bulma_css.relpath
|
||||||
return f"https://unpkg.com/@oruga-ui/theme-bulma@{version}/dist/bulma.css"
|
return f"https://unpkg.com/@oruga-ui/theme-bulma@{version}/dist/bulma.css"
|
||||||
|
|
||||||
elif key == "bb_fontawesome_svg_core":
|
if key == "bb_fontawesome_svg_core":
|
||||||
if static and hasattr(static, "bb_fontawesome_svg_core_js"):
|
if static and hasattr(static, "bb_fontawesome_svg_core_js"):
|
||||||
return liburl + static.bb_fontawesome_svg_core_js.relpath
|
return liburl + static.bb_fontawesome_svg_core_js.relpath
|
||||||
return f"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-svg-core@{version}/+esm"
|
return f"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-svg-core@{version}/+esm"
|
||||||
|
|
||||||
elif key == "bb_free_solid_svg_icons":
|
if key == "bb_free_solid_svg_icons":
|
||||||
if static and hasattr(static, "bb_free_solid_svg_icons_js"):
|
if static and hasattr(static, "bb_free_solid_svg_icons_js"):
|
||||||
return liburl + static.bb_free_solid_svg_icons_js.relpath
|
return liburl + static.bb_free_solid_svg_icons_js.relpath
|
||||||
return f"https://cdn.jsdelivr.net/npm/@fortawesome/free-solid-svg-icons@{version}/+esm"
|
return f"https://cdn.jsdelivr.net/npm/@fortawesome/free-solid-svg-icons@{version}/+esm"
|
||||||
|
|
||||||
elif key == "bb_vue_fontawesome":
|
if key == "bb_vue_fontawesome":
|
||||||
if static and hasattr(static, "bb_vue_fontawesome_js"):
|
if static and hasattr(static, "bb_vue_fontawesome_js"):
|
||||||
return liburl + static.bb_vue_fontawesome_js.relpath
|
return liburl + static.bb_vue_fontawesome_js.relpath
|
||||||
return (
|
return (
|
||||||
|
@ -581,7 +581,7 @@ def make_json_safe(value, key=None, warn=True):
|
||||||
if value is colander.null:
|
if value is colander.null:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
elif isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
# recursively convert dict
|
# recursively convert dict
|
||||||
parent = dict(value)
|
parent = dict(value)
|
||||||
for key, value in parent.items():
|
for key, value in parent.items():
|
||||||
|
|
|
@ -86,8 +86,7 @@ class AuthView(View):
|
||||||
headers = login_user(self.request, user)
|
headers = login_user(self.request, user)
|
||||||
return self.redirect(referrer, headers=headers)
|
return self.redirect(referrer, headers=headers)
|
||||||
|
|
||||||
else:
|
self.request.session.flash("Invalid user credentials", "error")
|
||||||
self.request.session.flash("Invalid user credentials", "error")
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"index_title": self.app.get_title(),
|
"index_title": self.app.get_title(),
|
||||||
|
|
|
@ -483,15 +483,15 @@ class MasterView(View):
|
||||||
context["pager_stats"] = grid.get_vue_pager_stats()
|
context["pager_stats"] = grid.get_vue_pager_stats()
|
||||||
return self.json_response(context)
|
return self.json_response(context)
|
||||||
|
|
||||||
else: # full, not partial
|
# full, not partial
|
||||||
|
|
||||||
# nb. when user asks to reset view, it is via the query
|
# nb. when user asks to reset view, it is via the query
|
||||||
# string. if so we then redirect to discard that.
|
# string. if so we then redirect to discard that.
|
||||||
if self.request.GET.get("reset-view"):
|
if self.request.GET.get("reset-view"):
|
||||||
|
|
||||||
# nb. we want to preserve url hash if applicable
|
# nb. we want to preserve url hash if applicable
|
||||||
kw = {"_query": None, "_anchor": self.request.GET.get("hash")}
|
kw = {"_query": None, "_anchor": self.request.GET.get("hash")}
|
||||||
return self.redirect(self.request.current_route_url(**kw))
|
return self.redirect(self.request.current_route_url(**kw))
|
||||||
|
|
||||||
context["grid"] = grid
|
context["grid"] = grid
|
||||||
|
|
||||||
|
@ -801,19 +801,17 @@ class MasterView(View):
|
||||||
self.delete_bulk_action(data)
|
self.delete_bulk_action(data)
|
||||||
return self.redirect(self.get_index_url())
|
return self.redirect(self.get_index_url())
|
||||||
|
|
||||||
else:
|
# start thread for delete; show progress page
|
||||||
|
route_prefix = self.get_route_prefix()
|
||||||
# start thread for delete; show progress page
|
key = f"{route_prefix}.delete_bulk"
|
||||||
route_prefix = self.get_route_prefix()
|
progress = self.make_progress(key, success_url=self.get_index_url())
|
||||||
key = f"{route_prefix}.delete_bulk"
|
thread = threading.Thread(
|
||||||
progress = self.make_progress(key, success_url=self.get_index_url())
|
target=self.delete_bulk_thread,
|
||||||
thread = threading.Thread(
|
args=(data,),
|
||||||
target=self.delete_bulk_thread,
|
kwargs={"progress": progress},
|
||||||
args=(data,),
|
)
|
||||||
kwargs={"progress": progress},
|
thread.start()
|
||||||
)
|
return self.render_progress(progress)
|
||||||
thread.start()
|
|
||||||
return self.render_progress(progress)
|
|
||||||
|
|
||||||
def delete_bulk_thread(self, query, success_url=None, progress=None):
|
def delete_bulk_thread(self, query, success_url=None, progress=None):
|
||||||
""" """
|
""" """
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue