diff --git a/pygitweb/actions.py b/pygitweb/actions.py
index 1a958b2..748dd56 100644
--- a/pygitweb/actions.py
+++ b/pygitweb/actions.py
@@ -91,10 +91,11 @@ def _format_date(epoch: int | None, tz_offset: int | None = None) -> str:
 	if epoch is None:
 		return ""
 	try:
-		if tz_offset is not None:
-			tz = timezone(timedelta(seconds=tz_offset * 60))
-		else:
-			tz = UTC
+		tz = (
+			timezone(timedelta(seconds=tz_offset * 60))
+			if tz_offset is not None
+			else UTC
+		)
 		dt = datetime.fromtimestamp(epoch, tz=tz)
 		return dt.strftime("%Y-%m-%d %H:%M:%S")
 	except (ValueError, OSError):
diff --git a/pygitweb/git_helpers.py b/pygitweb/git_helpers.py
index 59a33f1..84f0ed7 100644
--- a/pygitweb/git_helpers.py
+++ b/pygitweb/git_helpers.py
@@ -544,10 +544,11 @@ def get_commit_unified_diff(project: str, h: str) -> tuple[str, str]:
 	"""
 	repo = open_repo(project)
 	commit = repo.revparse_single(h).peel(pygit2.Commit)
-	if commit.parents:
-		diff = repo.diff(commit.parents[0], commit)
-	else:
-		diff = commit.tree.diff_to_tree(swap=True)
+	diff = (
+		repo.diff(commit.parents[0], commit)
+		if commit.parents
+		else commit.tree.diff_to_tree(swap=True)
+	)
 	body = diff.patch or ""
 	oid_short = commit.short_id[:7] if len(commit.short_id) >= 7 else commit.short_id
 	return body, oid_short
diff --git a/pygitweb/projects.py b/pygitweb/projects.py
index 5fe0527..91c9019 100644
--- a/pygitweb/projects.py
+++ b/pygitweb/projects.py
@@ -42,10 +42,7 @@ def _find_projects_in_dir(
 	result = []
 	for dirpath, dirnames, _ in os.walk(root, topdown=True):
 		rel = os.path.relpath(dirpath, root)
-		if rel == ".":
-			depth = 0
-		else:
-			depth = rel.count(os.sep) + 1
+		depth = 0 if rel == "." else rel.count(os.sep) + 1
 		if depth >= maxdepth:
 			dirnames.clear()
 			continue
