
    _Og%                        S r SSK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  \R&                  (       a  SSKJ	r   " S S\5      r " S S\R,                  5      r " S S\5      r " S S\5      r " S S\R,                  5      r " S S\5      r " S S\5      r " S S\R,                  5      r " S S\R,                  5      r " S S \R,                  5      rg)!zAThis module contains all of the classes related to organizations.    N)dumps)URITemplate   )models)users)requires_auth)Event)Project)
Repository)ShortRepositoryc                   0   ^  \ rS rSrS rSU 4S jjrSrU =r$ )ShortRepositoryWithPermissions   c                 8   > [         TU ]  U5        US   U l        g )Npermissions)super_update_attributesr   )selfrepo	__class__s     Q/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/github3/orgs.pyr   1ShortRepositoryWithPermissions._update_attributes   s    "4(.    )r   )returnN)__name__
__module____qualname____firstlineno__
class_namer   __static_attributes____classcell__r   s   @r   r   r      s    1J/ /r   r   c                   ~   \ rS rSrSrS r\" SS/5      r\R                  S/5      r	S r
S r\SS j5       r\SS	 j5       r\S
 5       r\   SS\S\S\R$                  \   S\R$                  \   4S jj5       r\S 5       r\SS j5       r\S\S\4S j5       r\SS j5       r\S 5       r\S 5       r\S 5       rSrg) _Team   z$Base class for Team representations.member
maintainerallc                 .   US   U l         US   U l        [        US   5      U l        US   U l        US   U l        UR                  S5      U l        US   U l        US   U l	        S U l
        UR                  S	5      nU(       a  [        X 5      U l
        g g )
Nurlidmembers_urlname
permissionprivacyrepositories_urlslugparent)_apir+   r   members_urltr-   r.   getr/   r0   r1   r2   	ShortTeam)r   teamr2   s      r   r   _Team._update_attributes#   s    K	t*'](;<L	|,xx
 !%%7 8L	(##F1DK r   c                      SR                  U S9$ )Nz<{s.class_name} [{s.name}]>)s)formatr   s    r   _repr_Team._repr3   s    ,33d3;;r   c           	         X R                   ;  a<  [        SR                  SR                  [	        U R                   5      5      5      5      eSU0nU R                  SXR                  S9nU R                  U R                  XCS9S5      $ )a  Add or update the user's membership in this team.

This returns a dictionary like so::

    {
        'state': 'pending',
        'url': 'https://api.github.com/teams/...',
        'role': 'member',
    }

:param str username:
    (required), login of user whose membership is being modified
:param str role:
    (optional), the role the user should have once their membership
    has been modified. Options: 'member', 'maintainer'. Default:
    'member'
:returns:
    dictionary of the invitation response
:rtype:
    dict
'role' must be one of {}, rolemembershipsbase_urljson   )	member_roles
ValueErrorr;   joinsorted
_build_urlr3   _json_put)r   usernamerB   datar*   s        r   add_or_update_membership_Team.add_or_update_membership6   s    . (((*11IIfT%6%678 
 ~oomX		oJzz$))C)3S99r   c                     0 nU(       a  SU0nU R                  SXR                  S9nU R                  U R                  U[	        U5      S9SS5      $ )a<  Add ``repository`` to this team.

If a permission is not provided, the team's default permission
will be assigned, by GitHub.

:param str repository:
    (required), form: 'user/repo'
:param str permission:
    (optional), ('pull', 'push', 'admin')
:returns:
    True if successful, False otherwise
:rtype:
    bool
r.   reposrD   rQ        )rM   r3   _booleanrO   r   )r   
repositoryr.   rQ   r*   s        r   add_repository_Team.add_repositoryW   sP       *-DoogzIIoF}}TYYstY=sCHHr   c                 Z    U R                  U R                  U R                  5      SS5      $ )zVDelete this team.

:returns:
    True if successful, False otherwise
:rtype:
    bool
rW   rX   rY   _deleter3   r<   s    r   delete_Team.deletem   $     }}T\\$))4c3??r   Nr-   r.   parent_team_idr/   c                     U(       al  SU0nU(       a  X%S'   Ub  X5S'   US;   a  XES'   U R                  U R                  U R                  [        U5      S9S5      nU(       a  U R	                  U5        gg	)
a  Edit this team.

:param str name:
    (required), the new name of this team
:param str permission:
    (optional), one of ('pull', 'push', 'admin')
    .. deprecated:: 3.0.0

        This was deprecated by the GitHub API.
:param int parent_team_id:
    (optional), id of the parent team for this team
:param str privacy:
    (optional), one of "closed" or "secret"
:returns:
    True if successful, False otherwise
:rtype:
    bool
r-   r.   rc   >   closedsecretr/   rV   rH   TFrN   _patchr3   r   r   )r   r-   r.   rc   r/   rQ   rG   s          r   edit
_Team.editx   sv    4 4:D>D%/\"))7%&..")Y::dkk$))%+kFLD''-r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zCheck if this team has access to ``repository``.

:param str repository:
    (required), form: 'user/repo'
:returns:
    True if the team can access the repository, False otherwise
:rtype:
    bool
rU   rD   rW   rX   rM   r3   rY   _getr   rZ   r*   s      r   has_repository_Team.has_repository   s5     oogzIIoF}}TYYs^S#66r   c           	          0 n0 nXR                   ;   a	  XS'   SUS'   U R                  SU R                  S9nU R                  [	        U5      U[
        R                  UUUS9$ )a  Iterate over the members of this team.

:param str role:
    (optional), filter members returned by their role in the team.
    Can be one of: ``"member"``, ``"maintainer"``, ``"all"``. Default:
    ``"all"``.
:param int number:
    (optional), number of users to iterate over.  Default: -1 iterates
    over all values
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of the members of this team
:rtype:
    :class:`~github3.users.ShortUser`
