38
38
SEC_PER_HOUR = SEC_PER_MIN * MIN_PER_HOUR
39
39
SEC_PER_DAY = SEC_PER_HOUR * HOURS_PER_DAY
40
40
41
- MUSEC_PER_DAY = 1e6 * SEC_PER_DAY
41
+ MUSEC_PER_DAY = 10 ** 6 * SEC_PER_DAY
42
42
43
43
_mpl_units = {} # Cache for units overwritten by us
44
44
@@ -116,7 +116,7 @@ def deregister():
116
116
117
117
118
118
def _to_ordinalf (tm : pydt .time ) -> float :
119
- tot_sec = tm .hour * 3600 + tm .minute * 60 + tm .second + float ( tm .microsecond / 1e6 )
119
+ tot_sec = tm .hour * 3600 + tm .minute * 60 + tm .second + tm .microsecond / 10 ** 6
120
120
return tot_sec
121
121
122
122
@@ -182,7 +182,7 @@ def __call__(self, x, pos=0) -> str:
182
182
"""
183
183
fmt = "%H:%M:%S.%f"
184
184
s = int (x )
185
- msus = int ( round ((x - s ) * 1e6 ) )
185
+ msus = round ((x - s ) * 10 ** 6 )
186
186
ms = msus // 1000
187
187
us = msus % 1000
188
188
m , s = divmod (s , 60 )
@@ -429,7 +429,7 @@ def _from_ordinal(x, tz: Optional[tzinfo] = None) -> datetime:
429
429
hour , remainder = divmod (24 * remainder , 1 )
430
430
minute , remainder = divmod (60 * remainder , 1 )
431
431
second , remainder = divmod (60 * remainder , 1 )
432
- microsecond = int (1e6 * remainder )
432
+ microsecond = int (1_000_000 * remainder )
433
433
if microsecond < 10 :
434
434
microsecond = 0 # compensate for rounding errors
435
435
dt = datetime (
@@ -439,7 +439,7 @@ def _from_ordinal(x, tz: Optional[tzinfo] = None) -> datetime:
439
439
dt = dt .astimezone (tz )
440
440
441
441
if microsecond > 999990 : # compensate for rounding errors
442
- dt += timedelta (microseconds = 1e6 - microsecond )
442
+ dt += timedelta (microseconds = 1_000_000 - microsecond )
443
443
444
444
return dt
445
445
@@ -611,27 +611,27 @@ def _second_finder(label_interval):
611
611
info_fmt [day_start ] = "%H:%M:%S\n %d-%b"
612
612
info_fmt [year_start ] = "%H:%M:%S\n %d-%b\n %Y"
613
613
614
- if span < periodsperday / 12000.0 :
614
+ if span < periodsperday / 12000 :
615
615
_second_finder (1 )
616
- elif span < periodsperday / 6000.0 :
616
+ elif span < periodsperday / 6000 :
617
617
_second_finder (2 )
618
- elif span < periodsperday / 2400.0 :
618
+ elif span < periodsperday / 2400 :
619
619
_second_finder (5 )
620
- elif span < periodsperday / 1200.0 :
620
+ elif span < periodsperday / 1200 :
621
621
_second_finder (10 )
622
- elif span < periodsperday / 800.0 :
622
+ elif span < periodsperday / 800 :
623
623
_second_finder (15 )
624
- elif span < periodsperday / 400.0 :
624
+ elif span < periodsperday / 400 :
625
625
_second_finder (30 )
626
- elif span < periodsperday / 150.0 :
626
+ elif span < periodsperday / 150 :
627
627
_minute_finder (1 )
628
- elif span < periodsperday / 70.0 :
628
+ elif span < periodsperday / 70 :
629
629
_minute_finder (2 )
630
- elif span < periodsperday / 24.0 :
630
+ elif span < periodsperday / 24 :
631
631
_minute_finder (5 )
632
- elif span < periodsperday / 12.0 :
632
+ elif span < periodsperday / 12 :
633
633
_minute_finder (15 )
634
- elif span < periodsperday / 6.0 :
634
+ elif span < periodsperday / 6 :
635
635
_minute_finder (30 )
636
636
elif span < periodsperday / 2.5 :
637
637
_hour_finder (1 , False )
@@ -1058,7 +1058,7 @@ def format_timedelta_ticks(x, pos, n_decimals: int) -> str:
1058
1058
"""
1059
1059
Convert seconds to 'D days HH:MM:SS.F'
1060
1060
"""
1061
- s , ns = divmod (x , 1e9 )
1061
+ s , ns = divmod (x , 10 ** 9 )
1062
1062
m , s = divmod (s , 60 )
1063
1063
h , m = divmod (m , 60 )
1064
1064
d , h = divmod (h , 24 )
@@ -1072,7 +1072,7 @@ def format_timedelta_ticks(x, pos, n_decimals: int) -> str:
1072
1072
1073
1073
def __call__ (self , x , pos = 0 ) -> str :
1074
1074
(vmin , vmax ) = tuple (self .axis .get_view_interval ())
1075
- n_decimals = int (np .ceil (np .log10 (100 * 1e9 / abs (vmax - vmin ))))
1075
+ n_decimals = int (np .ceil (np .log10 (100 * 10 ** 9 / abs (vmax - vmin ))))
1076
1076
if n_decimals > 9 :
1077
1077
n_decimals = 9
1078
1078
return self .format_timedelta_ticks (x , pos , n_decimals )
0 commit comments