'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Pacific-New', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu'] all_timezones = LazyList( tz for tz in all_timezones if resource_exists(tz)) all_timezones_set = LazySet(all_timezones) common_timezones = \ ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura',
def setUp(self): self.base = [3, 2, 1] self.lesser = [2, 1, 0] self.greater = [4, 3, 2] self.lazy = LazyList(iter(list(self.base)))
def test_bool(self): self.assertTrue(bool(self.lazy)) self.assertFalse(bool(LazyList())) self.assertFalse(bool(LazyList(iter([]))))
continue pieces = line.rstrip().split(None, 3) code, coordinates, zone = pieces[:3] comment = len(pieces) == 4 and pieces[3] or '' if zone not in all_timezones_set: continue coordinates = _parse_iso6709(coordinates) if not coordinates: continue lat, lon = coordinates yield zonetype(code, (lat, lon), zone, comment) zone_tab = LazyList(_zone_tab()) def _parse_iso6709(iso6709): match = re.match('^([-+][0-9]+)([-+][0-9]+)$', iso6709) if not match: return return map(_parse_iso6709_coord, match.groups()) def _parse_iso6709_coord(coord): if len(coord) % 2: deg = float(coord[:3]) coord = coord[3:] else: deg = float(coord[:4])