pytzpure/tz_descriptor.py
def create_from_pytz(cls, tz_info):
        """Create an instance using the result of the timezone() call in 
        "pytz".
        """

        zone_name = tz_info.zone

        utc_transition_times_list_raw = getattr(tz_info, 
                                                '_utc_transition_times', 
                                                None)

        utc_transition_times_list = [tuple(utt.timetuple()) 
                                     for utt 
                                     in utc_transition_times_list_raw] \
                                    if utc_transition_times_list_raw is not None \
                                    else None
        
        transition_info_list_raw = getattr(tz_info, 
                                           '_transition_info', 
                                           None)

        transition_info_list = [(utcoffset_td.total_seconds(), 
                                 dst_td.total_seconds(), 
                                 tzname)
                                for (utcoffset_td, dst_td, tzname)
                                in transition_info_list_raw] \
                               if transition_info_list_raw is not None \
                               else None

        try:
            utcoffset_dt = tz_info._utcoffset
        except AttributeError:
            utcoffset = None
        else:
            utcoffset = utcoffset_dt.total_seconds()

        tzname = getattr(tz_info, '_tzname', None)

        parent_class_name = getmro(tz_info.__class__)[1].__name__
        return cls(zone_name, parent_class_name, utc_transition_times_list, 
                   transition_info_list, utcoffset, tzname)
def create_from_pytz(cls, tz_info):
        """Create an instance using the result of the timezone() call in 
        "pytz".
        """

        zone_name = tz_info.zone

        utc_transition_times_list_raw = getattr(tz_info, 
                                                '_utc_transition_times', 
                                                None)

        utc_transition_times_list = [tuple(utt.timetuple()) 
                                     for utt 
                                     in utc_transition_times_list_raw] \
                                    if utc_transition_times_list_raw is not None \
                                    else None
        
        transition_info_list_raw = getattr(tz_info, 
                                           '_transition_info', 
                                           None)

        transition_info_list = [(utcoffset_td.total_seconds(), 
                                 dst_td.total_seconds(), 
                                 tzname)
                                for (utcoffset_td, dst_td, tzname)
                                in transition_info_list_raw] \
                               if transition_info_list_raw is not None \
                               else None

        try:
            utcoffset_dt = tz_info._utcoffset
        except AttributeError:
            utcoffset = None
        else:
            utcoffset = utcoffset_dt.total_seconds()

        tzname = getattr(tz_info, '_tzname', None)

        parent_class_name = getmro(tz_info.__class__)[1].__name__
        return cls(zone_name, parent_class_name, utc_transition_times_list, 
                   transition_info_list, utcoffset, tzname)
Create an instance using the result of the timezone() call in 
        "pytz".