rB   +application/vnd.github.ironman-preview+jsonAcceptmembersrD   paramsetagheaders)filterable_member_rolesrM   r3   _iterintr   	ShortUser)r   rB   numberrw   rx   rv   r*   s          r   rt   _Team.members   sq    $ ///!6N MGHooi$))o<zzKOO  
 	
r   rZ   r   c                     SS0nU R                  SXR                  S9nU R                  U R                  X2S9S5      n[	        X@5      $ )Nrs   z)application/vnd.github.v3.repository+jsonrU   rD   rx   rH   )rM   r3   rN   rm   r   )r   rZ   rx   r*   rG   s        r   permissions_for_Team.permissions_for   sK     HIoogzIIoFzz$))C)93?-d99r   c                 t    U R                  SU R                  S9nU R                  [        U5      U[        US9$ )az  Iterate over the repositories this team has access to.

:param int number:
    (optional), number of repos to iterate over. Default: -1 iterates
    over all values
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of repositories this team has access to
:rtype:
    :class:`~github3.orgs.ShortRepositoryWithPermissions`
rU   rD   rw   )rM   r3   rz   r{   r   r   r}   rw   r*   s       r   repositories_Team.repositories   s@     oog		o:zzK*	  
 	
r   c                     U R                  SXR                  S9nU R                  U R                  U5      S5      nU=(       d    0 $ )zRetrieve the membership information for the user.

:param str username:
    (required), name of the user
:returns:
    dictionary with the membership
:rtype:
    dict
rC   rD   rH   rM   r3   rN   rm   r   rP   r*   rG   s       r   membership_for_Team.membership_for   s<     oomX		oJzz$))C.#.zrr   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zRevoke this user's team membership.

:param str username:
    (required), name of the team member
:returns:
    True if successful, False otherwise
:rtype:
    bool
rC   rD   rW   rX   rM   r3   rY   r_   r   rP   r*   s      r   revoke_membership_Team.revoke_membership   s6     oomX		oJ}}T\\#.S99r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zRemove ``repository`` from this team.

:param str repository:
    (required), form: 'user/repo'
:returns:
    True if successful, False otherwise
:rtype:
    bool
rU   rD   rW   rX   r   rn   s      r   remove_repository_Team.remove_repository  s6     oogzIIoF}}T\\#.S99r   )	r3   r+   r4   r-   r2   r.   r/   r0   r1   r&    )r   NN)NNr   N)r   r   r   r   __doc__r   	frozensetrI   unionry   r   r=   r   rR   r[   r`   strtOptionalr{   ri   ro   rt   r   r   r   r   r   r   r     r   r   r$   r$      sj   .Jh56L*00%92 < : :@ I I* @ @  *.#'%% % 

3	%
 C% %N 7 7 
 
@ ::	': : 
 
*   : : : :r   r$   c                   0   ^  \ rS rSrSrS rU 4S jrSrU =r$ )Teami  aJ  Object representing a team in the GitHub API.

In addition to the attributes on a :class:`~github3.orgs.ShortTeam` a Team
has the following attribute:

.. attribute:: created_at

    A :class:`~datetime.datetime` instance representing the time and date
    when this team was created.

.. attribute:: members_count

    The number of members in this team.

.. attribute:: organization

    A :class:`~github3.orgs.ShortOrganization` representing the
    organization this team belongs to.

.. attribute:: repos_count

    The number of repositories this team can access.

.. attribute:: updated_at

    A :class:`~datetime.datetime` instance representing the time and date
    when this team was updated.

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

.. _Team Documentation:
    http://developer.github.com/v3/orgs/teams/
c                    > [         TU ]  U5        U R                  US   5      U l        US   U l        [        US   U 5      U l        US   U l        U R                  US   5      U l        g )N
created_atmembers_countorganizationrepos_count
updated_at)	r   r   	_strptimer   r   ShortOrganizationr   r   r   )r   r7   r   s     r   r   Team._update_attributes?  sh    "4(..l);<!/2-d>.BDI...l);<r   )r   r   r   r   r   	r   r   r   r   r   r   r   r    r!   r"   s   @r   r   r     s     D J= =r   r   c                        \ rS rSrSrS r\rSrg)r6   iH  at  Object representing a team in the GitHub API.

.. attribute:: id

    Unique identifier for this team across all of GitHub.

.. attribute:: members_count

    The number of members in this team.

.. attribute:: members_urlt

    A :class:`~uritemplate.URITemplate` instance to either retrieve all
    members in this team or to test if a user is a member.

.. attribute:: name

    The human-readable name provided to this team.

.. attribute:: permission

    The level of permissions this team has, e.g., ``push``, ``pull``,
    or ``admin``.

.. attribute:: privacy

    The privacy level of this team inside the organization.

.. attribute:: repos_count

    The number of repositories this team can access.

.. attribute:: repositories_url

    The URL of the resource to enumerate all repositories this team can
    access.

.. attribute:: slug

    The handle for this team or the portion you would use in an
    at-mention after the ``/``, e.g., in ``@myorg/myteam`` the
    slug is ``myteam``.

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

.. _Team Documentation:
    http://developer.github.com/v3/orgs/teams/
r   N)	r   r   r   r   r   r   r   _refresh_tor    r   r   r   r6   r6   H  s    /b JKr   r6   c                      \ rS rSrSrS r\" SS/5      r\" SS/5      r\R                  S/5      r
\" / SQ5      rS rS	 r\SAS
 j5       r\S 5       r\ SBS\S\R&                  \   S\R*                  \R.                  SS4   4S jj5       r\S\R2                  S\4S j5       r\S\R2                  S\4S j5       r\S\R2                  S\4S j5       r\S/S4S j5       r\SCS j5       r\          SDS j5       r \S 5       r!\/ / SSS4S\S\R&                  \RD                  \      S\R&                  \RF                  \RD                  \   \RD                  S    4      S!\S"\R&                  \   S#\4S$ jj5       r$\          SES% j5       r%\S& 5       r&\SBS' j5       r'\ SFS( j5       r(\S) 5       r)\S* 5       r*S+ r+S, r,SBS- jr-SBS. jr.\SBS/ j5       r/SGS0 jr0\S1 5       r1SBS2 jr2SHS3 jr3SBS4 jr4\S5 5       r5SIS6 jr6\SBS7 j5       r7\S\S\4S8 j5       r8\S\S\4S9 j5       r9\S:\RF                  \:\;\4   S;\4S< j5       r<\S;\S\R&                  \=   4S= j5       r>\S>\S\R&                  \=   4S? j5       r?S@r@g)J_Organizationi~  zThe :class:`Organization <Organization>` object.

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

