Skip to content

Commit b2eda48

Browse files
authored
Ruff: Fix N805 (#13437)
1 parent 0b7e96d commit b2eda48

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

dojo/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def _wrapped(request, *args, **kw):
222222
if username:
223223
dojo_user = Dojo_User.objects.filter(username=username).first()
224224
if dojo_user:
225-
Dojo_User.enable_force_password_reset(dojo_user)
225+
dojo_user.enable_force_password_reset()
226226
raise Ratelimited
227227
return fn(request, *args, **kw)
228228
return _wrapped

dojo/importers/base_importer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Parser:
4949
and is purely for the sake of type hinting
5050
"""
5151

52+
@staticmethod
5253
def get_findings(scan_type: str, test: Test) -> list[Finding]:
5354
"""
5455
Stub function to make the hinting happier. The actual class

dojo/importers/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ def log_translation(
9696
for field in self.field_names:
9797
logger.debug(f"{field}: {getattr(self, field)}")
9898

99+
@staticmethod
99100
def _compress_decorator(function):
100101
@wraps(function)
101102
def inner_compress_function(*args, **kwargs):
102103
args[0].compress_options()
103104
return function(*args, **kwargs)
104105
return inner_compress_function
105106

107+
@staticmethod
106108
def _decompress_decorator(function):
107109
@wraps(function)
108110
def inner_decompress_function(*args, **kwargs):

dojo/models.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@ def wants_block_execution(user):
231231
def force_password_reset(user):
232232
return hasattr(user, "usercontactinfo") and user.usercontactinfo.force_password_reset
233233

234-
def disable_force_password_reset(user):
235-
if hasattr(user, "usercontactinfo"):
236-
user.usercontactinfo.force_password_reset = False
237-
user.usercontactinfo.save()
238-
239-
def enable_force_password_reset(user):
240-
if hasattr(user, "usercontactinfo"):
241-
user.usercontactinfo.force_password_reset = True
242-
user.usercontactinfo.save()
234+
def disable_force_password_reset(self):
235+
if hasattr(self, "usercontactinfo"):
236+
self.usercontactinfo.force_password_reset = False
237+
self.usercontactinfo.save()
238+
239+
def enable_force_password_reset(self):
240+
if hasattr(self, "usercontactinfo"):
241+
self.usercontactinfo.force_password_reset = True
242+
self.usercontactinfo.save()
243243

244244
@staticmethod
245245
def generate_full_name(user):

dojo/user/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def change_password(request):
287287
new_password = form.cleaned_data["new_password"]
288288

289289
user.set_password(new_password)
290-
Dojo_User.disable_force_password_reset(user)
290+
user.disable_force_password_reset()
291291
user.save()
292292

293293
messages.add_message(request,

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ select = [
7474
"C90",
7575
"NPY",
7676
"PD",
77-
"N803", "N804", "N811", "N812", "N813", "N814", "N817", "N818", "N999",
77+
"N803", "N804", "N805", "N811", "N812", "N813", "N814", "N817", "N818", "N999",
7878
"PERF1", "PERF2", "PERF401", "PERF403",
7979
"E",
8080
"W",

0 commit comments

Comments
 (0)