
    _OgF                         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
KJ
r
  S	SKJr  S	SKJr   " S S\
R                  5      r " S S\5      r " S S\5      rg)z"Module containing the Issue logic.    )dumps)URITemplate   )comment)event)label)	milestone   )models)users)requires_authc                   *   \ rS rSrSrS rS rS r\S 5       r	\S 5       r
\S 5       rS rSS
 jr\S 5       r\       SS j5       rSS jrS rSS jr\S 5       rS r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rSrg	)_Issue   zThe :class:`Issue <Issue>` object.

Please see GitHub's `Issue Documentation`_ for more information.

.. _Issue Documentation:
    http://developer.github.com/v3/issues
c                 b   US   U l         US   U l        U R                  (       a&  [        R                  " U R                  U 5      U l        US   U l        U R                  (       a6  U R                   Vs/ s H  n[        R                  " X 5      PM     snU l        US   U l        U R                  US   5      U l        US   U l        US   U l	        U R                  US   5      U l
        US	   U l        US
   U l        US   U l        [        US   5      U l        US   U l        US   U l        U R"                  (       a&  ["        R$                  " U R"                  U 5      U l        US   U l        US   U l        U R(                  (       a6  U R(                   Vs/ s H  n[*        R,                  " X05      PM     snU l        UR/                  S5      U l        US   U l        US   U l        U R                  US   5      U l        [        R                  " US   U 5      U l        g s  snf s  snf )Nurlassignee	assigneesbody	closed_atcommentscomments_url
created_at
events_urlhtml_urlid
labels_urllockedr	   numberlabelspull_requeststatetitle
updated_atuser)_apir   r   	ShortUserr   r   	_strptimer   comments_countr   r   r   r   r   r   labels_urltr   r	   	Milestoner   original_labelsr   
ShortLabelgetpull_request_urlsr"   r#   r$   r%   )selfissuer   lbls       Y/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/github3/issues/issue.py_update_attributes_Issue._update_attributes   s   %L	j)==!OODMM4@DM{+>>@D@NH/DN &M	k(:;#J/!.1..|)<=-j)+&u\':;Ho{+>>&00FDNHo$X7;7K7K$7K  +7K$D  "'>!:7^
7^
..|)<=OOE&M48	5&$s   5 H' H,c                 J    SR                  U R                  U R                  S9$ )Nz<{class_name} [#{n}]>)n
class_name)formatr   r8   r0   s    r3   _repr_Issue._repr=   s'    &--kkdoo . 
 	
    c                     U Vs1 s H  n[        USU5      iM     nn[        U R                   Vs1 s H  oDR                  iM     snU-  5      nU R	                  US9$ s  snf s  snf )a6  Assign ``users`` to this issue.

This is a shortcut for :meth:`~github3.issues.issue.Issue.edit`.

:param users:
    users or usernames to assign this issue to
:type users:
    list of :class:`~github3.users.User`
:type users:
    list of str
:returns:
    True if successful, False otherwise
:rtype:
    bool
loginr   getattrlistr   r?   editr0   r   r%   	usernamesar   s         r3   add_assignees_Issue.add_assigneesB   `    " ?DDedWT7D1e	D4>>:>a''>:YFG	yy9y-- E:
   AA$c                     U R                  SU R                  S9nU R                  U R                  X!S9S5      nU(       a'  U Vs/ s H  n[        R
                  " X@5      PM     sn$ / $ s  snf )zAdd labels to this issue.

:param str args:
    (required), names of the labels you wish to add
:returns:
    list of labels
:rtype:
    :class:`~github3.issues.label.ShortLabel`
r    base_urldata   )
_build_urlr&   _json_postr   r-   )r0   argsr   jsonr2   s        r3   
add_labels_Issue.add_labelsW   s_     ooho;zz$**S*4c:@Dt<t  +t<L"L<s    A*c                 L   U R                   (       a  U R                   R                  OSnU R                  (       a  U R                  R                  OSnU R                   Vs/ s H  o3R
                  PM     nnU R                  U R                  U R                  USX$5      $ s  snf )zVClose this issue.

:returns:
    True if successful, False otherwise
:rtype:
    bool
 Nclosed)	r   r?   r	   r   r,   namerD   r#   r   r0   r   r   r2   r    s        r3   close_Issue.closef   sy     +/--4==&&R*...&&d&*&:&:;&:s((&:;yyJJ		8Xv
 	
 <   !B!c                    Sn[        U5      S:  aY  U R                  R                  SS5      u  p4U R                  S[	        U5      US9nU R                  U R                  U5      S5      nU R                  [        R                  U5      $ )a  Get a single comment by its id.

The catch here is that id is NOT a simple number to obtain. If
you were to look at the comments on issue #15 in
sigmavirus24/Todo.txt-python, the first comment's id is 4150787.

:param int id_num:
    (required), comment id, see example above
:returns:
    the comment identified by ``id_num``
:rtype:
    :class:`~github3.issues.comment.IssueComment`
Nr   /r   r   rM   rQ   )
intr   rsplitrR   strrS   _get_instance_or_nullr   IssueComment)r0   id_numrV   rN   _r   s         r3   r   _Issue.commentw   ss     v;?((//#q1KH//*c&kH/MC::diinc2D%%g&:&:DAAr=   Nc                     U R                  SU R                  S9n[        R                  " X#U5      nU R	                  [        U5      U[        R                  U5      $ )az  Iterate over the comments on this issue.

:param int number:
    (optional), number of comments to iterate over
    Default: -1 returns all comments
:param str sort:
    accepted valuees: ('created', 'updated') api-default: created
:param str direction:
    accepted values: ('asc', 'desc') Ignored without the sort parameter
:param since:
    (optional), Only issues after this date will be returned. This can
    be a ``datetime`` or an ISO8601 formatted date string, e.g.,
    ``2012-05-20T23:10:27Z``
:type since:
    datetime or string
:returns:
    iterator of comments
:rtype:
    :class:`~github3.issues.comment.IssueComment`
r   rM   )rR   r&   r   issue_comment_params_iterrc   rh   )r0   r   sort	directionsincer   paramss          r3   r   _Issue.comments   sK    * ooj499o=--duEzz#f+sG,@,@&IIr=   c                     SnU(       a<  U R                  SU R                  S9nU R                  U R                  USU0S9S5      nU R	                  [
        R                  U5      $ )zCreate a comment on this issue.

:param str body:
    (required), comment body
:returns:
    the created comment
:rtype:
    :class:`~github3.issues.comment.IssueComment`
Nr   rM   r   rO      )rR   r&   rS   rT   rg   r   rh   )r0   r   rV   r   s       r3   create_comment_Issue.create_comment   s\     //*tyy/AC::djjFD>jBCHD%%g&:&:DAAr=   c                    SnUUUUUUUS.n	U R                  U	5        U	(       aG  SU	;   a  U	S   S:X  a  SU	S'   U R                  U R                  U R                  [	        U	5      S9S5      nU(       a  U R                  U5        gg)	a  Edit this issue.

:param str title:
    title of the issue
:param str body:
    markdown formatted body (description) of the issue
:param str assignee:
    login name of user the issue should be assigned to
:param str state:
    accepted values: ('open', 'closed')
:param int milestone:
    the number (not title) of the milestone to assign this to,
    or 0 to remove the milestone

    .. note::

        This is not the milestone's globally unique identifier, it's
        value in :attr:`~github3.issues.milestone.Milestone.number`.
:param list labels:
    list of labels to apply this to
:param assignees:
    (optional), login of the users to assign the issue to
:type assignees:
    list of strings
:returns:
    True if successful, False otherwise
:rtype:
    bool
N)r#   r   r   r"   r	   r    r   r	   r   rO   rQ   TF)_remove_nonerS   _patchr&   r   r4   )
r0   r#   r   r   r"   r	   r    r   rV   rP   s
             r3   rD   _Issue.edit   s    P  ""
 	$d"tK'8A'=$([!::dkk$))%+kFLD##D)r=   c                     U R                  SU R                  S9nU R                  [        U5      U[        R
                  5      $ )a
  Iterate over events associated with this issue only.

:param int number:
    (optional), number of events to return. Default: -1 returns all
    events available.
:returns:
    generator of events on this issues
:rtype:
    :class:`~github3.issues.event.IssueEvent`
eventsrM   )rR   r&   rn   rc   r   
IssueEvent)r0   r   r   s      r3   r}   _Issue.events   s7     ooho;zz#f+sE,<,<==r=   c                 H    U R                   (       d  U R                  S:X  a  gg)zbCheck if the issue is closed.

:returns:
    True if successful, False otherwise
:rtype:
    bool
r[   TF)r   r"   r:   s    r3   	is_closed_Issue.is_closed   s     >>djjH4r=   c                     U R                  SU R                  S9nU R                  [        U5      U[        R
                  US9$ )ag  Iterate over the labels associated with this issue.

:param int number:
    (optional), number of labels to return. Default: -1 returns all
    labels applied to this issue.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of labels on this issue
:rtype:
    :class:`~github3.issues.label.ShortLabel`
r    rM   )etag)rR   r&   rn   rc   r   r-   )r0   r   r   r   s       r3   r    _Issue.labels  s;     ooho;zz#f+sE,<,<4zHHr=   c                 z    U R                  SU R                  S9nU R                  U R                  U5      SS5      $ )zSLock an issue.

:returns:
    True if successful, False otherwise
:rtype:
    bool
lockrM        )rR   r&   _boolean_putr0   r   s     r3   r   _Issue.lock  s5     ooftyyo9}}TYYs^S#66r=   c                     SSK Jn  SnSnU R                  b  U R                  R                  S5      nU(       a!  U R	                  U R                  U5      S5      nU R                  UR                  U5      $ )zRetrieve the pull request associated with this issue.

:returns:
    the pull request associated with this issue
:rtype:
    :class:`~github3.pulls.PullRequest`
r
   )pullsNr   rQ   )rZ   r   r/   r.   rS   rf   rg   PullRequest)r0   r   rV   pull_request_urls       r3   r!   _Issue.pull_request(  sk     	!!-#5599%@::dii(893?D%%e&7&7>>r=   c                     U Vs1 s H  n[        USU5      iM     nn[        U R                   Vs1 s H  oDR                  iM     snU-
  5      nU R	                  US9$ s  snf s  snf )a>  Unassign ``users`` from this issue.

This is a shortcut for :meth:`~github3.issues.issue.Issue.edit`.

:param users:
    users or usernames to unassign this issue from
:type users:
    list of :class:`~github3.users.User`
:type users:
    list of str
:returns:
    True if successful, False otherwise
:rtype:
    bool
r?   r@   rA   rE   s         r3   remove_assignees_Issue.remove_assignees:  rJ   rK   c                     U R                  SXR                  S9nU R                  U R                  U5      SS5      nU(       a(  U Vs/ s H  n[        R
                  " X@5      PM     nnU$ / nU$ s  snf )zRemove label ``name`` from this issue.

:param str name:
    (required), name of the label to remove
:returns:
    list of removed labels
:rtype:
    :class:`~github3.issues.label.ShortLabel`
r    rM   rQ   r   )rR   r&   rS   _deleter   r-   )r0   r\   r   rV   r2   r    s         r3   remove_label_Issue.remove_labelO  sn     oohyyoAzz$,,s+S#6BF>#%""3-> MO ?s    A0c                 $    U R                  / 5      $ )ztRemove all labels from this issue.

:returns:
    the list of current labels (empty) if successful
:rtype:
    list
)replace_labelsr:   s    r3   remove_all_labels_Issue.remove_all_labels_  s     ""2&&r=   c                     U R                  SU R                  S9nU R                  U R                  U[	        U5      S9S5      nU(       a'  U Vs/ s H  n[
        R                  " X@5      PM     sn$ / $ s  snf )zReplace all labels on this issue with ``labels``.

:param list labels:
    label names
:returns:
    list of labels
:rtype:
    :class:`~github3.issues.label.ShortLabel`
r    rM   rO   rQ   )rR   r&   rS   r   r   r   r-   )r0   r    r   rV   r2   s        r3   r   _Issue.replace_labelsk  se     ooho;zz$))CeFm)<cB@Dt<t  +t<L"L<s    A4c                 L   U R                   (       a  U R                   R                  OSnU R                  (       a  U R                  R                  OSnU R                   Vs/ s H  n[        U5      PM     nnU R                  U R                  U R                  USX$5      $ s  snf )zRe-open a closed issue.

.. note:: This is a short cut to using :meth:`edit`.

:returns:
    True if successful, False otherwise
:rtype:
    bool
rZ   Nopen)	r   r?   r	   r   r,   re   rD   r#   r   r]   s        r3   reopen_Issue.reopenz  s{     +/--4==&&R*...&&d&*&:&:;&:s#c(&:;yyJJ		8VV
 	
 <r`   c                 z    U R                  SU R                  S9nU R                  U R                  U5      SS5      $ )zUUnlock an issue.

:returns:
    True if successful, False otherwise
:rtype:
    bool
r   rM   r   r   )rR   r&   r   r   r   s     r3   unlock_Issue.unlock  s6     ooftyyo9}}T\\#.S99r=   )r&   r   r   r   r   r)   r   r   r   r   r   r*   r   r	   r   r,   r/   r"   r#   r$   r%   )rZ   rZ   N)NNNNNNN)r   )r   N)__name__
__module____qualname____firstlineno____doc__r8   r4   r;   r   rH   rW   r^   r   r   rv   rD   r}   r   r    r   r!   r   r   r   r   r   r   __static_attributes__ r=   r3   r   r      sH    J!9F

 . .( M M 
 
 B*J2 B B   9 9v>
I  	7 	7?$ . .(   	' 	' M M 
 
" 	: 	:r=   r   c                   0   ^  \ rS rSrSrS rU 4S jrSrU =r$ )Issuei  a  Object for the full representation of an Issue.

GitHub's API returns different amounts of information about issues based
upon how that information is retrieved. This object exists to represent
the full amount of information returned for a specific issue. For example,
you would receive this class when calling
:meth:`~github3.github.GitHub.issue`. To provide a clear
distinction between the types of issues, github3.py uses different classes
with different sets of attributes.

.. versionchanged:: 1.0.0

This object has all of the same attributes as a
:class:`~github3.issues.issue.ShortIssue` as well as the following:

.. attribute:: body_html

    The HTML formatted body of this issue.

.. attribute:: body_text

    The plain-text formatted body of this issue.

.. attribute:: closed_by

    If the issue is closed, a :class:`~github3.users.ShortUser`
    representing the user who closed the issue.
c                    > [         TU ]  U5        US   U l        US   U l        US   U l        U R                  (       a'  [
        R                  " U R                  U 5      U l        g g )N	body_html	body_text	closed_by)superr4   r   r   r   r   r'   )r0   r1   	__class__s     r3   r4   Issue._update_attributes  sV    "5){+{+{+>>"__T^^TBDN r=   )r   r   r   )	r   r   r   r   r   r8   r4   r   __classcell__)r   s   @r3   r   r     s    : JC Cr=   r   c                        \ rS rSrSrS r\rSrg)
ShortIssuei  a  Object for the shortened representation of an Issue.

GitHub's API returns different amounts of information about issues based
upon how that information is retrieved. Often times, when iterating over
several issues, GitHub will return less information. To provide a clear
distinction between the types of issues, github3.py uses different classes
with different sets of attributes.

.. versionadded:: 1.0.0

This object has the following attributes:

.. attribute:: assignee

    .. deprecated:: 1.0.0

        While the API still returns this attribute, it's not as useful in
        the context of multiple assignees.

    If a user is assigned to this issue, then it will be represented as a
    :class:`~github3.users.ShortUser`.

.. attribute:: assignees

    If users are assigned to this issue, then they will be represented as
    a list of :class:`~github3.users.ShortUser`.

.. attribute:: body

    The markdown formatted text of the issue as writen by the user who
    opened the issue.

.. attribute:: closed_at

    If this issue is closed, this will be a :class:`~datetime.datetime`
    object representing the date and time this issue was closed. Otherwise
    it will be ``None``.

.. attribute:: comments_count

    The number of comments on this issue.

.. attribute:: comments_url

    The URL to retrieve the comments on this issue from the API.

.. attribute:: created_at

    A :class:`~datetime.datetime` object representing the date and time
    this issue was created.

.. attribute:: events_url

    The URL to retrieve the events related to this issue from the API.

.. attribute:: html_url

    The URL to view this issue in a browser.

.. attribute:: id

    The unique identifier for this issue in GitHub.

.. attribute:: labels_urlt

    A :class:`~uritemplate.URITemplate` object that can expand to a URL to
    retrieve the labels on this issue from the API.

.. attribute:: locked

    A boolean attribute representing whether or not this issue is locked.

.. attribute:: milestone

    A :class:`~github3.issues.milestone.Milestone` object representing the
    milestone to which this issue was assigned.

.. attribute:: number

    The number identifying this issue on its parent repository.

.. attribute:: original_labels

    If any are assigned to this issue, the list of
    :class:`~github3.issues.label.ShortLabel` objects representing the
    labels returned by the API for this issue.

.. attribute:: pull_request_urls

    If present, a dictionary of URLs for retrieving information about the
    associated pull request for this issue.

.. attribute:: state

    The current state of this issue, e.g., ``'closed'`` or ``'open'``.

.. attribute:: title

    The title for this issue.

.. attribute:: updated_at

    A :class:`~datetime.datetime` object representing the date and time
    when this issue was last updated.

.. attribute:: user

    A :class:`~github3.users.ShortUser` representing the user who opened
    this issue.
r   N)	r   r   r   r   r   r8   r   _refresh_tor   r   r=   r3   r   r     s    m^ JKr=   r   N)r   rV   r   uritemplater   rZ   r   r   r   r	   r   r   
decoratorsr   
GitHubCorer   r   r   r   r=   r3   <module>r      sU    (  #       &G:V G:T&CF &CRq qr=   