parameters: (self, filename, lat_long_data)
return_statement: return zone_data
docstring: Read a single zone's ICS files.
  
          We keep only the lines we want, and we use the pure version of RRULE if
          the versions differ. See Asia/Jerusalem for an example.
docstring_summary: Read a single zone's ICS files.
docstring_tokens: Read a single zone s ICS files .
function: def read_ics(self, filename, lat_long_data):
          """Read a single zone's ICS files.
  
          We keep only the lines we want, and we use the pure version of RRULE if
          the versions differ. See Asia/Jerusalem for an example."""
          with open(os.path.join(self.zoneinfo_path, filename), "r") as zone:
              zoneinfo = zone.readlines()
  
          with open(os.path.join(self.zoneinfo_pure_path, filename), "r") as zone:
              zoneinfo_pure = zone.readlines()
  
          ics_data = []
          for i in range(0, len(zoneinfo)):
              line = zoneinfo[i]
              key = line[:line.find(":")]
  
              if key == "BEGIN":
                  if line != "BEGIN:VCALENDAR\r\n":
                      ics_data.append(line)
              elif key == "END":
                  if line != "END:VCALENDAR\r\n":
                      ics_data.append(line)
              elif key in ("TZID", "TZOFFSETFROM", "TZOFFSETTO", "TZNAME", "DTSTART"):
                  ics_data.append(line)
              elif key == "RRULE":
                  if line == zoneinfo_pure[i]:
                      ics_data.append(line)
                  else:
                      sys.stderr.write("Using pure version of %s\n" % filename[:-4])
                      ics_data.append(zoneinfo_pure[i])
  
          zone_data = {
              "ics": "".join(ics_data).rstrip()
          }
          zone_name = filename[:-4]
          if zone_name in lat_long_data:
              zone_data["latitude"] = lat_long_data[zone_name][0]
              zone_data["longitude"] = lat_long_data[zone_name][1]
  
          return zone_data
function_tokens: def read_ics ( self , filename , lat_long_data ) : with open ( os . path . join ( self . zoneinfo_path , filename ) , "r" ) as zone : zoneinfo = zone . readlines ( ) with open ( os . path . join ( self . zoneinfo_pure_path , filename ) , "r" ) as zone : zoneinfo_pure = zone . readlines ( ) ics_data = [ ] for i in range ( 0 , len ( zoneinfo ) ) : line = zoneinfo [ i ] key = line [ : line . find ( ":" ) ] if key == "BEGIN" : if line != "BEGIN:VCALENDAR\r\n" : ics_data . append ( line ) elif key == "END" : if line != "END:VCALENDAR\r\n" : ics_data . append ( line ) elif key in ( "TZID" , "TZOFFSETFROM" , "TZOFFSETTO" , "TZNAME" , "DTSTART" ) : ics_data . append ( line ) elif key == "RRULE" : if line == zoneinfo_pure [ i ] : ics_data . append ( line ) else : sys . stderr . write ( "Using pure version of %s\n" % filename [ : - 4 ] ) ics_data . append ( zoneinfo_pure [ i ] ) zone_data = { "ics" : "" . join ( ics_data ) . rstrip ( ) } zone_name = filename [ : - 4 ] if zone_name in lat_long_data : zone_data [ "latitude" ] = lat_long_data [ zone_name ] [ 0 ] zone_data [ "longitude" ] = lat_long_data [ zone_name ] [ 1 ] return zone_data