From 79c32fcef4eea7f7572318a3d7a361b0cedfbe79 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 12 Apr 2026 18:09:21 -0400 Subject: [PATCH] Remove dead or-empty-string in format detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The \`or \"\"\` in \`\"yaml\" in self.mimetype or \"\"\` was a no-op that made the logic harder to read. The \`in\` check on mimetype already returns a bool — \`or \"\"\` just evaluates to that bool. Co-Authored-By: Claude Opus 4.6 (1M context) --- responder/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/responder/models.py b/responder/models.py index 3110acc..9a24228 100644 --- a/responder/models.py +++ b/responder/models.py @@ -308,8 +308,8 @@ class Request: """ if format is None: - format = "yaml" if "yaml" in self.mimetype or "" else "json" # noqa: A001 - format = "form" if "form" in self.mimetype or "" else format # noqa: A001 + format = "yaml" if "yaml" in self.mimetype else "json" # noqa: A001 + format = "form" if "form" in self.mimetype else format # noqa: A001 formatter: Callable if isinstance(format, str):