3
0
Fork 0

fix: fix 'unused-argument' for pylint

This commit is contained in:
Lance Edgar 2025-08-30 17:10:14 -05:00
parent 9f76444380
commit cc6ac9f6b4
10 changed files with 38 additions and 30 deletions

View file

@ -7,4 +7,5 @@ enable=anomalous-backslash-in-string,
inconsistent-return-statements, inconsistent-return-statements,
redefined-argument-from-local, redefined-argument-from-local,
unspecified-encoding, unspecified-encoding,
unused-argument,
unused-import, unused-import,

View file

@ -413,7 +413,7 @@ class AppHandler:
return path return path
def make_appdir(self, path, subfolders=None, **kwargs): def make_appdir(self, path, subfolders=None):
""" """
Establish an :term:`app dir` at the given path. Establish an :term:`app dir` at the given path.
@ -486,7 +486,7 @@ class AppHandler:
return Session(**kwargs) return Session(**kwargs)
def make_title(self, text, **kwargs): def make_title(self, text):
""" """
Return a human-friendly "title" for the given text. Return a human-friendly "title" for the given text.
@ -590,7 +590,7 @@ class AppHandler:
return short_session(**kwargs) return short_session(**kwargs)
def get_setting(self, session, name, **kwargs): def get_setting(self, session, name, **kwargs): # pylint: disable=unused-argument
""" """
Get a :term:`config setting` value from the DB. Get a :term:`config setting` value from the DB.
@ -622,7 +622,7 @@ class AppHandler:
value, value,
force_create=False, force_create=False,
**kwargs **kwargs
): ): # pylint: disable=unused-argument
""" """
Save a :term:`config setting` value to the DB. Save a :term:`config setting` value to the DB.
@ -663,7 +663,7 @@ class AppHandler:
# set value # set value
setting.value = value setting.value = value
def delete_setting(self, session, name, **kwargs): def delete_setting(self, session, name, **kwargs): # pylint: disable=unused-argument
""" """
Delete a :term:`config setting` from the DB. Delete a :term:`config setting` from the DB.

View file