.. _Organization Documentation:
    http://developer.github.com/v3/orgs/
2fa_disabledr(   adminr&   )r   direct_memberbilling_managerc                    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S   U l        [        US	   5      U l	        US
   U l
        US   =U l        U l        SU l        g )N
avatar_urldescription
events_url	hooks_urlr+   
issues_urlloginr,   public_members_url	repos_urlr*   Organization)r   r   r   r   r+   r   r   r,   r   public_members_urltr   r*   r3   type)r   orgs     r   r    _Organization._update_attributes  s    l+}-l+[)d)l+\
}-#.s3G/H#I [)"5z)49"	r   c                 N    Sn[        U SS 5      nUb  SU 3nSR                  XS9$ )Nr   r-   :z%<{s.class_name} [{s.login}{display}]>)r:   display)getattrr;   )r   display_namer-   s      r   r=   _Organization._repr  sA    tVT*tf:L6== > 
 	
r   c           	      R   X R                   ;  a<  [        SR                  SR                  [	        U R                   5      5      5      5      eSU0nU R                  S[        U5      U R                  S9nU R                  U R                  XCS9S5      nU R                  [        U5      $ )an  Add a member or update their role.

:param str username:
    (required), user to add or update.
:param str role:
    (optional), role to give to the user. Options are ``member``,
    ``admin``. Defaults to ``member``.
:returns:
    the created or updated membership
:rtype:
    :class:`~github3.orgs.Membership`
:raises:
    ValueError if role is not a valid choice
r@   rA   rB   rC   rD   rF   rH   )rI   rJ   r;   rK   rL   rM   r   r3   rN   rO   _instance_or_null
Membership)r   rP   rB   rQ   r*   rG   s         r   rR   &_Organization.add_or_update_membership  s      (((*11IIfT%6%678 
 ~oo3x=499  
 zz$))C)3S9%%j$77r   c           
          [        U5      S:  a  gU R                  S[        U R                  5      S[        U5      S[        U5      5      nU R	                  U R                  U5      SS5      $ )a  Add ``repository`` to ``team``.

.. versionchanged:: 1.0

    The second parameter used to be ``team`` but has been changed to
    ``team_id``. This parameter is now required to be an integer to
    improve performance of this method.

:param str repository:
    (required), form: 'user/repo'
:param int team_id:
    (required), team id
:returns:
    True if successful, False otherwise
:rtype:
    bool
r   Forganizationsr7   rU   rW   rX   )r{   rM   r   r+   rY   rO   r   rZ   team_idr*   s       r   r[   _Organization.add_repository  s`    & w<!ooLL
O
 }}TYYs^S#66r   Nr}   rw   r   c                     U R                  SU R                  S9nU R                  [        U5      U[        R
                  US9$ )ar  Iterate over the users blocked by this organization.

.. versionadded:: 2.1.0

:param int number:
    (optional), number of users to iterate over.  Default: -1 iterates
    over all values
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of the members of this team
:rtype:
    :class:`~github3.users.ShortUser`
blocksrD   r   rM   r3   rz   r{   r   r|   r   s       r   blocked_users_Organization.blocked_users  s9    $ ooho;zz#f+sEOO$zGGr   rP   c                     U R                  S[        U5      U R                  S9nU R                  U R	                  U5      SS5      $ )zBlock a specific user from an organization.

.. versionadded:: 2.1.0

:parameter str username:
    Name (or user-like instance) of the user to block.
:returns:
    True if successful, Fales otherwise
:rtype:
    bool
r   rD   rW   rX   )rM   r   r3   rY   rO   r   s      r   block_Organization.block   ;     oohH		oJ}}TYYs^S#66r   c                     U R                  S[        U5      U R                  S9nU R                  U R	                  U5      SS5      $ )zUnblock a specific user from an organization.

.. versionadded:: 2.1.0

:parameter str username:
    Name (or user-like instance) of the user to unblock.
:returns:
    True if successful, Fales otherwise
:rtype:
    bool
r   rD   rW   rX   )rM   r   r3   rY   r_   r   s      r   unblock_Organization.unblock  s<     oohH		oJ}}T\\#.S99r   c                     U R                  S[        U5      U R                  S9nU R                  U R	                  U5      SS5      $ )zCheck if this organization is blocking a specific user.

.. versionadded:: 2.1.0

:parameter str username:
    Name (or user-like instance) of the user to unblock.
:returns:
    True if successful, Fales otherwise
:rtype:
    bool
r   rD   rW   rX   )rM   r   r3   rY   rm   r   s      r   is_blocking_Organization.is_blocking   r   r   pushTc                     SnU(       a\  U(       aU  [        U[        5      (       a@  U R                  SU R                  S9nUUUUS.nU R	                  U R                  XgS9S5      nU(       a  [        XP5      $ S$ )a  Create a hook on this organization.

:param str name:
    (required), name of the hook
:param dict config:
    (required), key-value pairs which act as settings for this hook
:param list events:
    (optional), events the hook is triggered for
:param bool active:
    (optional), whether the hook is actually triggered
:returns:
    the created hook
:rtype:
    :class:`~github3.orgs.OrganizationHook`
NhooksrD   )r-   configeventsactiverV      )
isinstancedictrM   r3   rN   _postOrganizationHook)r   r-   r   r   r   rG   r*   rQ   s           r   create_hook_Organization.create_hook0  ss    " Fz&$77//'DII/>C   	D ::djjj8#>D/3+==r   c                     U R                  SU R                  S9nXS.nU R                  U R                  X4[        R
                  S9S5      nU R                  [        U5      $ )aZ  Create a project for this organization.

If the client is authenticated and a member of the organization, this
will create a new project in the organization.

:param str name:
    (required), name of the project
:param str body:
    (optional), the body of the project
:returns:
    the new project
:rtype:
    :class:`~github3.projects.Project`
projectsrD   )r-   bodyr   r   )rM   r3   rN   r   r
   CUSTOM_HEADERSr   )r   r-   r   r*   rQ   rG   s         r   create_project_Organization.create_projectM  s]      ooj499o=+zzJJs'*@*@JA3
 %%gt44r   c                    U R                  SU R                  S9nUUUUUUU
UU	US.
n[        U5      S:  a  UR                  SU05        U R	                  U R                  X5      S5      nU R                  [        U5      $ )a=  Create a repository for this organization.

If the client is authenticated and a member of the organization, this
will create a new repository in the organization.

    ``name`` should be no longer than 100 characters

:param str name:
    (required), name of the repository

    .. warning:: this should be no longer than 100 characters
:param str description:
    (optional)
:param str homepage:
    (optional)
:param bool private:
    (optional), If ``True``, create a private repository. API default:
    ``False``
:param bool has_issues:
    (optional), If ``True``, enable issues for this repository. API
    default: ``True``
:param bool has_wiki:
    (optional), If ``True``, enable the wiki for this repository. API
    default: ``True``
:param int team_id:
    (optional), id of the team that will be granted access to this
    repository
:param bool auto_init:
    (optional), auto initialize the repository.
:param str gitignore_template:
    (optional), name of the template; this is ignored if auto_int is
    False.
:param str license_template:
    (optional), name of the license; this is ignored if auto_int is
    False.
:param bool has_projects:
    (optional), If ``True``, enable projects for this repository. API
    default: ``True``
:returns:
    the created repository
:rtype:
    :class:`~github3.repos.Repository`
rU   rD   )
r-   r   homepageprivate
has_issueshas_wikilicense_template	auto_initgitignore_templatehas_projectsr   r   r   )rM   r3   r{   updaterN   r   r   r   )r   r-   r   r   r   r   r   r   r   r   r   r   r*   rQ   rG   s                  r   create_repository_Organization.create_repositoryd  s    t oog		o:& $  0""4(
 w<!KKG,-zz$**S/5%%j$77r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zConceal ``username``'s membership in this organization.

:param str username:
    username of the organization member to conceal
:returns:
    True if successful, False otherwise
:rtype:
    bool
public_membersrD   rW   rX   r   r   s      r   conceal_member_Organization.conceal_member  s7     oo.99oM}}T\\#.S99r   pullrf   r-   
repo_namesmaintainersz_users._Userr.   rc   r/   c           
         UU=(       d    /  Vs/ s H  n[        USU5      PM     snU=(       d    /  Vs/ s H  n[        USU5      PM     snUUS.n	U(       a  U	R                  SU05        U R                  SU R                  S9n
U R	                  U R                  X5      S5      nU R                  [        U5      $ s  snf s  snf )a"  Create a new team and return it.

This only works if the authenticated user owns this organization.

:param str name:
    (required), name to be given to the team
:param list repo_names:
    (optional) repositories, e.g.  ['github/dotfiles']
:param list maintainers:
    (optional) list of usernames who will be maintainers
:param str permission:
    (optional), options:

    - ``pull`` -- (default) members can not push or administer
        repositories accessible by this team
    - ``push`` -- members can push and pull but not administer
        repositories accessible by this team
    - ``admin`` -- members can push, pull and administer
        repositories accessible by this team
:param int parent_team_id:
    (optional), the ID of a team to set as the parent team.
:param str privacy:
    (optional), options:

    - ``secret`` -- (default) only visible to organization
        owners and members of this team
    - ``closed`` -- visible to all members of this organization
:returns:
    the created team
:rtype:
    :class:`~github3.orgs.Team`
	full_namer   )r-   r  r  r.   r/   rc   teamsrD   r   )r   r   rM   r3   rN   r   r   r   )r   r-   r  r  r.   rc   r/   rmrQ   r*   rG   s               r   create_team_Organization.create_team  s    Z 5?5E25E5Eq;*5E 2=1B1B1B17A&1B %
=
 KK)>:;oog		o:zz$**S/5%%dD11s
   B>Cc                     SnUUUUUUUUU	U
S.
nU R                  U5        U(       a3  U R                  U R                  U R                  [	        U5      S9S5      nU(       a  U R                  U5        gg)ar  Edit this organization.

:param str billing_email:
    (optional) Billing email address (private)
:param str company:
    (optional)
:param str email:
    (optional) Public email address
:param str location:
    (optional)
:param str name:
    (optional)
:param str description:
    (optional) The description of the company.
:param bool has_organization_projects:
    (optional) Toggles whether organization projects are enabled for
    the organization.
:param bool has_repository_projects:
    (optional) Toggles whether repository projects are enabled for
    repositories that belong to the organization.
:param string default_repository_permission:
    (optional) Default permission level members have for organization
    repositories:

    - ``read`` -- (default) can pull, but not push to or administer
        this repository.
    - ``write`` -- can pull and push, but not administer this
        repository.
    - ``admin`` -- can pull, push, and administer this repository.
    - ``none`` -- no permissions granted by default.
:param bool members_can_create_repositories:
    (optional) Toggles ability of non-admin organization members to
    create repositories:

    - ``True`` -- (default) all organization members can create
        repositories.
    - ``False`` -- only admin members can create repositories.
:returns:
    True if successful, False otherwise
:rtype:
    bool
N)
billing_emailcompanyemaillocationr-   r   has_organization_projectshas_repository_projectsdefault_repository_permissionmembers_can_create_repositoriesrV   rH   TF)_remove_nonerN   rh   r3   r   r   )r   r  r  r  r  r-   r   r  r  r  r  rG   rQ   s                r   ri   _Organization.edit  s~    p * &)B'>-J/N
 	$::dkk$))%+kFLD##D)r   c                     Sn[        U5      S:  aE  U R                  S[        U5      U R                  S9nU R	                  U R                  U5      S5      nU R                  [        U5      $ )zGet a single hook.

:param int hook_id:
    (required), id of the hook
:returns:
    the hook
:rtype:
    :class:`~github3.orgs.OrganizationHook`
Nr   r   rD   rH   )r{   rM   r   r3   rN   rm   r   r   )r   hook_idrG   r*   s       r   hook_Organization.hookK  s]     w<!//'3w<$))/LC::diinc2D%%&6==r   c                 t    U R                  SU R                  S9nU R                  [        U5      U[        US9$ )a<  Iterate over hooks registered on this organization.

:param int number:
    (optional), number of hoks to return. Default: -1
    returns all hooks
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of hooks
:rtype:
    :class:`~github3.orgs.OrganizationHook`
r   rD   r   )rM   r3   rz   r{   r   r   s       r   r   _Organization.hooks\  s6     oog		o:zz#f+s,<4zHHr   c           	         Uc  Ub  Ub  Ub  [        S5      eU(       d  [        S5      eSU0nUb  X%S'   OX5S'   X@R                  ;  a<  [        SR                  SR                  [	        U R                  5      5      5      5      eSS	0nXES
'   U R                  SU R                  S9nU R                  U R                  XuUS9S5      nU R                  [        U5      $ )a  Invite the user to join this organization.

:param list[int] team_ids:
    (required), list of team identifiers to invite the user to
:param int invitee_id:
    (required if email is not specified), the identifier for the user
    being invited
:param str email:
    (required if invitee_id is not specified), the email address of
    the user being invited
:param str role:
    (optional) role to provide to the invited user. Must be one of
:returns:
    the created invitation
:rtype:
    :class:`~github3.orgs.Invitation`
z7One of either 'invitee_id' or 'email' must be specifiedz/'team_ids' must be a non-empty list of integersteam_ids
invitee_idr  r@   rA   rs   +application/vnd.github.dazzler-preview.jsonrB   invitationsrD   )rQ   rx   rH   )rJ   invitation_rolesr;   rK   rL   rM   r3   rN   r   r   
Invitation)	r   r   r!  r  rB   rQ   rx   r*   rG   s	            r   invite_Organization.invitem  s    * 5="u'8I  A  H%!!+!M,,,*11IIfT%:%:;< 
 JKVoomdiio@zz$**SW*EsK%%j$77r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zCancel the invitation using ``invitee_id``
of the user from the organization.

:param int invitee_id:
    the identifier for the user being invited, to cancel its invitation
:returns: bool
r#  rD   rW   rX   r   )r   r!  r*   s      r   cancel_invite_Organization.cancel_invite  s6     oomZ))oL}}T\\#.S99r   c                 z    U R                  SU R                  S9nU R                  U R                  U5      SS5      $ )z6List failed organization invitations.

:returns: bool
failed_invitationsrD   rH   rX   r   r   r*   s     r   r,   _Organization.failed_invitations  s6     oo2TYYoGzz$))C.#s33r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zCheck if the user named ``username`` is a member.

:param str username:
    name of the user you'd like to check
:returns:
    True if successful, False otherwise
:rtype:
    bool
rt   rD   rW   rX   rl   r   s      r   	is_member_Organization.is_member  s5     ooiIIoF}}TYYs^S#66r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zCheck if the user named ``username`` is a public member.

:param str username:
    name of the user you'd like to check
:returns:
    True if the user is a public member, False otherwise
:rtype:
    bool
r  rD   rW   rX   rl   r   s      r   is_public_member_Organization.is_public_member  s6     oo.99oM}}TYYs^S#66r   c                 ~    U R                  SUSSU R                  5      nU R                  [        U5      U[        US9$ )a  Iterate over all org events visible to the authenticated user.

:param str username:
    (required), the username of the currently authenticated user.
:param int number:
    (optional), number of events to return. Default: -1 iterates over
    all events available.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of events
:rtype:
    :class:`~github3.events.Event`
r   r   orgsr   )rM   r   rz   r{   r	   )r   rP   r}   rw   r*   s        r   
all_events_Organization.all_events  s9     oogx64::Nzz#f+sEz==r   c                 t    U R                  SU R                  S9nU R                  [        U5      U[        US9$ )aH  Iterate over public events for this org.

:param int number:
    (optional), number of events to return. Default: -1 iterates over
    all events available.
:param str etag:
    (optional), ETag from a previous request to the same
    endpoint
:returns:
    generator of public events
:rtype:
    :class:`~github3.events.Event`
r   rD   r   )rM   r3   rz   r{   r	   r   s       r   public_events_Organization.public_events  s5     ooho;zz#f+sEz==r   c                 |    SS0nU R                  SU R                  S9nU R                  [        U5      U[        X#S9$ )zIterate over outstanding invitations to this organization.

:returns:
    generator of invitation objects
:rtype:
    :class:`~github3.orgs.Invitation`
rs   z$application/vnd.github.korra-previewr#  rD   rw   rx   )rM   r3   rz   r{   r%  )r   r}   rw   rx   r*   s        r   r#  _Organization.invitations  sH     CDoomdiio@zzKjt  
 	
r   c           	          0 n0 nXR                   ;   a  XS'   X R                  ;   a	  X&S'   SUS'   U R                  SU R                  S9nU R	                  [        U5      U[        R                  UUUS9$ )a  Iterate over members of this organization.

:param str filter:
    (optional), filter members returned by this method. Can be one of:
    ``"2fa_disabled"``, ``"all",``. Default: ``"all"``. Filtering by
    ``"2fa_disabled"`` is only available for organization owners with
    private repositories.
:param str role:
    (optional), filter members returned by their role. Can be one of:
    ``"all"``, ``"admin"``, ``"member"``. Default: ``"all"``.
:param int number:
    (optional), number of members to return. Default: -1 will return
    all available.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of members of this organization
:rtype:
    :class:`~github3.users.ShortUser`
filterrB   rr   rs   rt   rD   ru   )members_filtersry   rM   r3   rz   r{   r   r|   )r   r@  rB   r}   rw   rx   rv   r*   s           r   rt   _Organization.members  s    * )))%8///!6N !NGHooi$))o<zzKOO  
 	
r   c                     U R                  SXR                  S9nU R                  U R                  U5      SS5      nU R	                  [
        U5      $ )a  Obtain the membership status of ``username``.

Implements
https://developer.github.com/v3/orgs/members/#get-organization-membership

:param str username:
    (required), username name of the user
:returns:
    the membership information
:rtype:
    :class:`~github3.orgs.Membership`
rC   rD   rH   rX   )rM   r3   rN   rm   r   r   r   s       r   r   _Organization.membership_for&  sG     oomX		oJzz$))C.#s3%%j$77r   c                     U R                  SU R                  S9nU R                  [        U5      U[        R
                  US9$ )aI  Iterate over public members of this organization.

:param int number:
    (optional), number of members to return. Default: -1 will return
    all available.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of public members
:rtype:
    :class:`~github3.users.ShortUser`
r  rD   r   r   r   s       r   r  _Organization.public_members8  s:     oo.oCzz#f+sEOO$zGGr   c                     U R                  SU5      nU R                  U R                  U[        R                  S9S5      nU R                  [        U5      $ )zReturn the organization project with the given ID.

:param int id:
    (required), ID number of the project
:returns:
    requested project
:rtype:
    :class:`~github3.projects.Project`
r   r   rH   )rM   rN   rm   r
   r   r   )r   r+   rw   r*   rG   s        r   project_Organization.projectH  sJ     ooj"-zz$))C1G1G)H#N%%gt44r   c                     U R                  SU R                  S9nU R                  [        U5      U[        U[        R
                  S9$ )aL  Iterate over projects for this organization.

:param int number:
    (optional), number of members to return. Default: -1 will return
    all available.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of organization projects
:rtype:
    :class:`~github3.projects.Project`
r   rD   r=  )rM   r3   rz   r{   r
   r   r   s       r   r   _Organization.projectsV  sI     ooj499o=zzK**  
 	
r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zRemove ``username`` from this organization.

Unlike ``remove_member``, this will cancel a pending invitation.

:param str username: (required), username of the member to remove
:returns: bool
rC   rD   rW   rX   r   r   s      r   remove_membership_Organization.remove_membershipl  s6     oomX		oJ}}T\\#.S99r   c                     U R                  SU R                  S9n0 nUS;   a  XS'   U R                  [        U5      U[        XS5      $ )a  Iterate over repos for this organization.

:param str type:
    (optional), accepted values: ('all', 'public', 'member', 'private',
    'forks', 'sources'), API default: 'all'
:param int number:
    (optional), number of members to return. Default: -1 will return
    all available.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of repositories in this organization
:rtype:
    :class:`~github3.repos.Repository`
rU   rD   )r(   publicr&   r   forkssourcesr   )rM   r3   rz   r{   r   )r   r   r}   rw   r*   rv   s         r   r   _Organization.repositoriesx  sH      oog		o:MM!6Nzz#f+sOVJJr   c                 t    U R                  SU R                  S9nU R                  [        U5      U[        US9$ )aX  Iterate over teams that are part of this organization.

:param int number:
    (optional), number of teams to return. Default: -1 returns all
    available teams.
:param str etag:
    (optional), ETag from a previous request to the same endpoint
:returns:
    generator of this organization's teams
:rtype:
    :class:`~github3.orgs.ShortTeam`
r	  rD   r   )rM   r3   rz   r{   r6   r   s       r   r	  _Organization.teams  s5     oog		o:zz#f+sIDzAAr   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )zMake ``username``'s membership in this organization public.

:param str username:
    the name of the user whose membership you wish to publicize
:returns:
    True if successful, False otherwise
:rtype:
    bool
r  rD   rW   rX   )rM   r3   rY   rO   r   s      r   publicize_member_Organization.publicize_member  s6     oo.99oM}}TYYs^S#66r   c                 z    U R                  SXR                  S9nU R                  U R                  U5      SS5      $ )aY  Remove the user named ``username`` from this organization.

.. note::

    Only a user may publicize their own membership. See also:
    https://developer.github.com/v3/orgs/members/#publicize-a-users-membership

:param str username:
    name of the user to remove from the org
:returns:
    True if successful, False otherwise
:rtype:
    bool
rt   rD   rW   rX   r   r   s      r   remove_member_Organization.remove_member  s6      ooiIIoF}}T\\#.S99r   rZ   r   c           
          [        U5      S:  a]  U R                  S[        U R                  5      S[        U5      S[        U5      5      nU R	                  U R                  U5      SS5      $ g)zRemove ``repository`` from the team with ``team_id``.

:param str repository:
    (required), form: 'user/repo'
:param int team_id:
    (required), the unique identifier of the team
:returns:
    True if successful, False otherwise
:rtype:
    bool
r   r   r7   rU   rW   rX   F)r{   rM   r   r+   rY   r_   r   s       r   r   _Organization.remove_repository  sa    " w<!//DGGGJC ==c!2C==r   c                     Sn[        U5      S:  aQ  U R                  S[        U R                  5      S[        U5      5      nU R	                  U R                  U5      S5      nU R                  [        U5      $ )zReturn the team specified by ``team_id``.

:param int team_id:
    (required), unique id for the team
:returns:
    the team identified by the id in this organization
:rtype:
    :class:`~github3.orgs.Team`
Nr   r   r7   rH   )r{   rM   r   r+   rN   rm   r   r   )r   r   rG   r*   s       r   r7   _Organization.team  se     w<!//TWWvs7|C ::diinc2D%%dD11r   	team_slugc                     U R                  S[        U5      U R                  S9nU R                  U R	                  U5      S5      nU R                  [        U5      $ )zReturn the team specified by ``team_slug``.

:param str team_slug:
    (required), slug for the team
:returns:
    the team identified by the slug in this organization
:rtype:
    :class:`~github3.orgs.Team`
r	  rD   rH   )rM   r   r3   rN   rm   r   r   )r   r`  r*   rG   s       r   team_by_name_Organization.team_by_name  sK     oogs9~		oJzz$))C.#.%%dD11r   )r3   r   r   r   r   r+   r   r   r,   r   r   r   r*   r   r   r   )
r   r   FTTr   Fr   r   T)
NNNNNNNNNN)NNr   )NNr   NN)r   r   N)Ar   r   r   r   r   r   r   rA  rI   r   ry   r$  r   r=   r   rR   r[   r{   r   r   r   	Generatorr   r|   r   UserLikeboolr   r   r   r   r   r   r  SequenceUnionr  ri   r  r   r&  r)  r,  r0  r3  r7  r:  r#  rt   r   r  rH  r   rM  r   r	  rW  rZ  r   r   r   r   r7   rb  r    r   r   r   r   r   ~  sZ    !J   78O gx01L*00%9 !5#
 8 88 7 7> 8<HH&'jjoH	
U__dD0	1H H( 7enn 7 7 7 : :4 : : 7ENN 7t 7 7 06x > >8 5 5,  I8 I8V : :  35  *.;2;2 JJqzz#/;2 ZZGGAJJsOQZZ%??@
	;2 ;2 

3;2 ;2 ;2z  "& $&*(,L L\ > >  I I  :I-8 -8^ 	: 	: 4 477>$>" 
 
&
P 8 8"H 5
, 	: 	:K, B B  7 7 7 7 :c :d : :$ GGJ<=  8 2C 2AJJt$4 2 2$ 2c 2ajj.> 2 2r   r   c                   0   ^  \ rS rSrSrS rU 4S jrSrU =r$ )r   i   a  Object for the full representation of a Organization.

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

.. versionchanged:: 1.0.0

This object includes all attributes on
:class:`~github3.orgs.ShortOrganization` as well as the following:

.. attribute:: blog

    If set, the URL of this organization's blog.

.. attribute:: company

    The name of the company that is associated with this organization.

.. attribute:: created_at

    A :class:`~datetime.datetime` instance representing the time and date
    when this organization was created.

.. attribute:: email

    The email address associated with this organization.

.. attribute:: followers_count

    The number of users following this organization. Organizations no
    longer have followers so this number will always be 0.

.. attribute:: following_count

    The number of users this organization follows. Organizations no
    longer follow users so this number will always be 0.

.. attribute:: html_url

    The URL used to view this organization in a browser.

.. attribute:: location

    The location of this organization, e.g., New York, NY.

.. attribute:: name

    The display name of this organization.

.. attribute:: public_repos_count

    The number of public repositories owned by thi sorganization.
c                   > [         TU ]  U5        U R                  US   5      U l        US   U l        US   U l        US   U l        US   U l        UR                  S5      U l	        UR                  S5      U l
        UR                  S5      U l        UR                  S	5      U l        UR                  S
5      U l        g )Nr   	followers	followinghtml_urlpublic_reposblogr  r  r  r-   )r   r   r   r   followers_countfollowing_countrn  public_repos_countr5   rp  r  r  r  r-   )r   r   r   s     r   r   Organization._update_attributes>  s    "3'..\):;";/";/J"%n"5 GGFO	wwy)WWW%

