Skip to content

Commit 782f6a9

Browse files
rparolinclaude
andcommitted
chore(cuda.core): collapse nested if in Location.__post_init__ (SIM102)
ruff SIM102 flagged the host/host_numa_current branch: elif self.kind in ("host", "host_numa_current"): if self.id is not None: raise ValueError(...) into a single condition with `and`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3176271 commit 782f6a9

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

cuda_core/cuda/core/_memory/_managed_location.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ def __post_init__(self) -> None:
3030
elif self.kind == "host_numa":
3131
if not isinstance(self.id, int) or self.id < 0:
3232
raise ValueError("host_numa id must be >= 0")
33-
elif self.kind in ("host", "host_numa_current"):
34-
if self.id is not None:
35-
raise ValueError(f"{self.kind} location must have id=None")
33+
elif self.kind in ("host", "host_numa_current") and self.id is not None:
34+
raise ValueError(f"{self.kind} location must have id=None")
3635

3736
@classmethod
3837
def device(cls, device_id: int) -> Location:

0 commit comments

Comments
 (0)