(tzinfo1, tzinfo2, startYear=2000, endYear=2020)
return True
Compare offsets and DST transitions from startYear to endYear.
Compare offsets and DST transitions from startYear to endYear.
Compare offsets and DST transitions from startYear to endYear .
def tzinfo_eq(tzinfo1, tzinfo2, startYear=2000, endYear=2020):
    """
    Compare offsets and DST transitions from startYear to endYear.
    """
    if tzinfo1 == tzinfo2:
        return True
    elif tzinfo1 is None or tzinfo2 is None:
        return False

    def dt_test(dt):
        if dt is None:
            return True
        return tzinfo1.utcoffset(dt) == tzinfo2.utcoffset(dt)

    if not dt_test(datetime.datetime(startYear, 1, 1)):
        return False
    for year in range(startYear, endYear):
        for transitionTo in 'daylight', 'standard':
            t1 = getTransition(transitionTo, year, tzinfo1)
            t2 = getTransition(transitionTo, year, tzinfo2)
            if t1 != t2 or not dt_test(t1):
                return False
    return True
def tzinfo_eq ( tzinfo1 , tzinfo2 , startYear = 2000 , endYear = 2020 ) : if tzinfo1 == tzinfo2 : return True elif tzinfo1 is None or tzinfo2 is None : return False def dt_test ( dt ) : if dt is None : return True return tzinfo1 . utcoffset ( dt ) == tzinfo2 . utcoffset ( dt ) if not dt_test ( datetime . datetime ( startYear , 1 , 1 ) ) : return False for year in range ( startYear , endYear ) : for transitionTo in 'daylight' , 'standard' : t1 = getTransition ( transitionTo , year , tzinfo1 ) t2 = getTransition ( transitionTo , year , tzinfo2 ) if t1 != t2 or not dt_test ( t1 ) : return False return True