chore: clean some isinstance (#37602)

Co-authored-by: WH-2099 <wh2099@pm.me>
This commit is contained in:
Asuka Minato
2026-06-22 03:51:21 +00:00
committed by GitHub
co-authored by WH-2099
parent 265dc54c51
commit d5cdb2e6f1
3 changed files with 38 additions and 36 deletions
+7 -6
View File
@@ -74,12 +74,13 @@ def accept_subjects(*accepted: SubjectType) -> Callable[[F], F]:
def _coerce_subject_type(raw: object) -> SubjectType | None:
if raw is None:
return None
if isinstance(raw, SubjectType):
return raw
if isinstance(raw, str):
return SubjectType(raw)
match raw:
case None:
return None
case SubjectType():
return raw
case str():
return SubjectType(raw)
return None