tzdata

tzdata - Imports timezone data files from UNIX zoneinfo.

class upoints.tzdata.Zone(location, country, zone, comments=None)[source]

Bases: upoints.point.Point

Class for representing timezone descriptions from zoneinfo data.

New in version 0.6.0.

Initialise a new Zone object.

Parameters:
  • location (str) – Primary location in ISO 6709 format
  • country (str) – Location’s ISO 3166 country code
  • zone (str) – Location’s zone name as used in zoneinfo database
  • comments (list) – Location’s alternate names
class upoints.tzdata.Zones(zone_file=None)[source]

Bases: upoints.point.Points

Class for representing a group of Zone objects.

New in version 0.6.0.

Initialise a new Zones object.

dump_zone_file()[source]

Generate a zoneinfo compatible zone description table.

Returns:zoneinfo descriptions
Return type:list
import_locations(zone_file)[source]

Parse zoneinfo zone description data files.

import_locations() returns a list of Zone objects.

It expects data files in one of the following formats:

AN  +1211-06900     America/Curacao
AO  -0848+01314     Africa/Luanda
AQ  -7750+16636     Antarctica/McMurdo      McMurdo Station, Ross Island

Files containing the data in this format can be found in the zone.tab file that is normally found in /usr/share/zoneinfo on UNIX-like systems, or from the standard distribution site.

When processed by import_locations() a list object of the following style will be returned:

[Zone(None, None, "AN", "America/Curacao", None),
 Zone(None, None, "AO", "Africa/Luanda", None),
 Zone(None, None, "AO", "Antartica/McMurdo",
      ["McMurdo Station", "Ross Island"])]
Parameters:zone_file (iter) – zone.tab data to read
Returns:Locations as Zone objects
Return type:list
Raises:FileFormatError – Unknown file format