+GGFO	r   )
rp  r  r   r  rq  rr  rn  r  r-   rs  r   r"   s   @r   r   r      s    9v  J$ $r   r   c                        \ rS rSrSrS r\rSrg)r   iN  al  Object for the shortened representation of an Organization.

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

.. versionadded:: 1.0.0

.. attribute:: avatar_url

    The URL of the avatar image for this organization.

.. attribute:: description

    The user-provided description of this organization.

.. attribute:: events_url

    The URL to retrieve the events related to this organization.

.. attribute:: hooks_url

    The URL for the resource to manage organization hooks.

.. attribute:: id

    The unique identifier for this organization across GitHub.

.. attribute:: issues_url

    The URL to retrieve the issues across this organization's
    repositories.

.. attribute:: login

    The unique username of the organization.

.. attribute:: members_url

    The URL to retrieve the members of this organization.

.. attribute:: public_members_urlt

    A :class:`uritemplate.URITemplate` that can be expanded to either list
    the public members of this organization or verify a user is a public
    member.

.. attribute:: repos_url

    The URL to retrieve the repositories in this organization.

.. attribute:: url

    The URL to retrieve this organization from the GitHub API.

.. attribute:: type

    .. deprecated:: 1.0.0

        This will be removed in a future release.

    Previously returned by the API to indicate the type of the account.
