fix: fix 'arguments-renamed' for pylint
This commit is contained in:
parent
459c16ba4f
commit
92754a64c4
10 changed files with 72 additions and 37 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=fixme,
|
disable=fixme,
|
||||||
arguments-renamed,
|
|
||||||
attribute-defined-outside-init,
|
attribute-defined-outside-init,
|
||||||
duplicate-code,
|
duplicate-code,
|
||||||
no-member,
|
no-member,
|
||||||
|
|
|
@ -472,8 +472,9 @@ class PersonRef(ObjectRef):
|
||||||
""" """
|
""" """
|
||||||
return query.order_by(self.model_class.full_name)
|
return query.order_by(self.model_class.full_name)
|
||||||
|
|
||||||
def get_object_url(self, person): # pylint: disable=empty-docstring
|
def get_object_url(self, obj): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
person = obj
|
||||||
return self.request.route_url("people.view", uuid=person.uuid)
|
return self.request.route_url("people.view", uuid=person.uuid)
|
||||||
|
|
||||||
|
|
||||||
|
@ -496,8 +497,9 @@ class RoleRef(ObjectRef):
|
||||||
""" """
|
""" """
|
||||||
return query.order_by(self.model_class.name)
|
return query.order_by(self.model_class.name)
|
||||||
|
|
||||||
def get_object_url(self, role): # pylint: disable=empty-docstring
|
def get_object_url(self, obj): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
role = obj
|
||||||
return self.request.route_url("roles.view", uuid=role.uuid)
|
return self.request.route_url("roles.view", uuid=role.uuid)
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,8 +522,9 @@ class UserRef(ObjectRef):
|
||||||
""" """
|
""" """
|
||||||
return query.order_by(self.model_class.username)
|
return query.order_by(self.model_class.username)
|
||||||
|
|
||||||
def get_object_url(self, user): # pylint: disable=empty-docstring
|
def get_object_url(self, obj): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
user = obj
|
||||||
return self.request.route_url("users.view", uuid=user.uuid)
|
return self.request.route_url("users.view", uuid=user.uuid)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,8 +121,9 @@ class BatchMasterView(MasterView):
|
||||||
|
|
||||||
return super().render_to_response(template, context)
|
return super().render_to_response(template, context)
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
model = self.app.model
|
model = self.app.model
|
||||||
|
|
||||||
|
@ -153,15 +154,17 @@ class BatchMasterView(MasterView):
|
||||||
return f"{batch_id:08d}"
|
return f"{batch_id:08d}"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_instance_title(self, batch): # pylint: disable=empty-docstring
|
def get_instance_title(self, instance): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
batch = instance
|
||||||
if batch.description:
|
if batch.description:
|
||||||
return f"{batch.id_str} {batch.description}"
|
return f"{batch.id_str} {batch.description}"
|
||||||
return batch.id_str
|
return batch.id_str
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=too-many-branches,empty-docstring
|
def configure_form(self, form): # pylint: disable=too-many-branches,empty-docstring
|
||||||
""" """
|
""" """
|
||||||
super().configure_form(f)
|
super().configure_form(form)
|
||||||
|
f = form
|
||||||
batch = f.model_instance
|
batch = f.model_instance
|
||||||
|
|
||||||
# id
|
# id
|
||||||
|
@ -253,7 +256,7 @@ class BatchMasterView(MasterView):
|
||||||
# when not creating, normal logic is fine
|
# when not creating, normal logic is fine
|
||||||
return super().objectify(form)
|
return super().objectify(form)
|
||||||
|
|
||||||
def redirect_after_create(self, batch):
|
def redirect_after_create(self, obj):
|
||||||
"""
|
"""
|
||||||
If the new batch requires initial population, we launch a
|
If the new batch requires initial population, we launch a
|
||||||
thread for that and show the "progress" page.
|
thread for that and show the "progress" page.
|
||||||
|
@ -261,6 +264,8 @@ class BatchMasterView(MasterView):
|
||||||
Otherwise this will do the normal thing of redirecting to the
|
Otherwise this will do the normal thing of redirecting to the
|
||||||
"view" page for the new batch.
|
"view" page for the new batch.
|
||||||
"""
|
"""
|
||||||
|
batch = obj
|
||||||
|
|
||||||
# just view batch if should not populate
|
# just view batch if should not populate
|
||||||
if not self.batch_handler.should_populate(batch):
|
if not self.batch_handler.should_populate(batch):
|
||||||
return self.redirect(self.get_action_url("view", batch))
|
return self.redirect(self.get_action_url("view", batch))
|
||||||
|
@ -281,7 +286,7 @@ class BatchMasterView(MasterView):
|
||||||
thread.start()
|
thread.start()
|
||||||
return self.render_progress(progress)
|
return self.render_progress(progress)
|
||||||
|
|
||||||
def delete_instance(self, batch):
|
def delete_instance(self, obj):
|
||||||
"""
|
"""
|
||||||
Delete the given batch instance.
|
Delete the given batch instance.
|
||||||
|
|
||||||
|
@ -289,6 +294,7 @@ class BatchMasterView(MasterView):
|
||||||
:meth:`~wuttjamaican:wuttjamaican.batch.BatchHandler.do_delete()`
|
:meth:`~wuttjamaican:wuttjamaican.batch.BatchHandler.do_delete()`
|
||||||
on the :attr:`batch_handler`.
|
on the :attr:`batch_handler`.
|
||||||
"""
|
"""
|
||||||
|
batch = obj
|
||||||
self.batch_handler.do_delete(batch, self.request.user)
|
self.batch_handler.do_delete(batch, self.request.user)
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
|
@ -386,20 +392,22 @@ class BatchMasterView(MasterView):
|
||||||
model_class = cls.get_model_class()
|
model_class = cls.get_model_class()
|
||||||
return model_class.__row_class__
|
return model_class.__row_class__
|
||||||
|
|
||||||
def get_row_grid_data(self, batch):
|
def get_row_grid_data(self, obj):
|
||||||
"""
|
"""
|
||||||
Returns the base query for the batch
|
Returns the base query for the batch
|
||||||
:attr:`~wuttjamaican:wuttjamaican.db.model.batch.BatchMixin.rows`
|
:attr:`~wuttjamaican:wuttjamaican.db.model.batch.BatchMixin.rows`
|
||||||
data.
|
data.
|
||||||
"""
|
"""
|
||||||
|
batch = obj
|
||||||
row_model_class = self.get_row_model_class()
|
row_model_class = self.get_row_model_class()
|
||||||
query = self.Session.query(row_model_class).filter(
|
query = self.Session.query(row_model_class).filter(
|
||||||
row_model_class.batch == batch
|
row_model_class.batch == batch
|
||||||
)
|
)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def configure_row_grid(self, g): # pylint: disable=empty-docstring
|
def configure_row_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_row_grid(g)
|
super().configure_row_grid(g)
|
||||||
|
|
||||||
g.set_label("sequence", "Seq.", column_only=True)
|
g.set_label("sequence", "Seq.", column_only=True)
|
||||||
|
|
|
@ -107,8 +107,9 @@ class EmailSettingView(MasterView): # pylint: disable=abstract-method
|
||||||
"enabled": self.email_handler.is_enabled(key),
|
"enabled": self.email_handler.is_enabled(key),
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
|
||||||
# key
|
# key
|
||||||
|
@ -147,12 +148,14 @@ class EmailSettingView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
raise self.notfound()
|
raise self.notfound()
|
||||||
|
|
||||||
def get_instance_title(self, setting): # pylint: disable=empty-docstring
|
def get_instance_title(self, instance): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
setting = instance
|
||||||
return setting["subject"]
|
return setting["subject"]
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
|
|
||||||
# description
|
# description
|
||||||
|
|
|
@ -70,8 +70,9 @@ class PersonView(MasterView): # pylint: disable=abstract-method
|
||||||
"users",
|
"users",
|
||||||
]
|
]
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
|
||||||
# full_name
|
# full_name
|
||||||
|
@ -83,8 +84,9 @@ class PersonView(MasterView): # pylint: disable=abstract-method
|
||||||
# last_name
|
# last_name
|
||||||
g.set_link("last_name")
|
g.set_link("last_name")
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
person = f.model_instance
|
person = f.model_instance
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,9 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
||||||
"help_text": report.__doc__,
|
"help_text": report.__doc__,
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
|
||||||
# report_key
|
# report_key
|
||||||
|
@ -114,8 +115,9 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
raise self.notfound()
|
raise self.notfound()
|
||||||
|
|
||||||
def get_instance_title(self, report): # pylint: disable=empty-docstring
|
def get_instance_title(self, instance): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
report = instance
|
||||||
return report["report_title"]
|
return report["report_title"]
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
|
@ -153,8 +155,9 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return self.render_to_response("view", context)
|
return self.render_to_response("view", context)
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
key = self.request.matchdict["report_key"]
|
key = self.request.matchdict["report_key"]
|
||||||
report = self.report_handler.get_report(key)
|
report = self.report_handler.get_report(key)
|
||||||
|
|
|
@ -65,8 +65,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
||||||
query = super().get_query(session=session)
|
query = super().get_query(session=session)
|
||||||
return query.order_by(model.Role.name)
|
return query.order_by(model.Role.name)
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
|
||||||
# name
|
# name
|
||||||
|
@ -75,8 +76,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
||||||
# notes
|
# notes
|
||||||
g.set_renderer("notes", self.grid_render_notes)
|
g.set_renderer("notes", self.grid_render_notes)
|
||||||
|
|
||||||
def is_editable(self, role): # pylint: disable=empty-docstring
|
def is_editable(self, obj): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
role = obj
|
||||||
session = self.app.get_session(role)
|
session = self.app.get_session(role)
|
||||||
auth = self.app.get_auth_handler()
|
auth = self.app.get_auth_handler()
|
||||||
|
|
||||||
|
@ -93,8 +95,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_deletable(self, role): # pylint: disable=empty-docstring
|
def is_deletable(self, obj): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
role = obj
|
||||||
session = self.app.get_session(role)
|
session = self.app.get_session(role)
|
||||||
auth = self.app.get_auth_handler()
|
auth = self.app.get_auth_handler()
|
||||||
|
|
||||||
|
@ -108,8 +111,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
role = f.model_instance
|
role = f.model_instance
|
||||||
|
|
||||||
|
@ -356,8 +360,9 @@ class PermissionView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
model = self.app.model
|
model = self.app.model
|
||||||
|
|
||||||
|
@ -369,8 +374,9 @@ class PermissionView(MasterView): # pylint: disable=abstract-method
|
||||||
# permission
|
# permission
|
||||||
g.set_link("permission")
|
g.set_link("permission")
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
|
|
||||||
# role
|
# role
|
||||||
|
|
|
@ -93,8 +93,9 @@ class AppInfoView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
|
||||||
g.sort_multiple = False
|
g.sort_multiple = False
|
||||||
|
@ -244,15 +245,17 @@ class SettingView(MasterView): # pylint: disable=abstract-method
|
||||||
sort_defaults = "name"
|
sort_defaults = "name"
|
||||||
|
|
||||||
# TODO: master should handle this (per model key)
|
# TODO: master should handle this (per model key)
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
|
||||||
# name
|
# name
|
||||||
g.set_link("name")
|
g.set_link("name")
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
|
|
||||||
# name
|
# name
|
||||||
|
|
|
@ -72,8 +72,9 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
sort_defaults = ("created", "desc")
|
sort_defaults = ("created", "desc")
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
model = self.app.model
|
model = self.app.model
|
||||||
enum = self.app.enum
|
enum = self.app.enum
|
||||||
|
@ -121,8 +122,9 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
||||||
return "has-background-warning"
|
return "has-background-warning"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
enum = self.app.enum
|
enum = self.app.enum
|
||||||
upgrade = f.model_instance
|
upgrade = f.model_instance
|
||||||
|
@ -204,11 +206,12 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
||||||
"stderr_file", self.get_upgrade_filepath(upgrade, "stderr.log")
|
"stderr_file", self.get_upgrade_filepath(upgrade, "stderr.log")
|
||||||
)
|
)
|
||||||
|
|
||||||
def delete_instance(self, upgrade):
|
def delete_instance(self, obj):
|
||||||
"""
|
"""
|
||||||
We override this method to delete any files associated with
|
We override this method to delete any files associated with
|
||||||
the upgrade, in addition to deleting the upgrade proper.
|
the upgrade, in addition to deleting the upgrade proper.
|
||||||
"""
|
"""
|
||||||
|
upgrade = obj
|
||||||
path = self.get_upgrade_filepath(upgrade, create=False)
|
path = self.get_upgrade_filepath(upgrade, create=False)
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
@ -227,8 +230,9 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return upgrade
|
return upgrade
|
||||||
|
|
||||||
def download_path(self, upgrade, filename): # pylint: disable=empty-docstring
|
def download_path(self, obj, filename): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
upgrade = obj
|
||||||
if filename:
|
if filename:
|
||||||
return self.get_upgrade_filepath(upgrade, filename)
|
return self.get_upgrade_filepath(upgrade, filename)
|
||||||
return None
|
return None
|
||||||
|
@ -245,7 +249,7 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
||||||
path = os.path.join(path, filename)
|
path = os.path.join(path, filename)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def execute_instance(self, upgrade, user, progress=None):
|
def execute_instance(self, obj, user, progress=None):
|
||||||
"""
|
"""
|
||||||
This method runs the actual upgrade.
|
This method runs the actual upgrade.
|
||||||
|
|
||||||
|
@ -258,6 +262,7 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
||||||
The upgrade itself is marked as "executed" with status of
|
The upgrade itself is marked as "executed" with status of
|
||||||
either ``SUCCESS`` or ``FAILURE``.
|
either ``SUCCESS`` or ``FAILURE``.
|
||||||
"""
|
"""
|
||||||
|
upgrade = obj
|
||||||
enum = self.app.enum
|
enum = self.app.enum
|
||||||
|
|
||||||
# locate file paths
|
# locate file paths
|
||||||
|
|
|
@ -82,8 +82,9 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
g = grid
|
||||||
super().configure_grid(g)
|
super().configure_grid(g)
|
||||||
model = self.app.model
|
model = self.app.model
|
||||||
|
|
||||||
|
@ -106,8 +107,9 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
||||||
return "has-background-warning"
|
return "has-background-warning"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def is_editable(self, user): # pylint: disable=empty-docstring
|
def is_editable(self, obj): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
user = obj
|
||||||
|
|
||||||
# only root can edit certain users
|
# only root can edit certain users
|
||||||
if user.prevent_edit and not self.request.is_root:
|
if user.prevent_edit and not self.request.is_root:
|
||||||
|
@ -115,8 +117,9 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||||
""" """
|
""" """
|
||||||
|
f = form
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
user = f.model_instance
|
user = f.model_instance
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue