
    _Og                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr   " S	 S
\R                  5      rS rg)z)This module contains the Contents object.    )	b64decode)	b64encode)dumps   )models)requires_auth)Commitc                   Z    \ rS rSrSrS rS rS rS r\	SS j5       r
\	 SS	 j5       rS
rg)Contents   a  A representation of file contents returned via the API.

See also: http://developer.github.com/v3/repos/contents/

This object has the following attributes:

.. attribute:: content

    The body of the file. If this is present, it may be base64 encoded.

.. attribute:: encoding

    The encoding used on the :attr:`content` when returning the data from
    the API, e.g., ``base64``. If :attr:`content` is not present this will
    not be present either.

.. attribute:: decoded

    .. note:: This is a computed attribute which isn't returned by the API.
    .. versionchanged:: 0.5.2

    Decoded content of the file as a bytes object. If we try to decode
    to character set for you, we might encounter an exception which
    will prevent the object from being created. On python2 this is the
    same as a string, but on python3 you should call the decode method
    with the character set you wish to use, e.g.,
    ``content.decoded.decode('utf-8')``.

.. attribute:: git_url

    The URL for the Git API pertaining to this file.

.. attribute:: html_url

    The URL to open this file in a browser.

.. attribute:: links

    A dictionary of links returned about the contents and related
    resources.

.. attribute:: name

    The name of the file.

.. attribute:: path

    The path to this file.

.. attribute:: sha

    The SHA1 of the contents of this file.

.. attribute:: size

    The size of file in bytes.

.. attribute:: submodule_git_url

    The URL of the git submodule (if this is a git submodule).

.. attribute:: target

    If the file is a symlink, this will be present and provides the type
    of file that the symlink points to.

.. attribute:: type

    Type of content, e.g., ``'file'``, ``'symlink'``, or ``'submodule'``.
c                 6   US   U l         UR                  S5      U l        UR                  S5      U l        U R                  U l        U R                  S:X  a5  U R                  b(  [        U R                  R                  5       5      U l        US   U l        US   U l        US   U l	        US   U l
        US	   U l        US
   U l        US   =U l        U l        US   U l        UR                  S5      U l        UR                  S5      U l        US   U l        g )Nurlcontentencodingbase64download_urlgit_urlhtml_url_linksnamepathshasizesubmodule_git_urltargettype)_apigetr   r   decodedr   encoder   r   r   linksr   r   _uniqr   r   r   r   r   )selfr   s     [/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/github3/repos/contents.py_update_attributesContents._update_attributesS   s    EN	{{9-J/||==H$)A$T\\%8%8%:;DL#N3y)
+X&
FO	FO	 '.
TXFO	!(-@!Akk(+FO	    c                 "    SU R                    S3$ )Nz<Contents [z]>)r   )r#   s    r$   _reprContents._reprf   s    TYYKr**r'   c                      U R                   U:H  $ N)r   r#   others     r$   __eq__Contents.__eq__i   s    ||u$$r'   c                      U R                   U:g  $ r,   )r   r-   s     r$   __ne__Contents.__ne__l   s    xx5  r'   Nc                 x   0 nU(       a  UU R                   U[        U5      [        U5      S.nU R                  U5        U R                  U R	                  U R
                  [        U5      S9S5      nU(       a  SU;   a  [        US   U 5      US'   U(       a"  SU;   a  U R                  [        US   5      US'   U$ )a  Delete this file.

:param str message:
    (required), commit message to describe the removal
:param str branch:
    (optional), branch where the file exists.
    Defaults to the default branch of the repository.
:param dict committer:
    (optional), if no information is given the authenticated user's
    information will be used. You must specify both a name and email.
:param dict author:
    (optional), if omitted this will be filled in with committer
    information. If passed, you must specify both a name and email.
:returns:
    dictionary of new content and associated commit
:rtype:
    :class:`~github3.repos.contents.Contents` and
    :class:`~github3.git.Commit`
)messager   branch	committerauthordata   commitr   )
r   validate_commmitter_remove_none_json_deleter   r   r	   _instance_or_nullr   )r#   r5   r6   r7   r8   jsonr:   s          r$   deleteContents.deleteo   s    * "xx 0;-f5D d#::dll4995;lGMDD(!'X!=X	T)"&"8"8d9o#Y r'   c                    U(       a   [        U[        5      (       d  [        S5      eSnU(       a  U(       a  [        U5      R	                  S5      nUUUU R
                  [        U5      [        U5      S.nU R                  U5        U R                  U R                  U R                  [        U5      S9S5      nU(       a  SU;   a  U R                  US   5        XS'   U(       a  SU;   a  [        US   U 5      US'   U$ )	a'  Update this file.

:param str message:
    (required), commit message to describe the update
:param str content:
    (required), content to update the file with
:param str branch:
    (optional), branch where the file exists.
    Defaults to the default branch of the repository.
:param dict committer:
    (optional), if no information is given the authenticated user's
    information will be used. You must specify both a name and email.
:param dict author:
    (optional), if omitted this will be filled in with committer
    information. If passed, you must specify both a name and email.
:returns:
    dictionary containing the updated contents object and the
    commit in which it was changed.
:rtype:
    dictionary of :class:`~github3.repos.contents.Contents` and
    :class:`~github3.git.Commit`
zcontent must be a bytes objectNzutf-8)r5   r   r6   r   r7   r8   r9   r;   r   r<   )
isinstancebytes
ValueErrorr   decoder   r=   r>   r?   _putr   r   r%   r	   )r#   r5   r   r6   r7   r8   rB   r:   s           r$   updateContents.update   s    4 :gu550  w(//8G"" xx0;-f5D d#::dii		diDcJD	T)''Y8"&YD(!'X!=Xr'   )r   r"   r   r   r   r   r   r   r!   r   r   r   r   r   r   r   )NNN)__name__
__module____qualname____firstlineno____doc__r%   r)   r/   r2   r   rC   rK   __static_attributes__ r'   r$   r   r      sI    EN$&+%! % %N DH0 0r'   r   c                 n    U (       a.  U R                  S5      (       a  U R                  S5      (       a  U $ g)zValidate that there are enough details in the dictionary.

When sending data to GitHub, we need to ensure we're sending the name and
email for committer and author data.
r   emailN)r   )ds    r$   r=   r=      s'     	QUU6]]quuW~~r'   N)rQ   r   r   r   rB   r    r   
decoratorsr   gitr	   
GitHubCorer   r=   rS   r'   r$   <module>r[      s4    /     & }v   }@r'   