r   N)	r   r   r   r   r   r   r   r   r    r   r   r   r   r   N  s    @D %JKr   r   c                   4    \ rS rSrSrS rS r\S 5       rSr	g)r%  i  a  Object representing an invitation to an organization.

.. attribute:: created_at

    A :class:`~datetime.datetime` instance representing the time and date
    when this invitation was created.

.. attribute:: email

    The email address of the user invited to the organization.

.. attribute:: id

    The unique identifier for this invitation.

.. attribute:: invitation_team_url

    The API URL to retrieve the :class:`~github3.orgs.ShortTeam` objects
    associated with this invitation.

.. attribute:: inviter

    A :class:`~github3.users.ShortUser` representing the user who invited
    the user identified by ``login``.

.. attribute:: login

    The username of the user invited to the organization.

.. attribute:: team_count

    The number of teams involved in this invitation.
c                    U R                  US   5      U l        US   U l        US   U l        [        R
                  " US   U 5      U l        US   U l        UR                  S5      U l	        UR                  S5      U l
        g )Nr   r  r+   inviterr   invitation_team_url
team_count)r   r   r  r+   r   r|   rx  r   r5   ry  rz  )r   rG   s     r   r   Invitation._update_attributes  sr    ..l);<']
t*tI=']
 $(88,A#B ((<0r   c                 x    SR                  U R                  U R                  U R                  R                  5      $ )Nz"<Invitation {} for [{}] from [{}]>)r;   r+   r   rx  r<   s    r   r=   Invitation._repr  s.    3::GGTZZ!3!3
 	
r   c                 F    U R                  SU R                  [        SS0S9$ )zRetrieve the list of teams associated with this invite.

:returns:
    generator of teams associated with this invitation
:rtype:
    :class:`~github3.orgs.ShortTeam`
r   rs   r"  r   )rz   ry  r6   r<   s    r   r	  Invitation.teams  s2     zz$$LM	  
 	
r   )r   r  r+   ry  rx  r   rz  N)
r   r   r   r   r   r   r=   r   r	  r    r   r   r   r%  r%    s&     D	1

 
 
