<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import urllib <EOL> import gdata <EOL> import atom . service <EOL> import gdata . service <EOL> import gdata . calendar <EOL> import atom <EOL> DEFAULT_BATCH_URL = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> class Error ( Exception ) : <EOL> pass <EOL> class RequestError ( Error ) : <EOL> pass <EOL> class CalendarService ( gdata . service . GDataService ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , email = None , password = None , source = None , <EOL> server = '<STR_LIT>' , <EOL> additional_headers = None ) : <EOL> gdata . service . GDataService . __init__ ( self , email = email , password = password , <EOL> service = '<STR_LIT>' , source = source , <EOL> server = server , <EOL> additional_headers = additional_headers ) <EOL> def GetCalendarEventFeed ( self , uri = '<STR_LIT>' ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarEventFeedFromString ) <EOL> def GetCalendarEventEntry ( self , uri ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarEventEntryFromString ) <EOL> def GetCalendarListFeed ( self , uri = '<STR_LIT>' ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarListFeedFromString ) <EOL> def GetAllCalendarsFeed ( self , uri = '<STR_LIT>' ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarListFeedFromString ) <EOL> def GetOwnCalendarsFeed ( self , uri = '<STR_LIT>' ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarListFeedFromString ) <EOL> def GetCalendarListEntry ( self , uri ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarListEntryFromString ) <EOL> def GetCalendarAclFeed ( self , uri = '<STR_LIT>' ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarAclFeedFromString ) <EOL> def GetCalendarAclEntry ( self , uri ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarAclEntryFromString ) <EOL> def GetCalendarEventCommentFeed ( self , uri ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarEventCommentFeedFromString ) <EOL> def GetCalendarEventCommentEntry ( self , uri ) : <EOL> return self . Get ( uri , converter = gdata . calendar . CalendarEventCommentEntryFromString ) <EOL> def Query ( self , uri , converter = None ) : <EOL> """<STR_LIT>""" <EOL> if converter : <EOL> result = self . Get ( uri , converter = converter ) <EOL> else : <EOL> result = self . Get ( uri ) <EOL> return result <EOL> def CalendarQuery ( self , query ) : <EOL> if isinstance ( query , CalendarEventQuery ) : <EOL> return self . Query ( query . ToUri ( ) , <EOL> converter = gdata . calendar . CalendarEventFeedFromString ) <EOL> elif isinstance ( query , CalendarListQuery ) : <EOL> return self . Query ( query . ToUri ( ) , <EOL> converter = gdata . calendar . CalendarListFeedFromString ) <EOL> elif isinstance ( query , CalendarEventCommentQuery ) : <EOL> return self . Query ( query . ToUri ( ) , <EOL> converter = gdata . calendar . CalendarEventCommentFeedFromString ) <EOL> else : <EOL> return self . Query ( query . ToUri ( ) ) <EOL> def InsertEvent ( self , new_event , insert_uri , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> return self . Post ( new_event , insert_uri , url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarEventEntryFromString ) <EOL> def InsertCalendarSubscription ( self , calendar , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> insert_uri = '<STR_LIT>' <EOL> return self . Post ( calendar , insert_uri , url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarListEntryFromString ) <EOL> def InsertCalendar ( self , new_calendar , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> insert_uri = '<STR_LIT>' <EOL> response = self . Post ( new_calendar , insert_uri , url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarListEntryFromString ) <EOL> return response <EOL> def UpdateCalendar ( self , calendar , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> update_uri = calendar . GetEditLink ( ) . href <EOL> response = self . Put ( data = calendar , uri = update_uri , url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarListEntryFromString ) <EOL> return response <EOL> def InsertAclEntry ( self , new_entry , insert_uri , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> return self . Post ( new_entry , insert_uri , url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarAclEntryFromString ) <EOL> def InsertEventComment ( self , new_entry , insert_uri , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> return self . Post ( new_entry , insert_uri , url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarEventCommentEntryFromString ) <EOL> def DeleteEvent ( self , edit_uri , extra_headers = None , <EOL> url_params = None , escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> url_prefix = '<STR_LIT>' % self . server <EOL> if edit_uri . startswith ( url_prefix ) : <EOL> edit_uri = edit_uri [ len ( url_prefix ) : ] <EOL> return self . Delete ( '<STR_LIT>' % edit_uri , <EOL> url_params = url_params , escape_params = escape_params ) <EOL> def DeleteAclEntry ( self , edit_uri , extra_headers = None , <EOL> url_params = None , escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> url_prefix = '<STR_LIT>' % self . server <EOL> if edit_uri . startswith ( url_prefix ) : <EOL> edit_uri = edit_uri [ len ( url_prefix ) : ] <EOL> return self . Delete ( '<STR_LIT>' % edit_uri , <EOL> url_params = url_params , escape_params = escape_params ) <EOL> def DeleteCalendarEntry ( self , edit_uri , extra_headers = None , <EOL> url_params = None , escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> return self . Delete ( edit_uri , url_params = url_params , <EOL> escape_params = escape_params ) <EOL> def UpdateEvent ( self , edit_uri , updated_event , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> url_prefix = '<STR_LIT>' % self . server <EOL> if edit_uri . startswith ( url_prefix ) : <EOL> edit_uri = edit_uri [ len ( url_prefix ) : ] <EOL> return self . Put ( updated_event , '<STR_LIT>' % edit_uri , <EOL> url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarEventEntryFromString ) <EOL> def UpdateAclEntry ( self , edit_uri , updated_rule , url_params = None , <EOL> escape_params = True ) : <EOL> """<STR_LIT>""" <EOL> url_prefix = '<STR_LIT>' % self . server <EOL> if edit_uri . startswith ( url_prefix ) : <EOL> edit_uri = edit_uri [ len ( url_prefix ) : ] <EOL> return self . Put ( updated_rule , '<STR_LIT>' % edit_uri , <EOL> url_params = url_params , <EOL> escape_params = escape_params , <EOL> converter = gdata . calendar . CalendarAclEntryFromString ) <EOL> def ExecuteBatch ( self , batch_feed , url , <EOL> converter = gdata . calendar . CalendarEventFeedFromString ) : <EOL> """<STR_LIT>""" <EOL> return self . Post ( batch_feed , url , converter = converter ) <EOL> class CalendarEventQuery ( gdata . service . Query ) : <EOL> def __init__ ( self , user = '<STR_LIT:default>' , visibility = '<STR_LIT>' , projection = '<STR_LIT>' , <EOL> text_query = None , params = None , categories = None ) : <EOL> gdata . service . Query . __init__ ( self , <EOL> feed = '<STR_LIT>' % ( <EOL> urllib . quote ( user ) , <EOL> urllib . quote ( visibility ) , <EOL> urllib . quote ( projection ) ) , <EOL> text_query = text_query , params = params , categories = categories ) <EOL> def _GetStartMin ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetStartMin ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> start_min = property ( _GetStartMin , _SetStartMin , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetStartMax ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetStartMax ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> start_max = property ( _GetStartMax , _SetStartMax , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetOrderBy ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetOrderBy ( self , val ) : <EOL> if val is not '<STR_LIT>' and val is not '<STR_LIT>' : <EOL> raise Error , "<STR_LIT>" <EOL> self [ '<STR_LIT>' ] = val <EOL> orderby = property ( _GetOrderBy , _SetOrderBy , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetSortOrder ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetSortOrder ( self , val ) : <EOL> if ( val is not '<STR_LIT>' and val is not '<STR_LIT>' <EOL> and val is not '<STR_LIT:a>' and val is not '<STR_LIT:d>' and val is not '<STR_LIT>' <EOL> and val is not '<STR_LIT>' ) : <EOL> raise Error , "<STR_LIT>" + ( <EOL> "<STR_LIT>" ) <EOL> self [ '<STR_LIT>' ] = val <EOL> sortorder = property ( _GetSortOrder , _SetSortOrder , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetSingleEvents ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetSingleEvents ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> singleevents = property ( _GetSingleEvents , _SetSingleEvents , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetFutureEvents ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetFutureEvents ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> futureevents = property ( _GetFutureEvents , _SetFutureEvents , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetRecurrenceExpansionStart ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetRecurrenceExpansionStart ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> recurrence_expansion_start = property ( _GetRecurrenceExpansionStart , <EOL> _SetRecurrenceExpansionStart , <EOL> doc = """<STR_LIT>""" ) <EOL> def _GetRecurrenceExpansionEnd ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> def _SetRecurrenceExpansionEnd ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> recurrence_expansion_end = property ( _GetRecurrenceExpansionEnd , <EOL> _SetRecurrenceExpansionEnd , <EOL> doc = """<STR_LIT>""" ) <EOL> def _SetTimezone ( self , val ) : <EOL> self [ '<STR_LIT>' ] = val <EOL> def _GetTimezone ( self ) : <EOL> if '<STR_LIT>' in self . keys ( ) : <EOL> return self [ '<STR_LIT>' ] <EOL> else : <EOL> return None <EOL> ctz = property ( _GetTimezone , _SetTimezone , <EOL> doc = """<STR_LIT>""" ) <EOL> class CalendarListQuery ( gdata . service . Query ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , userId = None , text_query = None , <EOL> params = None , categories = None ) : <EOL> if userId is None : <EOL> userId = '<STR_LIT:default>' <EOL> gdata . service . Query . __init__ ( self , feed = '<STR_LIT>' <EOL> + userId , <EOL> text_query = text_query , params = params , <EOL> categories = categories ) <EOL> class CalendarEventCommentQuery ( gdata . service . Query ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , feed = None ) : <EOL> gdata . service . Query . __init__ ( self , feed = feed ) </s>
