From 3516cda40c8fc89712807a074d033eeeaf131b64 Mon Sep 17 00:00:00 2001 From: Victor Lin Date: Wed, 15 Apr 2026 13:41:04 -0700 Subject: [PATCH 1/2] Add custom repr to LaxVersion This is more robust than relying on repr from the base class which may change across versions. --- nextstrain/cli/util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nextstrain/cli/util.py b/nextstrain/cli/util.py index 331bb1bf..eab538c7 100644 --- a/nextstrain/cli/util.py +++ b/nextstrain/cli/util.py @@ -891,6 +891,9 @@ def __init__(self, version: str, *, compliant: bool, original: str = None): self.compliant = compliant self.original = original if original is not None else version + def __repr__(self) -> str: + return f"" + T = TypeVar("T") From 12220302d55648d40b667c808e74e8a811229886 Mon Sep 17 00:00:00 2001 From: Victor Lin Date: Wed, 15 Apr 2026 13:42:54 -0700 Subject: [PATCH 2/2] Show custom class name in repr To distinguish the custom class from its base class. --- nextstrain/cli/util.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nextstrain/cli/util.py b/nextstrain/cli/util.py index eab538c7..5b196ab3 100644 --- a/nextstrain/cli/util.py +++ b/nextstrain/cli/util.py @@ -821,15 +821,15 @@ def parse_version_lax(version: str) -> 'LaxVersion': ``0.dev0`` so it compares lowest against other public version identifiers. >>> parse_version_lax("1.2.3") - + >>> parse_version_lax("1.2.3-nope") - + >>> parse_version_lax("20221019T172207Z") - + >>> parse_version_lax("@invalid+@") - + >>> parse_version_lax("not@@ok") - + >>> parse_version_lax("20221019T172207Z") < parse_version_lax("20230525T143814Z") True """ @@ -892,7 +892,7 @@ def __init__(self, version: str, *, compliant: bool, original: str = None): self.original = original if original is not None else version def __repr__(self) -> str: - return f"" + return f"" T = TypeVar("T")