r   r%  c                   4    \ rS rSrSrS rS r\S 5       rSr	g)r   i  a  Object describing a user's membership in teams and organizations.

.. attribute:: organization

    A :class:`~github3.orgs.ShortOrganization` instance representing the
    organization this membership is part of.

.. attribute:: organization_url

    The URL of the organization resource in the API that this membership
    is part of.

.. attribute:: state

    The state of this membership, e.g., active or pending.

.. attribute:: active

    .. warning::

        This is a computed attribute, it is not returned by the API.

    A boolean attribute equivalent to ``self.state.lower() == 'active'``.

.. attribute:: pending

    .. warning::

        This is a computed attribute, it is not returned by the API.

    A boolean attribute equivalent to ``self.state.lower() == 'pending'``.
c                 "    SU R                    S3$ )Nz<Membership []>)r   r<   s    r   r=   Membership._repr  s    t00144r   c                    US   U l         [        US   U 5      U l        US   U l        US   U l        US   U l        [        R                  " US   U 5      U l        U R
                  U l	        U R                  (       a"  U R
                  R                  5       S:H  U l	        U R
                  U l        U R                  (       a#  U R
                  R                  5       S:H  U l        g g )	Nr*   r   organization_urlrB   stateuserr   pending)r3   r   r   r  rB   r  r   r|   r  r   lowerr  )r   
