@@ -956,7 +956,7 @@ def directory_contents(self, directory_path, ref=None, return_as=list):
956
956
@requires_auth
957
957
def edit (self , name , description = None , homepage = None , private = None ,
958
958
has_issues = None , has_wiki = None , has_downloads = None ,
959
- default_branch = None ):
959
+ default_branch = None , archived = None ):
960
960
"""Edit this repository.
961
961
962
962
:param str name: (required), name of the repository
@@ -980,12 +980,15 @@ def edit(self, name, description=None, homepage=None, private=None,
980
980
:param str default_branch: (optional), If not ``None``, change the
981
981
default branch for this repository. API default: ``None`` - leave
982
982
value unchanged.
983
+ :param bool archived: (optional), If not ``None``, toggle the archived
984
+ attribute on the repository to control whether it is archived or
985
+ not.
983
986
:returns: bool -- True if successful, False otherwise
984
987
"""
985
988
edit = {'name' : name , 'description' : description , 'homepage' : homepage ,
986
989
'private' : private , 'has_issues' : has_issues ,
987
990
'has_wiki' : has_wiki , 'has_downloads' : has_downloads ,
988
- 'default_branch' : default_branch }
991
+ 'default_branch' : default_branch , 'archived' : archived }
989
992
self ._remove_none (edit )
990
993
json = None
991
994
if edit :
@@ -2107,6 +2110,11 @@ class Repository(_Repository):
2107
2110
This object has all the same attributes as
2108
2111
:class:`~github3.repos.repo.ShortRepository` as well as:
2109
2112
2113
+ .. attribute:: archived
2114
+
2115
+ A boolean attribute that describes whether the current repository has
2116
+ been archived or not.
2117
+
2110
2118
.. attribute:: clone_url
2111
2119
2112
2120
This is the URL that can be used to clone the repository via HTTPS,
@@ -2223,6 +2231,7 @@ class Repository(_Repository):
2223
2231
2224
2232
def _update_attributes (self , repo ):
2225
2233
super (Repository , self )._update_attributes (repo )
2234
+ self .archived = repo ['archived' ]
2226
2235
self .clone_url = repo ['clone_url' ]
2227
2236
self .created_at = self ._strptime (repo ['created_at' ])
2228
2237
self .default_branch = repo ['default_branch' ]
@@ -2232,68 +2241,25 @@ def _update_attributes(self, repo):
2232
2241
self .has_downloads = repo ['has_downloads' ]
2233
2242
self .has_issues = repo ['has_issues' ]
2234
2243
self .has_pages = repo ['has_pages' ]
2244
+ self .has_projects = repo ['has_projects' ]
2235
2245
self .has_wiki = repo ['has_wiki' ]
2236
2246
self .homepage = repo ['homepage' ]
2237
2247
self .language = repo ['language' ]
2248
+ self .original_license = repo ['license' ]
2249
+ if self .original_license is not None :
2250
+ self .original_license = License (self .original_license , self )
2238
2251
self .mirror_url = repo ['mirror_url' ]
2252
+ self .network_count = repo ['network_count' ]
2239
2253
self .open_issues_count = repo ['open_issues_count' ]
2240
2254
self .pushed_at = self ._strptime (repo ['pushed_at' ])
2241
2255
self .size = repo ['size' ]
2242
2256
self .ssh_url = repo ['ssh_url' ]
2243
2257
self .stargazers_count = repo ['stargazers_count' ]
2258
+ self .subscribers_count = repo ['subscribers_count' ]
2244
2259
self .svn_url = self ._get_attribute (repo , 'svn_url' )
2245
2260
self .updated_at = self ._strptime_attribute (repo , 'updated_at' )
2246
2261
self .watchers_count = self .watchers = repo ['watchers_count' ]
2247
2262
2248
- # Some repositories do not have these attributes at all
2249
- self .original_license = repo .get ('license' )
2250
- if self .original_license is not None :
2251
- self .original_license = License (self .original_license , self )
2252
- self .network_count = repo .get ('network_count' )
2253
- self .subscribers_count = repo .get ('subscribers_count' )
2254
-
2255
- # .......... OLD ...... Deprecated?
2256
-
2257
- #: URL of the pure diff of the pull request
2258
- self .diff_url = self ._get_attribute (repo , 'diff_url' )
2259
-
2260
- #: URL of the pure patch of the pull request
2261
- self .patch_url = self ._get_attribute (repo , 'patch_url' )
2262
-
2263
- #: API URL of the issue representation of this Pull Request
2264
- self .issue_url = self ._get_attribute (repo , 'issue_url' )
2265
-
2266
- #: Permissions for this repository
2267
- self .permissions = self ._get_attribute (repo , 'permissions' )
2268
-
2269
- #: ``datetime`` object representing when the repository was starred
2270
- self .starred_at = self ._strptime_attribute (repo , 'starred_at' )
2271
-
2272
- #: Parent of this fork, if it exists :class:`Repository`
2273
- self .source = self ._class_attribute (repo , 'source' , Repository , self )
2274
-
2275
- #: Parent of this fork, if it exists :class:`Repository`
2276
- self .parent = self ._class_attribute (repo , 'parent' , Repository , self )
2277
-
2278
- #: master (default) branch for the repository
2279
- self .master_branch = self ._get_attribute (repo , 'master_branch' )
2280
-
2281
- # Template URLS
2282
-
2283
- #: Pull Request Review Comments URL
2284
- self .review_comments_url = self ._class_attribute (
2285
- repo ,
2286
- 'review_comments_url' ,
2287
- URITemplate
2288
- )
2289
-
2290
- #: Pull Request Review Comments URL Template. Expand with ``number``
2291
- self .issue_events_urlt = self ._class_attribute (
2292
- repo ,
2293
- 'review_comment_url' ,
2294
- URITemplate
2295
- )
2296
-
2297
2263
2298
2264
class StarredRepository (GitHubCore ):
2299
2265
"""This object represents the data returned about a user's starred repos.
0 commit comments