aboutsummaryrefslogtreecommitdiff
path: root/challenge-285/ppentchev/python/src/perl_weekly_285/defs.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-285/ppentchev/python/src/perl_weekly_285/defs.py')
-rw-r--r--challenge-285/ppentchev/python/src/perl_weekly_285/defs.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/challenge-285/ppentchev/python/src/perl_weekly_285/defs.py b/challenge-285/ppentchev/python/src/perl_weekly_285/defs.py
new file mode 100644
index 0000000000..26d7ea59c6
--- /dev/null
+++ b/challenge-285/ppentchev/python/src/perl_weekly_285/defs.py
@@ -0,0 +1,34 @@
+# SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
+# SPDX-License-Identifier: BSD-2-Clause
+"""Common definitions for the perl-weekly-285 library."""
+
+from __future__ import annotations
+
+import dataclasses
+import typing
+
+
+if typing.TYPE_CHECKING:
+ from typing import Final
+
+
+VERSION: Final = "0.1.0"
+"""The perl-weekly-285 library version, semver-like."""
+
+
+@dataclasses.dataclass
+class Error(Exception):
+ """An error that occurred during the processing."""
+
+ def __str__(self) -> str:
+ """Provide a human-readable error message."""
+ return f"{type(self).__str__} must be overridden for {self!r}"
+
+
+@dataclasses.dataclass
+class NoSolutionError(Error):
+ """No solution could be found."""
+
+ def __str__(self) -> str:
+ """Provide a human-readable error message."""
+ return f"Could not find a solution: {self!r}"