14
14
15
15
from uritemplate import URITemplate
16
16
17
+ from .. import users
18
+
17
19
from ..decorators import requires_auth
18
20
from ..events import Event
19
21
from ..git import Blob , Commit , Reference , Tag , Tree
25
27
from ..models import GitHubCore
26
28
from ..notifications import Subscription , Thread
27
29
from ..pulls import PullRequest
28
- from ..users import Key , User
29
30
from ..utils import stream_response_to_file , timestamp_parameter
30
31
from .branch import Branch
31
32
from .comment import RepoComment
@@ -141,7 +142,8 @@ def _update_attributes(self, repo):
141
142
# Repository owner's name
142
143
#: :class:`User <github3.users.User>` object representing the
143
144
#: repository owner.
144
- self .owner = self ._class_attribute (repo , 'owner' , User , self )
145
+ self .owner = self ._class_attribute (
146
+ repo , 'owner' , users .ShortUser , self )
145
147
146
148
#: Is this repository private?
147
149
self .private = self ._get_attribute (repo , 'private' )
@@ -451,10 +453,10 @@ def assignees(self, number=-1, etag=None):
451
453
-1 returns all available assignees
452
454
:param str etag: (optional), ETag from a previous request to the same
453
455
endpoint
454
- :returns: generator of :class:`User < github3.users.User> `\ s
456
+ :returns: generator of :class:`~ github3.users.User`\ s
455
457
"""
456
458
url = self ._build_url ('assignees' , base_url = self ._api )
457
- return self ._iter (int (number ), url , User , etag = etag )
459
+ return self ._iter (int (number ), url , users . ShortUser , etag = etag )
458
460
459
461
def blob (self , sha ):
460
462
"""Get the blob indicated by ``sha``.
@@ -529,10 +531,10 @@ def collaborators(self, number=-1, etag=None):
529
531
Default:
10000
-1 returns all comments
530
532
:param str etag: (optional), ETag from a previous request to the same
531
533
endpoint
532
- :returns: generator of :class:`User < github3.users.User> `\ s
534
+ :returns: generator of :class:`~ github3.users.ShortUser `\ s
533
535
"""
534
536
url = self ._build_url ('collaborators' , base_url = self ._api )
535
- return self ._iter (int (number ), url , User , etag = etag )
537
+ return self ._iter (int (number ), url , users . ShortUser , etag = etag )
536
538
537
539
def comments (self , number = - 1 , etag = None ):
538
540
r"""Iterate over comments on all commits in the repository.
@@ -672,13 +674,13 @@ def contributors(self, anon=False, number=-1, etag=None):
672
674
Default: -1 returns all contributors
673
675
:param str etag: (optional), ETag from a previous request to the same
674
676
endpoint
675
- :returns: generator of :class:`User < github3.users.User> `\ s
677
+ :returns: generator of :class:`~ github3.users.ShortUser `\ s
676
678
"""
677
679
url = self ._build_url ('contributors' , base_url = self ._api )
678
680
params = {}
679
681
if anon :
680
682
params = {'anon' : 'true' }
681
- return self ._iter (int (number ), url , User , params , etag )
683
+ return self ._iter (int (number ), url , users . ShortUser , params , etag )
682
684
683
685
@requires_auth
684
686
def create_blob (self , content , encoding ):
@@ -911,14 +913,14 @@ def create_key(self, title, key, read_only=False):
911
913
:param str key: (required), key text
912
914
:param bool read_only: (optional), restrict key access to read-only,
913
915
default is False
914
- :returns: :class:`Key < github3.users.Key> ` if successful, else None
916
+ :returns: :class:`~ github3.users.Key` if successful, else None
915
917
"""
916
918
json = None
917
919
if title and key :
918
920
data = {'title' : title , 'key' : key , 'read_only' : read_only }
919
921
url = self ._build_url ('keys' , base_url = self ._api )
920
922
json = self ._json (self ._post (url , data = data ), 201 )
921
- return self ._instance_or_null (Key , json )
923
+ return self ._instance_or_null (users . Key , json )
922
924
923
925
@requires_auth
924
926
def create_label (self , name , color ):
@@ -1530,13 +1532,13 @@ def key(self, id_num):
1530
1532
"""Get the specified deploy key.
1531
1533
1532
1534
:param int id_num: (required), id of the key
1533
- :returns: :class:`Key < github3.users.Key> ` if successful, else None
1535
+ :returns: :class:`~ github3.users.Key` if successful, else None
1534
1536
"""
1535
1537
json = None
1536
1538
if int (id_num ) > 0 :
1537
1539
url = self ._build_url ('keys' , str (id_num ), base_url = self ._api )
1538
1540
json = self ._json (self ._get (url ), 200 )
1539
- return Key (json , self ) if json else None
1541
+ return users . Key (json , self ) if json else None
1540
1542
1541
1543
@requires_auth
1542
1544
def keys (self , number = - 1 , etag = None ):
@@ -1546,10 +1548,10 @@ def keys(self, number=-1, etag=None):
1546
1548
returns all available keys
1547
1549
:param str etag: (optional), ETag from a previous request to the same
1548
1550
endpoint
1549
- :returns: generator of :class:`Key < github3.users.Key> `\ s
1551
+ :returns: generator of :class:`~ github3.users.Key`\ s
1550
1552
"""
1551
1553
url = self ._build_url ('keys' , base_url = self ._api )
1552
- return self ._iter (int (number ), url , Key , etag = etag )
1554
+ return self ._iter (int (number ), url , users . Key , etag = etag )
1553
1555
1554
1556
def label (self , name ):
1555
1557
"""Get the label specified by ``name``.
@@ -1912,10 +1914,10 @@ def stargazers(self, number=-1, etag=None):
1912
1914
Default: -1 returns all subscribers available
1913
1915
:param str etag: (optional), ETag from a previous request to the same
1914
1916
endpoint
1915
- :returns: generator of :class:`User < github3.users.User> `\ s
1917
+ :returns: generator of :class:`~ github3.users.ShortUser `\ s
1916
1918
"""
1917
1919
url = self ._build_url ('stargazers' , base_url = self ._api )
1918
- return self ._iter (int (number ), url , User , etag = etag )
1920
+ return self ._iter (int (number ), url , users . ShortUser , etag = etag )
1919
1921
1920
1922
def statuses (self , sha , number = - 1 , etag = None ):
1921
1923
r"""Iterate over the statuses for a specific SHA.
@@ -1963,10 +1965,10 @@ def subscribers(self, number=-1, etag=None):
1963
1965
Default: -1 returns all subscribers available
1964
1966
:param str etag: (optional), ETag from a previous request to the same
1965
1967
endpoint
1966
- :returns: generator of :class:`User < github3.users.User> `
1968
+ :returns: generator of :class:`~ github3.users.ShortUser `
1967
1969
"""
1968
1970
url = self ._build_url ('subscribers' , base_url = self ._api )
1969
- return self ._iter (int (number ), url , User , etag = etag )
1971
+ return self ._iter (int (number ), url , users . ShortUser , etag = etag )
1970
1972
1971
1973
@requires_auth
1972
1974
def subscription (self ):
0 commit comments