From d9c5f16e052ffd6aa17810c2aa79069c734c256a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 3 Jul 2024 17:24:35 +0200 Subject: [PATCH] add assertion if FlakeId has wrong value --- pkgs/clan-cli/clan_cli/clan_uri.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/clan_uri.py b/pkgs/clan-cli/clan_cli/clan_uri.py index 3cdc2154..c1d5aaf0 100644 --- a/pkgs/clan-cli/clan_cli/clan_uri.py +++ b/pkgs/clan-cli/clan_cli/clan_uri.py @@ -12,6 +12,11 @@ class FlakeId: # FIXME: this is such a footgun if you accidnetally pass a string _value: str | Path + def __post_init__(self) -> None: + assert isinstance( + self._value, str | Path + ), f"Flake {self._value} has an invalid type: {type(self._value)}" + def __str__(self) -> str: return str( self._value