@@ -564,9 +564,9 @@ def dateDelta(self, other):
564564 sign = - 1
565565 diff = - diff
566566 S = diff % 60
567- M = (diff / 60 )% 60
568- H = (diff / (60 * 60 ))% 24
569- d = diff / (24 * 60 * 60 )
567+ M = (diff // 60 )% 60
568+ H = (diff // (60 * 60 ))% 24
569+ d = diff // (24 * 60 * 60 )
570570 return Interval ((0 , 0 , d , H , M , S ), sign = sign ,
571571 translator = self .translator )
572572
@@ -895,7 +895,7 @@ def __sub__(self, other):
895895 # nope, no idea what to do with this other...
896896 raise TypeError ("Can't add %r" % other )
897897
898- def __div__ (self , other ):
898+ def __truediv__ (self , other ):
899899 """ Divide this interval by an int value.
900900
901901 Can't divide years and months sensibly in the _same_
@@ -918,7 +918,7 @@ def __div__(self, other):
918918
919919 sign = months < 0 and - 1 or 1
920920 m = months % 12
921- y = months / 12
921+ y = months // 12
922922 return Interval ((sign , y , m , 0 , 0 , 0 , 0 ),
923923 translator = self .translator )
924924
@@ -932,21 +932,23 @@ def __div__(self, other):
932932 sign = seconds < 0 and - 1 or 1
933933 seconds *= sign
934934 S = seconds % 60
935- seconds /= 60
935+ seconds // = 60
936936 M = seconds % 60
937- seconds /= 60
937+ seconds // = 60
938938 H = seconds % 24
939- d = seconds / 24
939+ d = seconds // 24
940940 return Interval ((sign , 0 , 0 , d , H , M , S ),
941941 translator = self .translator )
942+ # Python 2 compatibility:
943+ __div__ = __truediv__
942944
943945 def __repr__ (self ):
944946 return '<Interval %s>' % self .__str__ ()
945947
946948 def pretty (self ):
947949 ''' print up the date date using one of these nice formats..
948950 '''
949- _quarters = self .minute / 15
951+ _quarters = self .minute // 15
950952 if self .year :
951953 s = self .ngettext ("%(number)s year" , "%(number)s years" ,
952954 self .year ) % {'number' : self .year }
@@ -1040,11 +1042,11 @@ def from_seconds(self, val):
10401042 else :
10411043 self .sign = 1
10421044 self .second = val % 60
1043- val = val / 60
1045+ val = val // 60
10441046 self .minute = val % 60
1045- val = val / 60
1047+ val = val // 60
10461048 self .hour = val % 24
1047- val = val / 24
1049+ val = val // 24
10481050 self .day = val
10491051 self .month = self .year = 0
10501052
@@ -1079,17 +1081,17 @@ def fixTimeOverflow(time):
10791081 sign = seconds < 0 and - 1 or 1
10801082 seconds *= sign
10811083 S = seconds % 60
1082- seconds /= 60
1084+ seconds // = 60
10831085 M = seconds % 60
1084- seconds /= 60
1086+ seconds // = 60
10851087 H = seconds % 24
1086- d = seconds / 24
1088+ d = seconds // 24
10871089 else :
10881090 months = y * 12 + m
10891091 sign = months < 0 and - 1 or 1
10901092 months *= sign
10911093 m = months % 12
1092- y = months / 12
1094+ y = months // 12
10931095
10941096 return (sign , y , m , d , H , M , S )
10951097
0 commit comments