3
0
Fork 0

fix: fix 'no-else-return' for pylint

This commit is contained in:
Lance Edgar 2025-08-31 20:20:01 -05:00
parent 6424432f1b
commit fdeb0eeeb2
4 changed files with 32 additions and 34 deletions

View file

@ -4,6 +4,7 @@
disable=all
enable=
inconsistent-return-statements,
no-else-return,
too-many-branches,
too-many-instance-attributes,
too-many-return-statements,

View file

@ -401,57 +401,57 @@ def get_liburl( # pylint: disable=too-many-return-statements,too-many-branches
return liburl + static.buefy_js.relpath
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"):
return liburl + static.buefy_css.relpath
return f"https://unpkg.com/buefy@{version}/dist/buefy.min.css"
elif key == "vue":
if key == "vue":
if static and hasattr(static, "vue_js"):
return liburl + static.vue_js.relpath
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"):
return liburl + static.vue_resource_js.relpath
return f"https://cdn.jsdelivr.net/npm/vue-resource@{version}"
elif key == "fontawesome":
if key == "fontawesome":
if static and hasattr(static, "fontawesome_js"):
return liburl + static.fontawesome_js.relpath
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"):
return liburl + static.bb_vue_js.relpath
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"):
return liburl + static.bb_oruga_js.relpath
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"):
return liburl + static.bb_oruga_bulma_js.relpath
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"):
return liburl + static.bb_oruga_bulma_css.relpath
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"):
return liburl + static.bb_fontawesome_svg_core_js.relpath
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"):
return liburl + static.bb_free_solid_svg_icons_js.relpath
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"):
return liburl + static.bb_vue_fontawesome_js.relpath
return (
@ -581,7 +581,7 @@ def make_json_safe(value, key=None, warn=True):
if value is colander.null:
return None
elif isinstance(value, dict):
if isinstance(value, dict):
# recursively convert dict
parent = dict(value)
for key, value in parent.items():

View file

@ -86,8 +86,7 @@ class AuthView(View):
headers = login_user(self.request, user)
return self.redirect(referrer, headers=headers)
else:
self.request.session.flash("Invalid user credentials", "error")
self.request.session.flash("Invalid user credentials", "error")
return {
"index_title": self.app.get_title(),

View file

@ -483,15 +483,15 @@ class MasterView(View):
context["pager_stats"] = grid.get_vue_pager_stats()
return self.json_response(context)
else: # full, not partial
# full, not partial
# nb. when user asks to reset view, it is via the query
# string. if so we then redirect to discard that.
if self.request.GET.get("reset-view"):
# nb. when user asks to reset view, it is via the query
# string. if so we then redirect to discard that.
if self.request.GET.get("reset-view"):
# nb. we want to preserve url hash if applicable
kw = {"_query": None, "_anchor": self.request.GET.get("hash")}
return self.redirect(self.request.current_route_url(**kw))
# nb. we want to preserve url hash if applicable
kw = {"_query": None, "_anchor": self.request.GET.get("hash")}
return self.redirect(self.request.current_route_url(**kw))
context["grid"] = grid
@ -801,19 +801,17 @@ class MasterView(View):
self.delete_bulk_action(data)
return self.redirect(self.get_index_url())
else:
# start thread for delete; show progress page
route_prefix = self.get_route_prefix()
key = f"{route_prefix}.delete_bulk"
progress = self.make_progress(key, success_url=self.get_index_url())
thread = threading.Thread(
target=self.delete_bulk_thread,
args=(data,),
kwargs={"progress": progress},
)
thread.start()
return self.render_progress(progress)
# start thread for delete; show progress page
route_prefix = self.get_route_prefix()
key = f"{route_prefix}.delete_bulk"
progress = self.make_progress(key, success_url=self.get_index_url())
thread = threading.Thread(
target=self.delete_bulk_thread,
args=(data,),
kwargs={"progress": progress},
)
thread.start()
return self.render_progress(progress)
def delete_bulk_thread(self, query, success_url=None, progress=None):
""" """