nats-py
Advanced tools
+1
-1
| Metadata-Version: 2.4 | ||
| Name: nats-py | ||
| Version: 2.13.0 | ||
| Version: 2.13.1 | ||
| Summary: NATS client for Python | ||
@@ -5,0 +5,0 @@ Author-email: Waldemar Quevedo <wally@synadia.com> |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "nats-py" | ||
| version = "2.13.0" | ||
| version = "2.13.1" | ||
| authors = [ | ||
@@ -10,0 +10,0 @@ { name="Waldemar Quevedo", email="wally@synadia.com" }, |
| Metadata-Version: 2.4 | ||
| Name: nats-py | ||
| Version: 2.13.0 | ||
| Version: 2.13.1 | ||
| Summary: NATS client for Python | ||
@@ -5,0 +5,0 @@ Author-email: Waldemar Quevedo <wally@synadia.com> |
+14
-17
@@ -88,2 +88,14 @@ # Copyright 2021 The NATS Authors | ||
| @staticmethod | ||
| def _parse_utc_iso(time_string: str) -> datetime.datetime: | ||
| """Parse an ISO 8601 timestamp (with nanoseconds) into a UTC datetime.""" | ||
| # Replace Z with UTC offset | ||
| s = time_string.replace("Z", "+00:00") | ||
| # Trim fractional seconds to 6 digits (microsecond precision) | ||
| date_part, frac_tz = s.split(".", 1) | ||
| frac, tz = frac_tz.split("+") | ||
| frac = frac[:6] # keep only microseconds | ||
| s = f"{date_part}.{frac}+{tz}" | ||
| return datetime.datetime.fromisoformat(s).astimezone(datetime.timezone.utc) | ||
| @classmethod | ||
@@ -396,5 +408,3 @@ def from_response(cls: type[_B], resp: Dict[str, Any]) -> _B: | ||
| if "leader_since" in resp and resp["leader_since"]: | ||
| resp["leader_since"] = datetime.datetime.fromisoformat( | ||
| cls._python38_iso_parsing(resp["leader_since"]) | ||
| ).astimezone(datetime.timezone.utc) | ||
| resp["leader_since"] = cls._parse_utc_iso(resp["leader_since"]) | ||
| return super().from_response(resp) | ||
@@ -717,17 +727,4 @@ | ||
| @classmethod | ||
| def _python38_iso_parsing(cls, time_string: str): | ||
| # Replace Z with UTC offset | ||
| s = time_string.replace("Z", "+00:00") | ||
| # Trim fractional seconds to 6 digits | ||
| date_part, frac_tz = s.split(".", 1) | ||
| frac, tz = frac_tz.split("+") | ||
| frac = frac[:6] # keep only microseconds | ||
| s = f"{date_part}.{frac}+{tz}" | ||
| return s | ||
| @classmethod | ||
| def from_response(cls, resp: Dict[str, Any]): | ||
| resp["time"] = datetime.datetime.fromisoformat(cls._python38_iso_parsing(resp["time"])).astimezone( | ||
| datetime.timezone.utc | ||
| ) | ||
| resp["time"] = cls._parse_utc_iso(resp["time"]) | ||
| return super().from_response(resp) | ||
@@ -734,0 +731,0 @@ |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
655531
0.22%15772
0.24%