summaryrefslogtreecommitdiffstats
path: root/pendulum/tz/exceptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'pendulum/tz/exceptions.py')
-rw-r--r--pendulum/tz/exceptions.py55
1 files changed, 32 insertions, 23 deletions
diff --git a/pendulum/tz/exceptions.py b/pendulum/tz/exceptions.py
index d1572f9..b8833ac 100644
--- a/pendulum/tz/exceptions.py
+++ b/pendulum/tz/exceptions.py
@@ -1,23 +1,32 @@
-class TimezoneError(ValueError):
-
- pass
-
-
-class NonExistingTime(TimezoneError):
-
- message = "The datetime {} does not exist."
-
- def __init__(self, dt):
- message = self.message.format(dt)
-
- super(NonExistingTime, self).__init__(message)
-
-
-class AmbiguousTime(TimezoneError):
-
- message = "The datetime {} is ambiguous."
-
- def __init__(self, dt):
- message = self.message.format(dt)
-
- super(AmbiguousTime, self).__init__(message)
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from datetime import datetime
+
+
+class TimezoneError(ValueError):
+ pass
+
+
+class InvalidTimezone(TimezoneError):
+ pass
+
+
+class NonExistingTime(TimezoneError):
+ message = "The datetime {} does not exist."
+
+ def __init__(self, dt: datetime) -> None:
+ message = self.message.format(dt)
+
+ super().__init__(message)
+
+
+class AmbiguousTime(TimezoneError):
+ message = "The datetime {} is ambiguous."
+
+ def __init__(self, dt: datetime) -> None:
+ message = self.message.format(dt)
+
+ super().__init__(message)