fix: fix 'missing-function-docstring' and 'missing-module-docstring' for pylint
This commit is contained in:
parent
2624f9dce8
commit
07e90229ce
18 changed files with 72 additions and 44 deletions
|
@ -8,8 +8,6 @@ disable=fixme,
|
|||
consider-using-generator,
|
||||
duplicate-code,
|
||||
keyword-arg-before-vararg,
|
||||
missing-function-docstring,
|
||||
missing-module-docstring,
|
||||
no-member,
|
||||
too-many-locals,
|
||||
too-many-nested-blocks,
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Package Version
|
||||
"""
|
||||
|
||||
from importlib.metadata import version
|
||||
|
||||
|
|
|
@ -105,7 +105,8 @@ class WuttaSecurityPolicy:
|
|||
self.identity_cache = RequestLocalCache(self.load_identity)
|
||||
self.db_session = db_session or Session()
|
||||
|
||||
def load_identity(self, request):
|
||||
def load_identity(self, request): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
config = request.registry.settings["wutta_config"]
|
||||
app = config.get_app()
|
||||
model = app.model
|
||||
|
@ -122,22 +123,29 @@ class WuttaSecurityPolicy:
|
|||
|
||||
return user
|
||||
|
||||
def identity(self, request):
|
||||
def identity(self, request): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
return self.identity_cache.get_or_create(request)
|
||||
|
||||
def authenticated_userid(self, request):
|
||||
def authenticated_userid(self, request): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
user = self.identity(request)
|
||||
if user is not None:
|
||||
return user.uuid
|
||||
return None
|
||||
|
||||
def remember(self, request, userid, **kw):
|
||||
def remember(self, request, userid, **kw): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
return self.session_helper.remember(request, userid, **kw)
|
||||
|
||||
def forget(self, request, **kw):
|
||||
def forget(self, request, **kw): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
return self.session_helper.forget(request, **kw)
|
||||
|
||||
def permits(self, request, context, permission): # pylint: disable=unused-argument
|
||||
def permits( # pylint: disable=unused-argument,empty-docstring
|
||||
self, request, context, permission
|
||||
):
|
||||
""" """
|
||||
|
||||
# nb. root user can do anything
|
||||
if getattr(request, "is_root", False):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# wuttaweb -- Web App for Wutta Framework
|
||||
# Copyright © 2024 Lance Edgar
|
||||
# Copyright © 2024-2025 Lance Edgar
|
||||
#
|
||||
# This file is part of Wutta Framework.
|
||||
#
|
||||
|
@ -70,5 +70,5 @@ testing = Resource(img, "testing.png", renderer=True)
|
|||
|
||||
|
||||
# TODO: should consider deprecating this?
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
config.add_static_view("wuttaweb", "wuttaweb:static")
|
||||
|
|
|
@ -411,7 +411,7 @@ def before_render(event):
|
|||
context["available_themes"] = get_available_themes(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
config.add_subscriber(new_request, "pyramid.events.NewRequest")
|
||||
config.add_subscriber(new_request_set_user, "pyramid.events.NewRequest")
|
||||
config.add_subscriber(before_render, "pyramid.events.BeforeRender")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# wuttaweb -- Web App for Wutta Framework
|
||||
# Copyright © 2024 Lance Edgar
|
||||
# Copyright © 2024-2025 Lance Edgar
|
||||
#
|
||||
# This file is part of Wutta Framework.
|
||||
#
|
||||
|
@ -39,10 +39,14 @@ class WebTestCase(DataTestCase):
|
|||
Base class for test suites requiring a full (typical) web app.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
def setUp(self): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
self.setup_web()
|
||||
|
||||
def setup_web(self):
|
||||
"""
|
||||
Perform setup for the testing web app.
|
||||
"""
|
||||
self.setup_db()
|
||||
self.request = self.make_request()
|
||||
self.pyramid_config = testing.setUp(
|
||||
|
@ -87,8 +91,14 @@ class WebTestCase(DataTestCase):
|
|||
self.teardown_web()
|
||||
|
||||
def teardown_web(self):
|
||||
"""
|
||||
Perform teardown for the testing web app.
|
||||
"""
|
||||
testing.tearDown()
|
||||
self.teardown_db()
|
||||
|
||||
def make_request(self):
|
||||
"""
|
||||
Make and return a new dummy request object.
|
||||
"""
|
||||
return testing.DummyRequest()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# wuttaweb -- Web App for Wutta Framework
|
||||
# Copyright © 2024 Lance Edgar
|
||||
# Copyright © 2024-2025 Lance Edgar
|
||||
#
|
||||
# This file is part of Wutta Framework.
|
||||
#
|
||||
|
@ -34,5 +34,5 @@ from .base import View
|
|||
from .master import MasterView
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
config.include("wuttaweb.views.essential")
|
||||
|
|
|
@ -95,7 +95,8 @@ class AuthView(View):
|
|||
# 'referrer': referrer,
|
||||
}
|
||||
|
||||
def login_make_schema(self):
|
||||
def login_make_schema(self): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
schema = colander.Schema()
|
||||
|
||||
# nb. we must explicitly declare the widgets in order to also
|
||||
|
@ -220,13 +221,19 @@ class AuthView(View):
|
|||
|
||||
return schema
|
||||
|
||||
def change_password_validate_current_password(self, node, value):
|
||||
def change_password_validate_current_password( # pylint: disable=empty-docstring
|
||||
self, node, value
|
||||
):
|
||||
""" """
|
||||
auth = self.app.get_auth_handler()
|
||||
user = self.request.user
|
||||
if not auth.check_user_password(user, value):
|
||||
node.raise_invalid("Current password is incorrect.")
|
||||
|
||||
def change_password_validate_new_password(self, node, value):
|
||||
def change_password_validate_new_password( # pylint: disable=empty-docstring
|
||||
self, node, value
|
||||
):
|
||||
""" """
|
||||
auth = self.app.get_auth_handler()
|
||||
user = self.request.user
|
||||
if auth.check_user_password(user, value):
|
||||
|
@ -277,7 +284,8 @@ class AuthView(View):
|
|||
return self.redirect(url)
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
def defaults(cls, config): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
cls._auth_defaults(config)
|
||||
|
||||
@classmethod
|
||||
|
@ -311,7 +319,7 @@ class AuthView(View):
|
|||
config.add_view(cls, attr="stop_root", route_name="stop_root")
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
AuthView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -320,5 +328,5 @@ def defaults(config, **kwargs):
|
|||
AuthView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -294,7 +294,8 @@ class CommonView(View):
|
|||
return self.redirect(referrer)
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
def defaults(cls, config): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
cls._defaults(config)
|
||||
|
||||
@classmethod
|
||||
|
@ -342,7 +343,7 @@ class CommonView(View):
|
|||
)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
CommonView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -351,5 +352,5 @@ def defaults(config, **kwargs):
|
|||
CommonView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -300,7 +300,7 @@ class EmailSettingView(MasterView): # pylint: disable=abstract-method
|
|||
)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
EmailSettingView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -309,5 +309,5 @@ def defaults(config, **kwargs):
|
|||
EmailSettingView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# wuttaweb -- Web App for Wutta Framework
|
||||
# Copyright © 2024 Lance Edgar
|
||||
# Copyright © 2024-2025 Lance Edgar
|
||||
#
|
||||
# This file is part of Wutta Framework.
|
||||
#
|
||||
|
@ -41,7 +41,7 @@ That will in turn include the following modules:
|
|||
"""
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
|
||||
def mod(spec):
|
||||
return kwargs.get(spec, spec)
|
||||
|
@ -57,5 +57,5 @@ def defaults(config, **kwargs):
|
|||
config.include(mod("wuttaweb.views.upgrades"))
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -213,7 +213,7 @@ class PersonView(MasterView): # pylint: disable=abstract-method
|
|||
)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
PersonView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -222,5 +222,5 @@ def defaults(config, **kwargs):
|
|||
PersonView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# wuttaweb -- Web App for Wutta Framework
|
||||
# Copyright © 2024 Lance Edgar
|
||||
# Copyright © 2024-2025 Lance Edgar
|
||||
#
|
||||
# This file is part of Wutta Framework.
|
||||
#
|
||||
|
@ -63,7 +63,7 @@ def progress(request):
|
|||
return session
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
progress = kwargs.get( # pylint: disable=redefined-outer-name
|
||||
|
@ -73,5 +73,5 @@ def defaults(config, **kwargs):
|
|||
config.add_view(progress, route_name="progress", renderer="json")
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -261,7 +261,7 @@ class ReportView(MasterView): # pylint: disable=abstract-method
|
|||
)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
ReportView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -270,5 +270,5 @@ def defaults(config, **kwargs):
|
|||
ReportView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -377,7 +377,7 @@ class PermissionView(MasterView): # pylint: disable=abstract-method
|
|||
f.set_node("role", RoleRef(self.request))
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
RoleView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -391,5 +391,5 @@ def defaults(config, **kwargs):
|
|||
PermissionView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -275,7 +275,7 @@ class SettingView(MasterView): # pylint: disable=abstract-method
|
|||
node.raise_invalid("Setting name must be unique")
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
AppInfoView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -289,5 +289,5 @@ def defaults(config, **kwargs):
|
|||
SettingView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -377,7 +377,7 @@ class UpgradeView(MasterView): # pylint: disable=abstract-method
|
|||
)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
UpgradeView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -386,5 +386,5 @@ def defaults(config, **kwargs):
|
|||
UpgradeView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
|
@ -417,7 +417,7 @@ class UserView(MasterView): # pylint: disable=abstract-method
|
|||
)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
def defaults(config, **kwargs): # pylint: disable=missing-function-docstring
|
||||
base = globals()
|
||||
|
||||
UserView = kwargs.get( # pylint: disable=invalid-name,redefined-outer-name
|
||||
|
@ -426,5 +426,5 @@ def defaults(config, **kwargs):
|
|||
UserView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def includeme(config): # pylint: disable=missing-function-docstring
|
||||
defaults(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue