@autorest/python 6.4.13 → 6.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,32 +58,35 @@ def _timedelta_as_isostr(td: timedelta) -> str:
|
|
|
58
58
|
if days:
|
|
59
59
|
date_str = "%sD" % days
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if hours or minutes or seconds:
|
|
62
|
+
# Build time
|
|
63
|
+
time_str = "T"
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
# Hours
|
|
66
|
+
bigger_exists = date_str or hours
|
|
67
|
+
if bigger_exists:
|
|
68
|
+
time_str += "{:02}H".format(hours)
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
# Minutes
|
|
71
|
+
bigger_exists = bigger_exists or minutes
|
|
72
|
+
if bigger_exists:
|
|
73
|
+
time_str += "{:02}M".format(minutes)
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
# Seconds
|
|
76
|
+
try:
|
|
77
|
+
if seconds.is_integer():
|
|
78
|
+
seconds_string = "{:02}".format(int(seconds))
|
|
79
|
+
else:
|
|
80
|
+
# 9 chars long w/ leading 0, 6 digits after decimal
|
|
81
|
+
seconds_string = "%09.6f" % seconds
|
|
82
|
+
# Remove trailing zeros
|
|
83
|
+
seconds_string = seconds_string.rstrip("0")
|
|
84
|
+
except AttributeError: # int.is_integer() raises
|
|
85
|
+
seconds_string = "{:02}".format(seconds)
|
|
86
|
+
|
|
87
|
+
time_str += "{}S".format(seconds_string)
|
|
88
|
+
else:
|
|
89
|
+
time_str = ""
|
|
87
90
|
|
|
88
91
|
return "P" + date_str + time_str
|
|
89
92
|
|