Skip to content

Commit

Permalink
Make ruff complain less
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Feb 5, 2024
1 parent b041e7c commit 6591d02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 2 additions & 4 deletions debug_toolbar/panels/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ def func_std_string(self): # match what old profile produced
)

def subfuncs(self):
i = 0
h, s, v = self.hsv
count = len(self.statobj.all_callees[self.func])
for func, stats in self.statobj.all_callees[self.func].items():
i += 1
h1 = h + (i / count) / (self.depth + 1)
for i, (func, stats) in enumerate(self.statobj.all_callees[self.func].items()):
h1 = h + ((i + 1) / count) / (self.depth + 1)
s1 = 0 if stats[3] == 0 else s * (stats[3] / self.stats[3])
yield FunctionCall(
self.statobj,
Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ packages = ["debug_toolbar"]
path = "debug_toolbar/__init__.py"

[tool.ruff]
fix = true
show-fixes = true
target-version = "py38"

[tool.ruff.lint]
extend-select = [
"ASYNC", # flake8-async
"B", # flake8-bugbear
Expand All @@ -75,17 +80,14 @@ extend-ignore = [
"E501", # Ignore line length violations
"SIM108", # Use ternary operator instead of if-else-block
]
fix = true
show-fixes = true
target-version = "py38"

[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 16

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"*/migrat*/*" = [
"N806", # Allow using PascalCase model names in migrations
"N999", # Ignore the fact that migration files are invalid module names
Expand Down

0 comments on commit 6591d02

Please sign in to comment.