Package upoints :: Module tzdata :: Class Zone
[hide private]
[frames] | no frames]

Class Zone

 object --+    
          |    
point.Point --+
              |
             Zone

Class for representing timezone descriptions from zoneinfo data

Since: 0.6.0

Instance Methods [hide private]
 
__init__(self, location, country, zone, comments=None)
Initialise a new Zone object
str
__repr__(self)
Self-documenting string representation
str
__str__(self, mode='dms')
Pretty printed location string

Inherited from point.Point: __dict__, __eq__, __hash__, __ne__, __unicode__, bearing, destination, distance, final_bearing, forward, inverse, midpoint, sun_events, sunrise, sunset, to_grid_locator

Inherited from point.Point (private): _set_location

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

Instance Variables [hide private]
  comments
Location comments
  country
Location's ISO 3166 country code
  latitude
Location's latitude
  longitude
Locations's longitude
  zone
Location's zone name as used in zoneinfo database

Inherited from point.Point: rad_latitude, rad_longitude, timezone, units

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, location, country, zone, comments=None)
(Constructor)

 

Initialise a new Zone object

>>> Zone("+513030-0000731", 'GB', "Europe/London")
Zone('+513030-0000730', 'GB', 'Europe/London', None)
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 databse
  • comments (list) - Location's alternate names
Raises:
  • ValueError - Unknown value for angle
  • ValueError - Unknown value for units
  • ValueError - Invalid value for latitude or longitude
Overrides: object.__init__

__repr__(self)
(Representation operator)

 

Self-documenting string representation

>>> Zone("+513030-0000731", 'GB', "Europe/London")
Zone('+513030-0000730', 'GB', 'Europe/London', None)
Returns: str
String to recreate Zone object
Overrides: object.__repr__

__str__(self, mode='dms')
(Informal representation operator)

 

Pretty printed location string

>>> print(Zone("+513030-0000731", 'GB', "Europe/London"))
Europe/London (GB: 51°30'30"N, 000°07'30"W)
>>> print(Zone("+0658-15813", "FM", "Pacific/Ponape",
...            ["Ponape (Pohnpei)", ]))
Pacific/Ponape (FM: 06°58'00"N, 158°13'00"W also Ponape (Pohnpei))
Parameters:
  • mode (str) - Coordinate formatting system to use
Returns: str
Human readable string representation of Zone object
Raises:
  • ValueError - Unknown value for mode
Overrides: object.__str__