diff --git a/.pylintrc b/.pylintrc index bcf5b0b..d917385 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,10 +2,8 @@ [MESSAGES CONTROL] disable=all -enable=anomalous-backslash-in-string, - dangerous-default-value, +enable=dangerous-default-value, 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 aba810b..7047f43 100644 --- a/src/wuttjamaican/app.py +++ b/src/wuttjamaican/app.py @@ -378,7 +378,7 @@ class AppHandler: :param create: Pass ``True`` here if you want to ensure the returned path exists, creating it if necessary. - :param \\*args: Any additional args will be added as child + :param \*args: Any additional args will be added as child paths for the final value. For instance, assuming ``/srv/envs/poser`` is the virtual @@ -413,7 +413,7 @@ class AppHandler: return path - def make_appdir(self, path, subfolders=None): + def make_appdir(self, path, subfolders=None, **kwargs): """ Establish an :term:`app dir` at the given path. @@ -486,7 +486,7 @@ class AppHandler: return Session(**kwargs) - def make_title(self, text): + def make_title(self, text, **kwargs): """ 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): # pylint: disable=unused-argument + def get_setting(self, session, name, **kwargs): """ 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): # pylint: disable=unused-argument + def delete_setting(self, session, name, **kwargs): """ Delete a :term:`config setting` from the DB. diff --git a/src/wuttjamaican/auth.py b/src/wuttjamaican/auth.py index a411e5a..fa3054f 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): + def authenticate_user(self, session, username, password, **kwargs): """ 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): + def check_user_password(self, user, password, **kwargs): """ 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): + def get_role(self, session, key, **kwargs): """ 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): + def get_user(self, obj, session=None, **kwargs): """ 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): + def delete_user(self, user, **kwargs): """ 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): # pylint: disable=unused-argument + def make_preferred_username(self, session, **kwargs): """ 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): + def set_user_password(self, user, password, **kwargs): """ Set a user's password. @@ -422,28 +422,28 @@ class AuthHandler(GenericHandler): """ user.password = password_context.hash(password) - def get_role_administrator(self, session): + def get_role_administrator(self, session, **kwargs): """ Returns the special "Administrator" role. """ return self._special_role(session, _uuid.UUID('d937fa8a965611dfa0dd001143047286'), "Administrator") - def get_role_anonymous(self, session): + def get_role_anonymous(self, session, **kwargs): """ Returns the special "Anonymous" (aka. "Guest") role. """ return self._special_role(session, _uuid.UUID('f8a27c98965a11dfaff7001143047286'), "Anonymous") - def get_role_authenticated(self, session): + def get_role_authenticated(self, session, **kwargs): """ Returns the special "Authenticated" role. """ return self._special_role(session, _uuid.UUID('b765a9cc331a11e6ac2a3ca9f40bc550'), "Authenticated") - def user_is_admin(self, user): + def user_is_admin(self, user, **kwargs): """ 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): + def grant_permission(self, role, permission, **kwargs): """ 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): + def revoke_permission(self, role, permission, **kwargs): """ 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): # pylint: disable=unused-argument + def _role_is_pertinent(self, role): """ 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 653df8b..0d47545 100644 --- a/src/wuttjamaican/batch.py +++ b/src/wuttjamaican/batch.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttJamaican -- Base package for Wutta Framework -# Copyright © 2023-2025 Lance Edgar +# Copyright © 2023-2024 Lance Edgar # # This file is part of Wutta Framework. # @@ -93,7 +93,7 @@ class BatchHandler(GenericHandler): :param progress: Optional progress indicator factory. - :param \\**kwargs: Additional kwargs to pass to the batch + :param \**kwargs: Additional kwargs to pass to the batch constructor. :returns: New batch; instance of :attr:`model_class`. @@ -204,7 +204,7 @@ class BatchHandler(GenericHandler): return path - def should_populate(self, batch): # pylint: disable=unused-argument + def should_populate(self, batch): """ Must return true or false, indicating whether the given batch should be populated from initial data source(s). @@ -372,7 +372,7 @@ class BatchHandler(GenericHandler): :param user: :class:`~wuttjamaican.db.model.auth.User` who might choose to execute the batch. - :param \\**kwargs: Execution kwargs for the batch, if known. + :param \**kwargs: Execution kwargs for the batch, if known. Should be similar to those for :meth:`execute()`. :returns: Text reason to prevent execution, or ``None``. @@ -414,7 +414,7 @@ class BatchHandler(GenericHandler): :param user: Reference to current user who might choose to execute the batch. - :param \\**kwargs: Execution kwargs for the batch; should be + :param \**kwargs: Execution kwargs for the batch; should be similar to those for :meth:`execute()`. :returns: Markdown text describing batch execution. @@ -457,7 +457,7 @@ class BatchHandler(GenericHandler): :param progress: Optional progress indicator factory. - :param \\**kwargs: Additional kwargs as needed. These are + :param \**kwargs: Additional kwargs as needed. These are passed as-is to :meth:`why_not_execute()` and :meth:`execute()`. @@ -494,16 +494,16 @@ class BatchHandler(GenericHandler): :param progress: Optional progress indicator factory. - :param \\**kwargs: Additional kwargs which may affect the - batch execution behavior. There are none by default, but - some handlers may declare/use them. + :param \**kwargs: Additional kwargs which may affect the batch + execution behavior. There are none by default, but some + handlers may declare/use them. :returns: ``None`` by default, but subclass can return whatever it likes, in which case that will be also returned to the caller from :meth:`do_execute()`. """ - def do_delete(self, batch, user, dry_run=False, progress=None, **kwargs): # pylint: disable=unused-argument + def do_delete(self, batch, user, dry_run=False, progress=None, **kwargs): """ Delete the given batch entirely. diff --git a/src/wuttjamaican/cli/base.py b/src/wuttjamaican/cli/base.py index 888c39a..aa057fe 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-2025 Lance Edgar +# Copyright © 2023-2024 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 e9f1506..c62684c 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-2025 Lance Edgar +# Copyright © 2023-2024 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/email.py b/src/wuttjamaican/email.py index 14c5c87..8ad9997 100644 --- a/src/wuttjamaican/email.py +++ b/src/wuttjamaican/email.py @@ -390,7 +390,7 @@ class EmailHandler(GenericHandler): :param default_subject: Optional :attr:`~Message.subject` template/string to use, if config does not specify one. - :param \\**kwargs: Any remaining kwargs are passed as-is to + :param \**kwargs: Any remaining kwargs are passed as-is to :meth:`make_message()`. More on this below. :returns: :class:`~wuttjamaican.email.Message` object. @@ -803,7 +803,7 @@ class EmailHandler(GenericHandler): context = {'data': [1, 2, 3]} app.send_email('foo', context, to='me@example.com', cc='bobby@example.com') - :param \\**kwargs: Any remaining kwargs are passed along to + :param \**kwargs: Any remaining kwargs are passed along to :meth:`make_auto_message()`. So, not used if you provide the ``message``. """ diff --git a/src/wuttjamaican/install.py b/src/wuttjamaican/install.py index 28035f1..8ca35ec 100644 --- a/src/wuttjamaican/install.py +++ b/src/wuttjamaican/install.py @@ -268,7 +268,7 @@ class InstallHandler(GenericHandler): :param dbinfo: Dict of DB connection info as obtained from :meth:`get_dbinfo()`. - :param \\**kwargs: Extra template context. + :param \**kwargs: Extra template context. :returns: Dict for global template context. @@ -394,7 +394,7 @@ class InstallHandler(GenericHandler): :param output_path: Path to which output should be written. - :param \\**kwargs: Extra context for the template. + :param \**kwargs: Extra context for the template. Some context will be provided automatically for the template, but these may be overridden via the ``**kwargs``: @@ -471,7 +471,7 @@ class InstallHandler(GenericHandler): def require_prompt_toolkit(self, answer=None): try: - import prompt_toolkit # pylint: disable=unused-import + import prompt_toolkit 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 3f51240..1cc6fda 100644 --- a/src/wuttjamaican/people.py +++ b/src/wuttjamaican/people.py @@ -47,7 +47,7 @@ class PeopleHandler(GenericHandler): :attr:`~wuttjamaican.db.model.base.Person.full_name` if not specified. - :param \\**kwargs: All kwargs are passed as-is to the model + :param \**kwargs: All kwargs are passed as-is to the model class constructor. :rtype: :class:`~wuttjamaican.db.model.base.Person` @@ -63,7 +63,7 @@ class PeopleHandler(GenericHandler): return model.Person(**kwargs) - def get_person(self, obj): + def get_person(self, obj, **kwargs): """ 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 b401ed9..608ef66 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): # pylint: disable=unused-argument + def get_email_context(self, problems, **kwargs): """ 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 f566d91..3ec7ae8 100644 --- a/src/wuttjamaican/testing.py +++ b/src/wuttjamaican/testing.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttJamaican -- Base package for Wutta Framework -# Copyright © 2023-2025 Lance Edgar +# Copyright © 2023-2024 Lance Edgar # # This file is part of Wutta Framework. # @@ -99,14 +99,7 @@ class FileTestCase(TestCase): f.write(content) return path - 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): + def mkdir(self, dirname): """ Make a new temporary folder and return its path. diff --git a/src/wuttjamaican/util.py b/src/wuttjamaican/util.py index 843a87c..6296bb5 100644 --- a/src/wuttjamaican/util.py +++ b/src/wuttjamaican/util.py @@ -175,7 +175,7 @@ def make_full_name(*parts): """ Make a "full name" from the given parts. - :param \\*parts: Distinct name values which should be joined + :param \*parts: Distinct name values which should be joined together to make the full name. :returns: The full name.