Skip to content

Commit 16922e6

Browse files
committed
fix linting of kms_provider() docstring line length
1 parent 4c30590 commit 16922e6

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

django_mongodb_backend/routers.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@ def allow_migrate(self, db, app_label, model_name=None, **hints):
2323
# This function is intended to be monkey-patched as a method of ConnectionRouter.
2424
def kms_provider(self, model, *args, **kwargs):
2525
"""
26-
Monkey-patched method for ConnectionRouter to resolve a KMS provider for a given model.
27-
Iterates through all configured database routers, calling their `kms_provider` method (if present)
28-
to determine the appropriate Key Management Service (KMS) provider for the specified model.
29-
Returns the first non-None result found. Raises ImproperlyConfigured if no provider is found.
26+
Return the Key Management Service (KMS) provider for a given model.
27+
28+
Call each router's kms_provider() method (if present), and return the
29+
first non-None result. Raise ImproperlyConfigured if no provider is found.
3030
"""
3131
for router in self.routers:
3232
func = getattr(router, "kms_provider", None)
33-
if func and callable(func):
34-
result = func(model, *args, **kwargs)
35-
if result is not None:
36-
return result
37-
raise ImproperlyConfigured("No kms_provider found in database router.")
33+
if func and callable(func) and (result := func(model, *args, **kwargs)):
34+
return result
35+
raise ImproperlyConfigured("No kms_provider found in database routers.")
3836

3937

4038
def register_routers():

0 commit comments

Comments
 (0)