3 @qhc@sddlmZddlmZddlmZddlmZmZmZddl m Z m Z m Z m Z ddlmZddlmZdd lmZd d d d gZGdd d e e e eZGdd d e eZGdd d e e e eZGdd d e eZdS))cli) exceptions)utils)RequiredOptional RESTManager RESTObject) CRUDMixinObjectDeleteMixin SaveMixinUserAgentDetailMixin)ProjectSnippetAwardEmojiManager)ProjectSnippetDiscussionManager)ProjectSnippetNoteManagerSnippetSnippetManagerProjectSnippetProjectSnippetManagerc@s0eZdZdZejdejejdddZ dS)rtitleFNcKs8d|j}|jjj|f|dd|}tj||||S)aReturn the content of a snippet. Args: streamed (bool): If True the data will be processed by chunks of `chunk_size` and each chunk is passed to `action` for treatment. action (callable): Callable responsible of dealing with chunk of data chunk_size (int): Size of each chunk **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the content could not be retrieved Returns: str: The snippet content z/snippets/%s/rawT)streamedraw)get_idmanagergitlabhttp_getrresponse_content)selfraction chunk_sizekwargspathresultr#Y/home/ec2-user/environment/venv/lib/python3.6/dist-packages/gitlab/v4/objects/snippets.pycontents zSnippet.content)FNr) __name__ __module__ __qualname___short_print_attrrregister_custom_actionexc on_http_errorGitlabGetErrorr%r#r#r#r$rs c@s<eZdZdZeZed d dZeddZe j dd d Z d S)rz /snippetsr file_namer%lifetime visibility)requiredoptional)r2cKs|jfddi|S)a_List all the public snippets. Args: all (bool): If True the returned object will be a list **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabListError: If the list could not be retrieved Returns: RESTObjectList: A generator for the snippets list r!z/snippets/public)list)rr r#r#r$public<szSnippetManager.publicN)rr.r%)r/r0)rr.r%r0) r&r'r(_pathr_obj_clsr _create_attrs _update_attrsrr*r4r#r#r#r$r2s c@s8eZdZdZdZdZejdej ej dd d Z d S)rz!/projects/%(project_id)s/snippetsr awardemojisr discussionsrnotesrFNcKs@d|jj|jf}|jjj|f|dd|}tj||||S)aReturn the content of a snippet. Args: streamed (bool): If True the data will be processed by chunks of `chunk_size` and each chunk is passed to `action` for treatment. action (callable): Callable responsible of dealing with chunk of data chunk_size (int): Size of each chunk **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the content could not be retrieved Returns: str: The snippet content z %s/%s/rawT)rr)rr!rrrrr)rrrrr r!r"r#r#r$r%VszProjectSnippet.contentr9r r:rr;r)r=r>r?)FNr<) r&r'r(_urlr)Z _managersrr*r+r,r-r%r#r#r#r$rMs c@s2eZdZdZeZddiZed d d Zedd Z d S)rz!/projects/%(project_id)s/snippetsZ project_ididrr.r%r0 description)r1r2)r2N)rr.r%r0)rB)rr.r%r0rB) r&r'r(r5rr6Z_from_parent_attrsrr7r8r#r#r#r$rrsN)rrrr+rZ gitlab.baserrrZ gitlab.mixinsrr r r Z award_emojisr r:rr;r__all__rrrrr#r#r#r$s      %