memberships     r   r   Membership._update_attributes  s    u%	-~&
 !++= >v&	(
OOJv$6=	jj;;****,8DKzz<<::++-:DL r   c                     SnU(       aY  UR                  5       S:X  aE  [        SUR                  5       05      nU R                  U R                  U R                  US9S5      nUb  U R                  U5        gg)zEdit the user's membership.

:param str state:
    (required), the state the membership should be in. Only accepts
    ``"active"``.
:returns:
    True if successful, False otherwise
:rtype:
    bool
Nr   r  rV   rH   TF)r  r   rN   rh   r3   r   )r   r  rG   rQ   s       r   ri   Membership.edit  si     U[[]h.'5;;=12D::dkk$))$k?ED##D)r   )r3   r   r   r  r  rB   r  r  N)
r   r   r   r   r   r=   r   r   ri   r    r   r   r   r   r     s&    B5;"  r   r   c                   b    \ rS rSrSrSS jrS r\S 5       r\0 / S4S j5       r	\S	 5       r
S
rg)r   i%  a  The representation of a hook on an organization.

See also: https://developer.github.com/v3/orgs/hooks/

This object has the following attributes:

.. attribute:: active

    A boolean attribute describing whether the hook is active or not.

.. attribute:: config

    A dictionary containing the configuration for this hook.

