<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import atom . core <EOL> import atom . data <EOL> import gdata . acl . data <EOL> import gdata . data <EOL> DOCUMENTS_NS = '<STR_LIT>' <EOL> LABELS_NS = '<STR_LIT>' <EOL> DOCUMENTS_TEMPLATE = '<STR_LIT>' <EOL> ACL_FEEDLINK_REL = '<STR_LIT>' <EOL> RESUMABLE_CREATE_MEDIA_LINK_REL = '<STR_LIT>' <EOL> RESUMABLE_EDIT_MEDIA_LINK_REL = '<STR_LIT>' <EOL> REVISION_FEEDLINK_REL = DOCUMENTS_NS + '<STR_LIT>' <EOL> PARENT_LINK_REL = DOCUMENTS_NS + '<STR_LIT>' <EOL> PUBLISH_LINK_REL = DOCUMENTS_NS + '<STR_LIT>' <EOL> DATA_KIND_SCHEME = '<STR_LIT>' <EOL> LABELS_SCHEME = LABELS_NS <EOL> DOCUMENT_LABEL = '<STR_LIT>' <EOL> SPREADSHEET_LABEL = '<STR_LIT>' <EOL> DRAWING_LABEL = '<STR_LIT>' <EOL> PRESENTATION_LABEL = '<STR_LIT>' <EOL> FILE_LABEL = '<STR_LIT:file>' <EOL> PDF_LABEL = '<STR_LIT>' <EOL> FORM_LABEL = '<STR_LIT>' <EOL> ITEM_LABEL = '<STR_LIT>' <EOL> COLLECTION_LABEL = '<STR_LIT>' <EOL> STARRED_LABEL = '<STR_LIT>' <EOL> VIEWED_LABEL = '<STR_LIT>' <EOL> HIDDEN_LABEL = '<STR_LIT>' <EOL> TRASHED_LABEL = '<STR_LIT>' <EOL> MINE_LABEL = '<STR_LIT>' <EOL> PRIVATE_LABEL = '<STR_LIT>' <EOL> SHAREDWITHDOMAIN_LABEL = '<STR_LIT>' <EOL> RESTRICTEDDOWNLOAD_LABEL = '<STR_LIT>' <EOL> class ResourceId ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = gdata . data . GDATA_TEMPLATE % '<STR_LIT>' <EOL> class LastModifiedBy ( atom . data . Person ) : <EOL> """<STR_LIT>""" <EOL> _qname = gdata . data . GDATA_TEMPLATE % '<STR_LIT>' <EOL> class LastViewed ( atom . data . Person ) : <EOL> """<STR_LIT>""" <EOL> _qname = gdata . data . GDATA_TEMPLATE % '<STR_LIT>' <EOL> class WritersCanInvite ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> value = '<STR_LIT:value>' <EOL> class Deleted ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = gdata . data . GDATA_TEMPLATE % '<STR_LIT>' <EOL> class QuotaBytesUsed ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = gdata . data . GDATA_TEMPLATE % '<STR_LIT>' <EOL> class Publish ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> value = '<STR_LIT:value>' <EOL> class PublishAuto ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> value = '<STR_LIT:value>' <EOL> class PublishOutsideDomain ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> value = '<STR_LIT:value>' <EOL> class Filename ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT:filename>' <EOL> class SuggestedFilename ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class Description ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT:description>' <EOL> class CategoryFinder ( object ) : <EOL> """<STR_LIT>""" <EOL> def add_category ( self , scheme , term , label ) : <EOL> """<STR_LIT>""" <EOL> category = atom . data . Category ( scheme = scheme , term = term , label = label ) <EOL> self . category . append ( category ) <EOL> return category <EOL> AddCategory = add_category <EOL> def get_categories ( self , scheme ) : <EOL> """<STR_LIT>""" <EOL> for category in self . category : <EOL> if category . scheme == scheme : <EOL> yield category <EOL> GetCategories = get_categories <EOL> def remove_categories ( self , scheme ) : <EOL> """<STR_LIT>""" <EOL> for category in list ( self . get_categories ( scheme ) ) : <EOL> self . category . remove ( category ) <EOL> RemoveCategories = remove_categories <EOL> def get_first_category ( self , scheme ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return self . get_categories ( scheme ) . next ( ) <EOL> except StopIteration , e : <EOL> return None <EOL> GetFirstCategory = get_first_category <EOL> def set_resource_type ( self , label ) : <EOL> """<STR_LIT>""" <EOL> self . remove_categories ( DATA_KIND_SCHEME ) <EOL> if label is not None : <EOL> return self . add_category ( scheme = DATA_KIND_SCHEME , <EOL> term = '<STR_LIT>' % ( DOCUMENTS_NS , label ) , <EOL> label = label ) <EOL> else : <EOL> return None <EOL> SetResourceType = set_resource_type <EOL> def get_resource_type ( self ) : <EOL> """<STR_LIT>""" <EOL> category = self . get_first_category ( DATA_KIND_SCHEME ) <EOL> if category is not None : <EOL> return category . label <EOL> else : <EOL> return None <EOL> GetResourceType = get_resource_type <EOL> def get_labels ( self ) : <EOL> """<STR_LIT>""" <EOL> return set ( category . label for category in <EOL> self . get_categories ( LABELS_SCHEME ) ) <EOL> GetLabels = get_labels <EOL> def has_label ( self , label ) : <EOL> """<STR_LIT>""" <EOL> return label in self . get_labels ( ) <EOL> HasLabel = has_label <EOL> def add_label ( self , label ) : <EOL> """<STR_LIT>""" <EOL> if not self . has_label ( label ) : <EOL> self . add_category ( scheme = LABELS_SCHEME , <EOL> term = '<STR_LIT>' % ( LABELS_NS , label ) , <EOL> label = label ) <EOL> AddLabel = add_label <EOL> def remove_label ( self , label ) : <EOL> """<STR_LIT>""" <EOL> for category in self . get_categories ( LABELS_SCHEME ) : <EOL> if category . label == label : <EOL> self . category . remove ( category ) <EOL> RemoveLabel = remove_label <EOL> def is_starred ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( STARRED_LABEL ) <EOL> IsStarred = is_starred <EOL> def is_hidden ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( HIDDEN_LABEL ) <EOL> IsHidden = is_hidden <EOL> def is_viewed ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( VIEWED_LABEL ) <EOL> IsViewed = is_viewed <EOL> def is_trashed ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( TRASHED_LABEL ) <EOL> IsTrashed = is_trashed <EOL> def is_mine ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( MINE_LABEL ) <EOL> IsMine = is_mine <EOL> def is_private ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( PRIVATE_LABEL ) <EOL> IsPrivate = is_private <EOL> def is_shared_with_domain ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( SHAREDWITHDOMAIN_LABEL ) <EOL> IsSharedWithDomain = is_shared_with_domain <EOL> def is_restricted_download ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . has_label ( RESTRICTEDDOWNLOAD_LABEL ) <EOL> IsRestrictedDownload = is_restricted_download <EOL> class AclEntry ( gdata . acl . data . AclEntry , gdata . data . BatchEntry ) : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def get_instance ( role = None , scope_type = None , scope_value = None , key = False ) : <EOL> entry = AclEntry ( ) <EOL> if role is not None : <EOL> if isinstance ( role , basestring ) : <EOL> role = gdata . acl . data . AclRole ( value = role ) <EOL> if key : <EOL> entry . with_key = gdata . acl . data . AclWithKey ( key = '<STR_LIT>' , role = role ) <EOL> else : <EOL> entry . role = role <EOL> if scope_type is not None : <EOL> if scope_value is not None : <EOL> entry . scope = gdata . acl . data . AclScope ( type = scope_type , <EOL> value = scope_value ) <EOL> else : <EOL> entry . scope = gdata . acl . data . AclScope ( type = scope_type ) <EOL> return entry <EOL> GetInstance = get_instance <EOL> class AclFeed ( gdata . acl . data . AclFeed ) : <EOL> """<STR_LIT>""" <EOL> entry = [ AclEntry ] <EOL> class Resource ( gdata . data . BatchEntry , CategoryFinder ) : <EOL> """<STR_LIT>""" <EOL> last_viewed = LastViewed <EOL> last_modified_by = LastModifiedBy <EOL> resource_id = ResourceId <EOL> deleted = Deleted <EOL> writers_can_invite = WritersCanInvite <EOL> quota_bytes_used = QuotaBytesUsed <EOL> feed_link = [ gdata . data . FeedLink ] <EOL> filename = Filename <EOL> suggested_filename = SuggestedFilename <EOL> description = Description <EOL> acl_feed = AclFeed <EOL> def __init__ ( self , type = None , title = None , ** kwargs ) : <EOL> super ( Resource , self ) . __init__ ( ** kwargs ) <EOL> if isinstance ( type , basestring ) : <EOL> self . set_resource_type ( type ) <EOL> if title is not None : <EOL> if isinstance ( title , basestring ) : <EOL> self . title = atom . data . Title ( text = title ) <EOL> else : <EOL> self . title = title <EOL> def get_acl_feed_link ( self ) : <EOL> """<STR_LIT>""" <EOL> for feed_link in self . feed_link : <EOL> if feed_link . rel == ACL_FEEDLINK_REL : <EOL> return feed_link <EOL> return None <EOL> GetAclFeedLink = get_acl_feed_link <EOL> def get_revisions_feed_link ( self ) : <EOL> """<STR_LIT>""" <EOL> for feed_link in self . feed_link : <EOL> if feed_link . rel == REVISION_FEEDLINK_REL : <EOL> return feed_link <EOL> return None <EOL> GetRevisionsFeedLink = get_revisions_feed_link <EOL> def get_resumable_create_media_link ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . get_link ( RESUMABLE_CREATE_MEDIA_LINK_REL ) <EOL> GetResumableCreateMediaLink = get_resumable_create_media_link <EOL> def get_resumable_edit_media_link ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . get_link ( RESUMABLE_EDIT_MEDIA_LINK_REL ) <EOL> GetResumableEditMediaLink = get_resumable_edit_media_link <EOL> def in_collections ( self ) : <EOL> """<STR_LIT>""" <EOL> links = [ ] <EOL> for link in self . link : <EOL> if link . rel == PARENT_LINK_REL and link . href : <EOL> links . append ( link ) <EOL> return links <EOL> InCollections = in_collections <EOL> class ResourceFeed ( gdata . data . BatchFeed ) : <EOL> """<STR_LIT>""" <EOL> entry = [ Resource ] <EOL> class Revision ( gdata . data . GDEntry ) : <EOL> """<STR_LIT>""" <EOL> publish = Publish <EOL> publish_auto = PublishAuto <EOL> publish_outside_domain = PublishOutsideDomain <EOL> def find_publish_link ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . find_url ( PUBLISH_LINK_REL ) <EOL> FindPublishLink = find_publish_link <EOL> def get_publish_link ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . get_link ( PUBLISH_LINK_REL ) <EOL> GetPublishLink = get_publish_link <EOL> class RevisionFeed ( gdata . data . GDFeed ) : <EOL> """<STR_LIT>""" <EOL> entry = [ Revision ] <EOL> class ArchiveResourceId ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveFailure ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveComplete ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveTotal ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveTotalComplete ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveTotalFailure ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveConversion ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> source = '<STR_LIT:source>' <EOL> target = '<STR_LIT:target>' <EOL> class ArchiveNotify ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveStatus ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ArchiveNotifyStatus ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class Archive ( gdata . data . GDEntry ) : <EOL> """<STR_LIT>""" <EOL> archive_resource_ids = [ ArchiveResourceId ] <EOL> status = ArchiveStatus <EOL> date_completed = ArchiveComplete <EOL> num_resources = ArchiveTotal <EOL> num_complete_resources = ArchiveTotalComplete <EOL> num_failed_resources = ArchiveTotalFailure <EOL> failed_resource_ids = [ ArchiveFailure ] <EOL> notify_status = ArchiveNotifyStatus <EOL> conversions = [ ArchiveConversion ] <EOL> notification_email = ArchiveNotify <EOL> size = QuotaBytesUsed <EOL> @ staticmethod <EOL> def from_resource_list ( resources ) : <EOL> resource_ids = [ ] <EOL> for resource in resources : <EOL> id = ArchiveResourceId ( text = resource . resource_id . text ) <EOL> resource_ids . append ( id ) <EOL> return Archive ( archive_resource_ids = resource_ids ) <EOL> FromResourceList = from_resource_list <EOL> class Removed ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class Changestamp ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> value = '<STR_LIT:value>' <EOL> class Change ( Resource ) : <EOL> """<STR_LIT>""" <EOL> changestamp = Changestamp <EOL> removed = Removed <EOL> class ChangeFeed ( gdata . data . GDFeed ) : <EOL> """<STR_LIT>""" <EOL> entry = [ Change ] <EOL> class QuotaBytesTotal ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = gdata . data . GDATA_TEMPLATE % '<STR_LIT>' <EOL> class QuotaBytesUsedInTrash ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class ImportFormat ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> source = '<STR_LIT:source>' <EOL> target = '<STR_LIT:target>' <EOL> class ExportFormat ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> source = '<STR_LIT:source>' <EOL> target = '<STR_LIT:target>' <EOL> class FeatureName ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class FeatureRate ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> class Feature ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> name = FeatureName <EOL> rate = FeatureRate <EOL> class MaxUploadSize ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> kind = '<STR_LIT>' <EOL> class AdditionalRoleSet ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> primaryRole = '<STR_LIT>' <EOL> additional_role = [ gdata . acl . data . AclAdditionalRole ] <EOL> class AdditionalRoleInfo ( atom . core . XmlElement ) : <EOL> """<STR_LIT>""" <EOL> _qname = DOCUMENTS_TEMPLATE % '<STR_LIT>' <EOL> kind = '<STR_LIT>' <EOL> additional_role_set = [ AdditionalRoleSet ] <EOL> class Metadata ( gdata . data . GDEntry ) : <EOL> """<STR_LIT>""" <EOL> quota_bytes_total = QuotaBytesTotal <EOL> quota_bytes_used = QuotaBytesUsed <EOL> quota_bytes_used_in_trash = QuotaBytesUsedInTrash <EOL> import_formats = [ ImportFormat ] <EOL> export_formats = [ ExportFormat ] <EOL> features = [ Feature ] <EOL> max_upload_sizes = [ MaxUploadSize ] <EOL> additional_role_info = [ AdditionalRoleInfo ] </s>