@ -56,7 +56,7 @@ class AuthHandler(GenericHandler):
* grant/revoke role permissions * grant/revoke role permissions
""" """
def authenticate_user(self, session, username, password, **kwargs): def authenticate_user(self, session, username, password):
""" """
Authenticate the given user credentials, and if successful, Authenticate the given user credentials, and if successful,
return the :class:`~wuttjamaican.db.model.auth.User`. return the :class:`~wuttjamaican.db.model.auth.User`.
@ -125,7 +125,7 @@ class AuthHandler(GenericHandler):
return user return user
return None return None
def check_user_password(self, user, password, **kwargs): def check_user_password(self, user, password):
""" """
Check a user's password. Check a user's password.
@ -144,7 +144,7 @@ class AuthHandler(GenericHandler):
""" """
return password_context.verify(password, user.password) return password_context.verify(password, user.password)
def get_role(self, session, key, **kwargs): def get_role(self, session, key):
""" """
Locate and return a :class:`~wuttjamaican.db.model.auth.Role` Locate and return a :class:`~wuttjamaican.db.model.auth.Role`
per the given key, if possible. per the given key, if possible.
@ -192,7 +192,7 @@ class AuthHandler(GenericHandler):
return self.get_role(session, key) return self.get_role(session, key)
return None return None
def get_user(self, obj, session=None, **kwargs): def get_user(self, obj, session=None):
""" """
Return the :class:`~wuttjamaican.db.model.auth.User` Return the :class:`~wuttjamaican.db.model.auth.User`
associated with the given object, if one can be found. associated with the given object, if one can be found.
@ -305,7 +305,7 @@ class AuthHandler(GenericHandler):
session.add(user) session.add(user)
return user return user
def delete_user(self, user, **kwargs): def delete_user(self, user):
""" """
Delete the given user account. Use with caution! As this Delete the given user account. Use with caution! As this
generally cannot be undone. generally cannot be undone.
@ -320,7 +320,7 @@ class AuthHandler(GenericHandler):
session = self.app.get_session(user) session = self.app.get_session(user)
session.delete(user) session.delete(user)
def make_preferred_username(self, session, **kwargs): def make_preferred_username(self, session, **kwargs): # pylint: disable=unused-argument
""" """
Generate a "preferred" username, using data from ``kwargs`` as Generate a "preferred" username, using data from ``kwargs`` as
hints. hints.
@ -408,7 +408,7 @@ class AuthHandler(GenericHandler):
return username return username
def set_user_password(self, user, password, **kwargs): def set_user_password(self, user, password):
""" """
Set a user's password. Set a user's password.
@ -422,28 +422,28 @@ class AuthHandler(GenericHandler):
""" """
user.password = password_context.hash(password) user.password = password_context.hash(password)
def get_role_administrator(self, session, **kwargs): def get_role_administrator(self, session):
""" """
Returns the special "Administrator" role. Returns the special "Administrator" role.
""" """
return self._special_role(session, _uuid.UUID('d937fa8a965611dfa0dd001143047286'), return self._special_role(session, _uuid.UUID('d937fa8a965611dfa0dd001143047286'),
"Administrator") "Administrator")
def get_role_anonymous(self, session, **kwargs): def get_role_anonymous(self, session):
""" """
Returns the special "Anonymous" (aka. "Guest") role. Returns the special "Anonymous" (aka. "Guest") role.
""" """
return self._special_role(session, _uuid.UUID('f8a27c98965a11dfaff7001143047286'), return self._special_role(session, _uuid.UUID('f8a27c98965a11dfaff7001143047286'),
"Anonymous") "Anonymous")
def get_role_authenticated(self, session, **kwargs): def get_role_authenticated(self, session):
""" """
Returns the special "Authenticated" role. Returns the special "Authenticated" role.
""" """
return self._special_role(session, _uuid.UUID('b765a9cc331a11e6ac2a3ca9f40bc550'), return self._special_role(session, _uuid.UUID('b765a9cc331a11e6ac2a3ca9f40bc550'),
"Authenticated") "Authenticated")
def user_is_admin(self, user, **kwargs): def user_is_admin(self, user):
""" """
Check if given user is a member of the "Administrator" role. Check if given user is a member of the "Administrator" role.
@ -556,7 +556,7 @@ class AuthHandler(GenericHandler):
include_authenticated=include_authenticated) include_authenticated=include_authenticated)
return permission in perms return permission in perms
def grant_permission(self, role, permission, **kwargs): def grant_permission(self, role, permission):
""" """
Grant a permission to the role. If the role already has the Grant a permission to the role. If the role already has the
permission, nothing is done. permission, nothing is done.
@ -569,7 +569,7 @@ class AuthHandler(GenericHandler):
if permission not in role.permissions: if permission not in role.permissions:
role.permissions.append(permission) role.permissions.append(permission)
def revoke_permission(self, role, permission, **kwargs): def revoke_permission(self, role, permission):
""" """
Revoke a permission from the role. If the role does not have Revoke a permission from the role. If the role does not have
the permission, nothing is done. the permission, nothing is done.
@ -642,7 +642,7 @@ class AuthHandler(GenericHandler):
# internal methods # internal methods
############################## ##############################
def _role_is_pertinent(self, role): def _role_is_pertinent(self, role): # pylint: disable=unused-argument
""" """
Check the role to ensure it is "pertinent" for the current app. Check the role to ensure it is "pertinent" for the current app.

View file

@ -204,7 +204,7 @@ class BatchHandler(GenericHandler):
return path return path
def should_populate(self, batch): def should_populate(self, batch): # pylint: disable=unused-argument
""" """
Must return true or false, indicating whether the given batch Must return true or false, indicating whether the given batch
should be populated from initial data source(s). should be populated from initial data source(s).
@ -503,7 +503,7 @@ class BatchHandler(GenericHandler):
to the caller from :meth:`do_execute()`. to the caller from :meth:`do_execute()`.
""" """
def do_delete(self, batch, user, dry_run=False, progress=None, **kwargs): def do_delete(self, batch, user, dry_run=False, progress=None, **kwargs): # pylint: disable=unused-argument
""" """
Delete the given batch entirely. Delete the given batch entirely.

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# WuttJamaican -- Base package for Wutta Framework # WuttJamaican -- Base package for Wutta Framework
# Copyright © 2023-2024 Lance Edgar # Copyright © 2023-2025 Lance Edgar
# #
# This file is part of Wutta Framework. # This file is part of Wutta Framework.
# #
@ -70,7 +70,7 @@ def typer_callback(
typer.Option('--config', '-c', typer.Option('--config', '-c',
exists=True, exists=True,
help="Config path (may be specified more than once)")] = None, help="Config path (may be specified more than once)")] = None,
): ): # pylint: disable=unused-argument
""" """
Generic callback for use with top-level commands. This adds some Generic callback for use with top-level commands. This adds some
top-level args: top-level args:

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# WuttJamaican -- Base package for Wutta Framework # WuttJamaican -- Base package for Wutta Framework
# Copyright © 2023-2024 Lance Edgar # Copyright © 2023-2025 Lance Edgar
# #
# This file is part of Wutta Framework. # This file is part of Wutta Framework.
# #
@ -41,7 +41,7 @@ def make_appdir(
typer.Option('--path', typer.Option('--path',
help="Path to desired app dir; default is (usually) " help="Path to desired app dir; default is (usually) "
"`app` in the root of virtual environment.")] = None, "`app` in the root of virtual environment.")] = None,
): ): # pylint: disable=unused-argument
""" """
Make the app dir for virtual environment Make the app dir for virtual environment

View file

@ -471,7 +471,7 @@ class InstallHandler(GenericHandler):
def require_prompt_toolkit(self, answer=None): def require_prompt_toolkit(self, answer=None):
try: try:
import prompt_toolkit import prompt_toolkit # pylint: disable=unused-import
except ImportError: except ImportError:
value = answer or input("\nprompt_toolkit is not installed. shall i install it? [Yn] ") value = answer or input("\nprompt_toolkit is not installed. shall i install it? [Yn] ")
value = value.strip() value = value.strip()

View file

@ -63,7 +63,7 @@ class PeopleHandler(GenericHandler):
return model.Person(**kwargs) return model.Person(**kwargs)
def get_person(self, obj, **kwargs): def get_person(self, obj):
""" """
Return the :class:`~wuttjamaican.db.model.base.Person` Return the :class:`~wuttjamaican.db.model.base.Person`
associated with the given object, if one can be found. associated with the given object, if one can be found.

View file

@ -100,7 +100,7 @@ class ProblemCheck:
""" """
return [] return []
def get_email_context(self, problems, **kwargs): def get_email_context(self, problems, **kwargs): # pylint: disable=unused-argument
""" """
This can be used to add extra context for a specific check's This can be used to add extra context for a specific check's
report email template. report email template.

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# WuttJamaican -- Base package for Wutta Framework # WuttJamaican -- Base package for Wutta Framework
# Copyright © 2023-2024 Lance Edgar # Copyright © 2023-2025 Lance Edgar
# #
# This file is part of Wutta Framework. # This file is part of Wutta Framework.
# #
@ -99,7 +99,14 @@ class FileTestCase(TestCase):
f.write(content) f.write(content)
return path return path
def mkdir(self, dirname): def mkdir(self, dirname): # pylint: disable=unused-argument
""" """
warnings.warn("FileTestCase.mkdir() is deprecated; "
"please use FileTestCase.mkdtemp() instead",
DeprecationWarning, stacklevel=2)
return self.mkdtemp()
def mkdtemp(self):
""" """
Make a new temporary folder and return its path. Make a new temporary folder and return its path.