.. attribute:: created_at

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

.. attribute:: events

    The list of events which trigger this hook.

.. attribute:: id

    The unique identifier for this hook.

.. attribute:: name

    The name provided to this hook.

.. attribute:: updated_at

    A :class:`~datetime.datetime` object representing the date and time
    when this hook was updated.
Nc                     US   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 R                  US   5      U l        g )	Nr*   r   r   r   r   r+   r-   r   )	r3   r   r   r   r   r   r+   r-   r   )r   r  sessions      r   r   #OrganizationHook._update_attributesK  sn    K	8n8n..l);<8nt*L	..l);<r   c                 "    SU R                    S3$ )Nz<OrganizationHook [r  )r-   r<   s    r   r=   OrganizationHook._reprU  s    $TYYKr22r   c                 Z    U R                  U R                  U R                  5      SS5      $ )zVDelete this hook.

:returns:
    True if successful, False otherwise
:rtype:
    bool
rW   rX   r^   r<   s    r   r`   OrganizationHook.deleteX  rb   r   Tc                     XS.nU(       a  X$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 hook.

:param dict config:
    (required), key-value pairs which act as settings for this hook
:param list events:
    (optional), which events should this be triggered for
:param bool active:
    (optional), should this event be active
:returns:
    True if successful, False otherwise
:rtype:
    bool
)r   r   r   rV   rH   TFrg   )r   r   r   r   rQ   rG   s         r   ri   OrganizationHook.editc  sR     !3#Nzz$++diieDk+BCH##D)r   c                 z    U R                  SU R                  S9nU R                  U R                  U5      SS5      $ )zTPing this hook.

:returns:
    True if successful, False otherwise
:rtype:
    bool
pingsrD   rW   rX   )rM   r3   rY   r   r-  s     r   pingOrganizationHook.ping~  s5     oog		o:}}TZZ_c377r   )r3   r   r   r   r   r+   r-   r   rd  )r   r   r   r   r   r   r=   r   r`   ri   r  r    r   r   r   r   r   %  sW    #J=3 @ @ R  4 	8 	8r   r   ) r   typingr   rG   r   uritemplater   r   r   r   
decoratorsr   r   r	   r   r
   rU   r   r   TYPE_CHECKING_usersr   
GitHubCorer$   r   r6   r   r   r   r%  r   r   r   r   r   <module>r     s    G   #   %    "??!/_ /|:F |:~+=5 +=\3 3l2F%% 2DK$= K$\D DNA
"" A
HI"" IXc8v(( c8r   