3
0
Fork 0

Compare commits

..

2 commits

12 changed files with 55 additions and 46 deletions

View file

@ -2,8 +2,10 @@
[MESSAGES CONTROL] [MESSAGES CONTROL]
disable=all disable=all
enable=dangerous-default-value, enable=anomalous-backslash-in-string,
dangerous-default-value,
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

@ -378,7 +378,7 @@ class AppHandler:
:param create: Pass ``True`` here if you want to ensure the :param create: Pass ``True`` here if you want to ensure the
returned path exists, creating it if necessary. 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. paths for the final value.
For instance, assuming ``/srv/envs/poser`` is the virtual For instance, assuming ``/srv/envs/poser`` is the virtual
@ -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

@ -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.
# #
@ -93,7 +93,7 @@ class BatchHandler(GenericHandler):
:param progress: Optional progress indicator factory. :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. constructor.
:returns: New batch; instance of :attr:`model_class`. :returns: New batch; instance of :attr:`model_class`.
@ -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).
@ -372,7 +372,7 @@ class BatchHandler(GenericHandler):
:param user: :class:`~wuttjamaican.db.model.auth.User` who :param user: :class:`~wuttjamaican.db.model.auth.User` who
might choose to execute the batch. 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()`. Should be similar to those for :meth:`execute()`.
:returns: Text reason to prevent execution, or ``None``. :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 :param user: Reference to current user who might choose to
execute the batch. 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()`. similar to those for :meth:`execute()`.
:returns: Markdown text describing batch execution. :returns: Markdown text describing batch execution.
@ -457,7 +457,7 @@ class BatchHandler(GenericHandler):
:param progress: Optional progress indicator factory. :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 passed as-is to :meth:`why_not_execute()` and
:meth:`execute()`. :meth:`execute()`.
@ -494,16 +494,16 @@ class BatchHandler(GenericHandler):
:param progress: Optional progress indicator factory. :param progress: Optional progress indicator factory.
:param \**kwargs: Additional kwargs which may affect the batch :param \\**kwargs: Additional kwargs which may affect the
execution behavior. There are none by default, but some batch execution behavior. There are none by default, but
handlers may declare/use them. some handlers may declare/use them.
:returns: ``None`` by default, but subclass can return :returns: ``None`` by default, but subclass can return
whatever it likes, in which case that will be also returned whatever it likes, in which case that will be also returned
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

@ -390,7 +390,7 @@ class EmailHandler(GenericHandler):
:param default_subject: Optional :attr:`~Message.subject` :param default_subject: Optional :attr:`~Message.subject`
template/string to use, if config does not specify one. 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. :meth:`make_message()`. More on this below.
:returns: :class:`~wuttjamaican.email.Message` object. :returns: :class:`~wuttjamaican.email.Message` object.
@ -803,7 +803,7 @@ class EmailHandler(GenericHandler):
context = {'data': [1, 2, 3]} context = {'data': [1, 2, 3]}
app.send_email('foo', context, to='me@example.com', cc='bobby@example.com') 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 :meth:`make_auto_message()`. So, not used if you provide
the ``message``. the ``message``.
""" """

View file

@ -268,7 +268,7 @@ class InstallHandler(GenericHandler):
:param dbinfo: Dict of DB connection info as obtained from :param dbinfo: Dict of DB connection info as obtained from
:meth:`get_dbinfo()`. :meth:`get_dbinfo()`.
:param \**kwargs: Extra template context. :param \\**kwargs: Extra template context.
:returns: Dict for global 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 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, Some context will be provided automatically for the template,
but these may be overridden via the ``**kwargs``: but these may be overridden via the ``**kwargs``:
@ -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

@ -47,7 +47,7 @@ class PeopleHandler(GenericHandler):
:attr:`~wuttjamaican.db.model.base.Person.full_name` if not :attr:`~wuttjamaican.db.model.base.Person.full_name` if not
specified. 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. class constructor.
:rtype: :class:`~wuttjamaican.db.model.base.Person` :rtype: :class:`~wuttjamaican.db.model.base.Person`
@ -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.

View file

@ -175,7 +175,7 @@ def make_full_name(*parts):
""" """
Make a "full name" from the given 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. together to make the full name.
:returns: The full name. :returns: The full name.