@@ -1349,8 +1349,7 @@ def parse_date(
13491349 month_idx = format_str .index ('l' )
13501350 day_idx = format_str .index ('d' )
13511351
1352- indexes = [(year_idx , 'Y' ), (month_idx , 'M' ), (day_idx , 'D' )]
1353- indexes .sort ()
1352+ indexes = sorted ([(year_idx , 'Y' ), (month_idx , 'M' ), (day_idx , 'D' )])
13541353 indexes = {item [1 ]: idx for idx , item in enumerate (indexes )}
13551354
13561355 # FIXME: this currently only supports numbers, but should also support month
@@ -1399,8 +1398,7 @@ def parse_time(
13991398 min_idx = format_str .index ('m' )
14001399 sec_idx = format_str .index ('s' )
14011400
1402- indexes = [(hour_idx , 'H' ), (min_idx , 'M' ), (sec_idx , 'S' )]
1403- indexes .sort ()
1401+ indexes = sorted ([(hour_idx , 'H' ), (min_idx , 'M' ), (sec_idx , 'S' )])
14041402 indexes = {item [1 ]: idx for idx , item in enumerate (indexes )}
14051403
14061404 # TODO: support time zones
@@ -1436,7 +1434,7 @@ def __str__(self) -> str:
14361434 return pat
14371435
14381436 def __mod__ (self , other : DateTimeFormat ) -> str :
1439- if type (other ) is not DateTimeFormat :
1437+ if not isinstance (other , DateTimeFormat ) :
14401438 return NotImplemented
14411439 return self .format % other
14421440
@@ -1829,7 +1827,7 @@ def parse_pattern(pattern: str) -> DateTimePattern:
18291827
18301828 :param pattern: the formatting pattern to parse
18311829 """
1832- if type (pattern ) is DateTimePattern :
1830+ if isinstance (pattern , DateTimePattern ) :
18331831 return pattern
18341832
18351833 if pattern in _pattern_cache :
0 commit comments