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]
|
||||
disable=fixme,
|
||||
arguments-renamed,
|
||||
attribute-defined-outside-init,
|
||||
duplicate-code,
|
||||
no-member,
|
||||
|
|
|
@ -472,8 +472,9 @@ class PersonRef(ObjectRef):
|
|||
""" """
|
||||
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)
|
||||
|
||||
|
||||
|
@ -496,8 +497,9 @@ class RoleRef(ObjectRef):
|
|||
""" """
|
||||
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)
|
||||
|
||||
|
||||
|
@ -520,8 +522,9 @@ class UserRef(ObjectRef):
|
|||
""" """
|
||||
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)
|
||||
|
||||
|
||||
|
|
|
@ -121,8 +121,9 @@ class BatchMasterView(MasterView):
|
|||
|
||||
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)
|
||||
model = self.app.model
|
||||
|
||||
|
@ -153,15 +154,17 @@ class BatchMasterView(MasterView):
|
|||
return f"{batch_id:08d}"
|
||||
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:
|
||||
return f"{batch.id_str} {batch.description}"
|
||||
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
|
||||
|
||||
# id
|
||||
|
@ -253,7 +256,7 @@ class BatchMasterView(MasterView):
|
|||
# when not creating, normal logic is fine
|
||||
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
|
||||
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
|
||||
"view" page for the new batch.
|
||||
"""
|
||||
batch = obj
|
||||
|
||||
# just view batch if should not populate
|
||||
if not self.batch_handler.should_populate(batch):
|
||||
return self.redirect(self.get_action_url("view", batch))
|
||||
|
@ -281,7 +286,7 @@ class BatchMasterView(MasterView):
|
|||
thread.start()
|
||||
return self.render_progress(progress)
|
||||
|
||||
def delete_instance(self, batch):
|
||||
def delete_instance(self, obj):
|
||||
"""
|
||||
Delete the given batch instance.
|
||||
|
||||
|
@ -289,6 +294,7 @@ class BatchMasterView(MasterView):
|
|||
:meth:`~wuttjamaican:wuttjamaican.batch.BatchHandler.do_delete()`
|
||||
on the :attr:`batch_handler`.
|
||||
"""
|
||||
batch = obj
|
||||
self.batch_handler.do_delete(batch, self.request.user)
|
||||
|
||||
##############################
|
||||
|
@ -386,20 +392,22 @@ class BatchMasterView(MasterView):
|
|||
model_class = cls.get_model_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
|
||||
:attr:`~wuttjamaican:wuttjamaican.db.model.batch.BatchMixin.rows`
|
||||
data.
|
||||
"""
|
||||
batch = obj
|
||||
row_model_class = self.get_row_model_class()
|
||||
query = self.Session.query(row_model_class).filter(
|
||||
row_model_class.batch == batch
|
||||
)
|
||||
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)
|
||||
|
||||
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),
|
||||
}
|
||||
|
||||
def configure_grid(self, g): # pylint: disable=empty-docstring
|
||||
def configure_grid(self, grid): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
g = grid
|
||||
super().configure_grid(g)
|
||||
|
||||
# key
|
||||
|
@ -147,12 +148,14 @@ class EmailSettingView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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"]
|
||||
|
||||
def configure_form(self, f): # pylint: disable=empty-docstring
|
||||
def configure_form(self, form): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
f = form
|
||||
super().configure_form(f)
|
||||
|
||||
# description
|
||||
|
|
|
@ -70,8 +70,9 @@ class PersonView(MasterView): # pylint: disable=abstract-method
|
|||
"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)
|
||||
|
||||
# full_name
|
||||
|
@ -83,8 +84,9 @@ class PersonView(MasterView): # pylint: disable=abstract-method
|
|||
# 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)
|
||||
person = f.model_instance
|
||||
|
||||
|
|
|
@ -89,8 +89,9 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
|||
"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)
|
||||
|
||||
# report_key
|
||||
|
@ -114,8 +115,9 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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"]
|
||||
|
||||
def view(self):
|
||||
|
@ -153,8 +155,9 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
key = self.request.matchdict["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)
|
||||
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)
|
||||
|
||||
# name
|
||||
|
@ -75,8 +76,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
|||
# 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)
|
||||
auth = self.app.get_auth_handler()
|
||||
|
||||
|
@ -93,8 +95,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
auth = self.app.get_auth_handler()
|
||||
|
||||
|
@ -108,8 +111,9 @@ class RoleView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
role = f.model_instance
|
||||
|
||||
|
@ -356,8 +360,9 @@ class PermissionView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
model = self.app.model
|
||||
|
||||
|
@ -369,8 +374,9 @@ class PermissionView(MasterView): # pylint: disable=abstract-method
|
|||
# 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)
|
||||
|
||||
# role
|
||||
|
|
|
@ -93,8 +93,9 @@ class AppInfoView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
|
||||
g.sort_multiple = False
|
||||
|
@ -244,15 +245,17 @@ class SettingView(MasterView): # pylint: disable=abstract-method
|
|||
sort_defaults = "name"
|
||||
|
||||
# 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)
|
||||
|
||||
# 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)
|
||||
|
||||
# name
|
||||
|
|
|
@ -72,8 +72,9 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
model = self.app.model
|
||||
enum = self.app.enum
|
||||
|
@ -121,8 +122,9 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
|||
return "has-background-warning"
|
||||
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)
|
||||
enum = self.app.enum
|
||||
upgrade = f.model_instance
|
||||
|
@ -204,11 +206,12 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
|||
"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
|
||||
the upgrade, in addition to deleting the upgrade proper.
|
||||
"""
|
||||
upgrade = obj
|
||||
path = self.get_upgrade_filepath(upgrade, create=False)
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
@ -227,8 +230,9 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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:
|
||||
return self.get_upgrade_filepath(upgrade, filename)
|
||||
return None
|
||||
|
@ -245,7 +249,7 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
|||
path = os.path.join(path, filename)
|
||||
return path
|
||||
|
||||
def execute_instance(self, upgrade, user, progress=None):
|
||||
def execute_instance(self, obj, user, progress=None):
|
||||
"""
|
||||
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
|
||||
either ``SUCCESS`` or ``FAILURE``.
|
||||
"""
|
||||
upgrade = obj
|
||||
enum = self.app.enum
|
||||
|
||||
# locate file paths
|
||||
|
|
|
@ -82,8 +82,9 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
model = self.app.model
|
||||
|
||||
|
@ -106,8 +107,9 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
|||
return "has-background-warning"
|
||||
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
|
||||
if user.prevent_edit and not self.request.is_root:
|
||||
|
@ -115,8 +117,9 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
|||
|
||||
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)
|
||||
user = f.model_instance
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue