From cc6ac9f6b4ce7cced0a1563135c490042de7a31a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 30 Aug 2025 17:10:14 -0500 Subject: [PATCH] fix: fix 'unused-argument' for pylint --- .pylintrc | 1 + src/wuttjamaican/app.py | 10 +++++----- src/wuttjamaican/auth.py | 28 ++++++++++++++-------------- src/wuttjamaican/batch.py | 4 ++-- src/wuttjamaican/cli/base.py | 4 ++-- src/wuttjamaican/cli/make_appdir.py | 4 ++-- src/wuttjamaican/install.py | 2 +- src/wuttjamaican/people.py | 2 +- src/wuttjamaican/problems.py | 2 +- src/wuttjamaican/testing.py | 11 +++++++++-- 10 files changed, 38 insertions(+), 30 deletions(-) diff --git a/.pylintrc b/.pylintrc index 3b79138..bcf5b0b 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,4 +7,5 @@ enable=anomalous-backslash-in-string, inconsistent-return-statements, redefined-argument-from-local, unspecified-encoding, + unused-argument, unused-import, diff --git a/src/wuttjamaican/app.py b/src/wuttjamaican/app.py index 83fddba..aba810b 100644 --- a/src/wuttjamaican/app.py +++ b/src/wuttjamaican/app.py @@ -413,7 +413,7 @@ class AppHandler: 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. @@ -486,7 +486,7 @@ class AppHandler: return Session(**kwargs) - def make_title(self, text, **kwargs): + def make_title(self, text): """ Return a human-friendly "title" for the given text. @@ -590,7 +590,7 @@ class AppHandler: 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. @@ -622,7 +622,7 @@ class AppHandler: value, force_create=False, **kwargs - ): + ): # pylint: disable=unused-argument """ Save a :term:`config setting` value to the DB. @@ -663,7 +663,7 @@ class AppHandler: # set 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. diff --git a/src/wuttjamaican/auth.py b/src/wuttjamaican/auth.py index fa3054f..a411e5a 100644 --- a/src/wuttjamaican/auth.py +++ b/src/wuttjamaican/auth.py @@ -56,7 +56,7 @@ class AuthHandler(GenericHandler): * 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, return the :class:`~wuttjamaican.db.model.auth.User`. @@ -125,7 +125,7 @@ class AuthHandler(GenericHandler): return user return None - def check_user_password(self, user, password, **kwargs): + def check_user_password(self, user, password): """ Check a user's password. @@ -144,7 +144,7 @@ class AuthHandler(GenericHandler): """ 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` per the given key, if possible. @@ -192,7 +192,7 @@ class AuthHandler(GenericHandler): return self.get_role(session, key) 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` associated with the given object, if one can be found. @@ -305,7 +305,7 @@ class AuthHandler(GenericHandler): session.add(user) return user - def delete_user(self, user, **kwargs): + def delete_user(self, user): """ Delete the given user account. Use with caution! As this generally cannot be undone. @@ -320,7 +320,7 @@ class AuthHandler(GenericHandler): session = self.app.get_session(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 hints. @@ -408,7 +408,7 @@ class AuthHandler(GenericHandler): return username - def set_user_password(self, user, password, **kwargs): + def set_user_password(self, user, password): """ Set a user's password. @@ -422,28 +422,28 @@ class AuthHandler(GenericHandler): """ user.password = password_context.hash(password) - def get_role_administrator(self, session, **kwargs): + def get_role_administrator(self, session): """ Returns the special "Administrator" role. """ return self._special_role(session, _uuid.UUID('d937fa8a965611dfa0dd001143047286'), "Administrator") - def get_role_anonymous(self, session, **kwargs): + def get_role_anonymous(self, session): """ Returns the special "Anonymous" (aka. "Guest") role. """ return self._special_role(session, _uuid.UUID('f8a27c98965a11dfaff7001143047286'), "Anonymous") - def get_role_authenticated(self, session, **kwargs): + def get_role_authenticated(self, session): """ Returns the special "Authenticated" role. """ return self._special_role(session, _uuid.UUID('b765a9cc331a11e6ac2a3ca9f40bc550'), "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. @@ -556,7 +556,7 @@ class AuthHandler(GenericHandler): include_authenticated=include_authenticated) 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 permission, nothing is done. @@ -569,7 +569,7 @@ class AuthHandler(GenericHandler): if permission not in role.permissions: 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 the permission, nothing is done. @@ -642,7 +642,7 @@ class AuthHandler(GenericHandler): # 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. diff --git a/src/wuttjamaican/batch.py b/src/wuttjamaican/batch.py index 8ae4d36..653df8b 100644 --- a/src/wuttjamaican/batch.py +++ b/src/wuttjamaican/batch.py @@ -204,7 +204,7 @@ class BatchHandler(GenericHandler): 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 should be populated from initial data source(s). @@ -503,7 +503,7 @@ class BatchHandler(GenericHandler): 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. diff --git a/src/wuttjamaican/cli/base.py b/src/wuttjamaican/cli/base.py index aa057fe..888c39a 100644 --- a/src/wuttjamaican/cli/base.py +++ b/src/wuttjamaican/cli/base.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttJamaican -- Base package for Wutta Framework -# Copyright © 2023-2024 Lance Edgar +# Copyright © 2023-2025 Lance Edgar # # This file is part of Wutta Framework. # @@ -70,7 +70,7 @@ def typer_callback( typer.Option('--config', '-c', exists=True, 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 top-level args: diff --git a/src/wuttjamaican/cli/make_appdir.py b/src/wuttjamaican/cli/make_appdir.py index c62684c..e9f1506 100644 --- a/src/wuttjamaican/cli/make_appdir.py +++ b/src/wuttjamaican/cli/make_appdir.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttJamaican -- Base package for Wutta Framework -# Copyright © 2023-2024 Lance Edgar +# Copyright © 2023-2025 Lance Edgar # # This file is part of Wutta Framework. # @@ -41,7 +41,7 @@ def make_appdir( typer.Option('--path', help="Path to desired app dir; default is (usually) " "`app` in the root of virtual environment.")] = None, -): +): # pylint: disable=unused-argument """ Make the app dir for virtual environment diff --git a/src/wuttjamaican/install.py b/src/wuttjamaican/install.py index dfdbb61..28035f1 100644 --- a/src/wuttjamaican/install.py +++ b/src/wuttjamaican/install.py @@ -471,7 +471,7 @@ class InstallHandler(GenericHandler): def require_prompt_toolkit(self, answer=None): try: - import prompt_toolkit + import prompt_toolkit # pylint: disable=unused-import except ImportError: value = answer or input("\nprompt_toolkit is not installed. shall i install it? [Yn] ") value = value.strip() diff --git a/src/wuttjamaican/people.py b/src/wuttjamaican/people.py index 3bf133b..3f51240 100644 --- a/src/wuttjamaican/people.py +++ b/src/wuttjamaican/people.py @@ -63,7 +63,7 @@ class PeopleHandler(GenericHandler): return model.Person(**kwargs) - def get_person(self, obj, **kwargs): + def get_person(self, obj): """ Return the :class:`~wuttjamaican.db.model.base.Person` associated with the given object, if one can be found. diff --git a/src/wuttjamaican/problems.py b/src/wuttjamaican/problems.py index 608ef66..b401ed9 100644 --- a/src/wuttjamaican/problems.py +++ b/src/wuttjamaican/problems.py @@ -100,7 +100,7 @@ class ProblemCheck: """ 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 report email template. diff --git a/src/wuttjamaican/testing.py b/src/wuttjamaican/testing.py index 3ec7ae8..f566d91 100644 --- a/src/wuttjamaican/testing.py +++ b/src/wuttjamaican/testing.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttJamaican -- Base package for Wutta Framework -# Copyright © 2023-2024 Lance Edgar +# Copyright © 2023-2025 Lance Edgar # # This file is part of Wutta Framework. # @@ -99,7 +99,14 @@ class FileTestCase(TestCase): f.write(content) 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.