Skip to content

Commit

Permalink
ruff rule B
Browse files Browse the repository at this point in the history
  • Loading branch information
imperosol committed Jul 8, 2024
1 parent 2ac578c commit c6d2ac9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
setattr(_threadlocal, "request", request)
_threadlocal.request = request
return self.get_response(request)
2 changes: 1 addition & 1 deletion counter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def get_price(self, pid):

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

Expand Down
4 changes: 3 additions & 1 deletion galaxy/management/commands/generate_galaxy_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def add_arguments(self, parser):
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)
Expand Down
4 changes: 3 additions & 1 deletion galaxy/management/commands/rule_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion galaxy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit c6d2ac9

Please sign in to comment.