mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 07:41:14 +00:00
ruff rule B
This commit is contained in:
parent
2ac578c3ad
commit
c6d2ac9100
@ -68,5 +68,5 @@ class SignalRequestMiddleware:
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
setattr(_threadlocal, "request", request)
|
||||
_threadlocal.request = request
|
||||
return self.get_response(request)
|
||||
|
@ -434,7 +434,7 @@ class CounterClick(CounterTabsMixin, CanViewMixin, DetailView):
|
||||
|
||||
def sum_basket(self, request):
|
||||
total = 0
|
||||
for pid, infos in request.session["basket"].items():
|
||||
for infos in request.session["basket"].values():
|
||||
total += infos["price"] * infos["qty"]
|
||||
return total / 100
|
||||
|
||||
|
@ -72,7 +72,9 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
self.logger = logging.getLogger("main")
|
||||
if options["verbosity"] < 0 or 2 < options["verbosity"]:
|
||||
warnings.warn("verbosity level should be between 0 and 2 included")
|
||||
warnings.warn(
|
||||
"verbosity level should be between 0 and 2 included", stacklevel=2
|
||||
)
|
||||
|
||||
if options["verbosity"] == 2:
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
|
@ -41,7 +41,9 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
logger = logging.getLogger("main")
|
||||
if options["verbosity"] < 0 or 2 < options["verbosity"]:
|
||||
warnings.warn("verbosity level should be between 0 and 2 included")
|
||||
warnings.warn(
|
||||
"verbosity level should be between 0 and 2 included", stacklevel=2
|
||||
)
|
||||
|
||||
if options["verbosity"] == 2:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
@ -86,7 +86,7 @@ def current_star(self) -> Optional[GalaxyStar]:
|
||||
|
||||
|
||||
# Adding a shortcut to User class for getting its star belonging to the latest ruled Galaxy
|
||||
setattr(User, "current_star", current_star)
|
||||
User.current_star = current_star
|
||||
|
||||
|
||||
class GalaxyLane(models.Model):
|
||||
|
@ -71,13 +71,15 @@ version = "1.4.25"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"I", # isort
|
||||
"B",
|
||||
"A", # shadowing of Python builtins
|
||||
"F401", # unused import
|
||||
"B",
|
||||
"C4", # use comprehensions when possible
|
||||
"I", # isort
|
||||
"DJ", # django-specific rules,
|
||||
"F401", # unused import
|
||||
"FBT", # boolean trap
|
||||
"UP008", # Use super() instead of super(__class__, self)
|
||||
"UP009" # utf-8 encoding declaration is unnecessary
|
||||
"UP009", # utf-8 encoding declaration is unnecessary
|
||||
]
|
||||
|
||||
ignore = [
|
||||
|
Loading…
Reference in New Issue
Block a user