Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/Organization.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
| author | bcclaywell |
|---|---|
| date | Mon, 12 Oct 2015 17:43:33 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d67268158946 |
|---|---|
| 1 # -*- coding: utf-8 -*- | |
| 2 | |
| 3 # ########################## Copyrights and license ############################ | |
| 4 # # | |
| 5 # Copyright 2012 Steve English <steve.english@navetas.com> # | |
| 6 # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> # | |
| 7 # Copyright 2012 Zearin <zearin@gonk.net> # | |
| 8 # Copyright 2013 AKFish <akfish@gmail.com> # | |
| 9 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # | |
| 10 # Copyright 2013 martinqt <m.ki2@laposte.net> # | |
| 11 # # | |
| 12 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # | |
| 13 # # | |
| 14 # PyGithub is free software: you can redistribute it and/or modify it under # | |
| 15 # the terms of the GNU Lesser General Public License as published by the Free # | |
| 16 # Software Foundation, either version 3 of the License, or (at your option) # | |
| 17 # any later version. # | |
| 18 # # | |
| 19 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | |
| 20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
| 21 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | |
| 22 # details. # | |
| 23 # # | |
| 24 # You should have received a copy of the GNU Lesser General Public License # | |
| 25 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | |
| 26 # # | |
| 27 # ############################################################################## | |
| 28 | |
| 29 import datetime | |
| 30 | |
| 31 import github.GithubObject | |
| 32 import github.PaginatedList | |
| 33 | |
| 34 import github.Plan | |
| 35 import github.Team | |
| 36 import github.Event | |
| 37 import github.Repository | |
| 38 import github.NamedUser | |
| 39 | |
| 40 | |
| 41 class Organization(github.GithubObject.CompletableGithubObject): | |
| 42 """ | |
| 43 This class represents Organizations. The reference can be found here http://developer.github.com/v3/orgs/ | |
| 44 """ | |
| 45 | |
| 46 @property | |
| 47 def avatar_url(self): | |
| 48 """ | |
| 49 :type: string | |
| 50 """ | |
| 51 self._completeIfNotSet(self._avatar_url) | |
| 52 return self._avatar_url.value | |
| 53 | |
| 54 @property | |
| 55 def billing_email(self): | |
| 56 """ | |
| 57 :type: string | |
| 58 """ | |
| 59 self._completeIfNotSet(self._billing_email) | |
| 60 return self._billing_email.value | |
| 61 | |
| 62 @property | |
| 63 def blog(self): | |
| 64 """ | |
| 65 :type: string | |
| 66 """ | |
| 67 self._completeIfNotSet(self._blog) | |
| 68 return self._blog.value | |
| 69 | |
| 70 @property | |
| 71 def collaborators(self): | |
| 72 """ | |
| 73 :type: integer | |
| 74 """ | |
| 75 self._completeIfNotSet(self._collaborators) | |
| 76 return self._collaborators.value | |
| 77 | |
| 78 @property | |
| 79 def company(self): | |
| 80 """ | |
| 81 :type: string | |
| 82 """ | |
| 83 self._completeIfNotSet(self._company) | |
| 84 return self._company.value | |
| 85 | |
| 86 @property | |
| 87 def created_at(self): | |
| 88 """ | |
| 89 :type: datetime.datetime | |
| 90 """ | |
| 91 self._completeIfNotSet(self._created_at) | |
| 92 return self._created_at.value | |
| 93 | |
| 94 @property | |
| 95 def disk_usage(self): | |
| 96 """ | |
| 97 :type: integer | |
| 98 """ | |
| 99 self._completeIfNotSet(self._disk_usage) | |
| 100 return self._disk_usage.value | |
| 101 | |
| 102 @property | |
| 103 def email(self): | |
| 104 """ | |
| 105 :type: string | |
| 106 """ | |
| 107 self._completeIfNotSet(self._email) | |
| 108 return self._email.value | |
| 109 | |
| 110 @property | |
| 111 def events_url(self): | |
| 112 """ | |
| 113 :type: string | |
| 114 """ | |
| 115 self._completeIfNotSet(self._events_url) | |
| 116 return self._events_url.value | |
| 117 | |
| 118 @property | |
| 119 def followers(self): | |
| 120 """ | |
| 121 :type: integer | |
| 122 """ | |
| 123 self._completeIfNotSet(self._followers) | |
| 124 return self._followers.value | |
| 125 | |
| 126 @property | |
| 127 def following(self): | |
| 128 """ | |
| 129 :type: integer | |
| 130 """ | |
| 131 self._completeIfNotSet(self._following) | |
| 132 return self._following.value | |
| 133 | |
| 134 @property | |
| 135 def gravatar_id(self): | |
| 136 """ | |
| 137 :type: string | |
| 138 """ | |
| 139 self._completeIfNotSet(self._gravatar_id) | |
| 140 return self._gravatar_id.value | |
| 141 | |
| 142 @property | |
| 143 def html_url(self): | |
| 144 """ | |
| 145 :type: string | |
| 146 """ | |
| 147 self._completeIfNotSet(self._html_url) | |
| 148 return self._html_url.value | |
| 149 | |
| 150 @property | |
| 151 def id(self): | |
| 152 """ | |
| 153 :type: integer | |
| 154 """ | |
| 155 self._completeIfNotSet(self._id) | |
| 156 return self._id.value | |
| 157 | |
| 158 @property | |
| 159 def location(self): | |
| 160 """ | |
| 161 :type: string | |
| 162 """ | |
| 163 self._completeIfNotSet(self._location) | |
| 164 return self._location.value | |
| 165 | |
| 166 @property | |
| 167 def login(self): | |
| 168 """ | |
| 169 :type: string | |
| 170 """ | |
| 171 self._completeIfNotSet(self._login) | |
| 172 return self._login.value | |
| 173 | |
| 174 @property | |
| 175 def members_url(self): | |
| 176 """ | |
| 177 :type: string | |
| 178 """ | |
| 179 self._completeIfNotSet(self._members_url) | |
| 180 return self._members_url.value | |
| 181 | |
| 182 @property | |
| 183 def name(self): | |
| 184 """ | |
| 185 :type: string | |
| 186 """ | |
| 187 self._completeIfNotSet(self._name) | |
| 188 return self._name.value | |
| 189 | |
| 190 @property | |
| 191 def owned_private_repos(self): | |
| 192 """ | |
| 193 :type: integer | |
| 194 """ | |
| 195 self._completeIfNotSet(self._owned_private_repos) | |
| 196 return self._owned_private_repos.value | |
| 197 | |
| 198 @property | |
| 199 def plan(self): | |
| 200 """ | |
| 201 :type: :class:`github.Plan.Plan` | |
| 202 """ | |
| 203 self._completeIfNotSet(self._plan) | |
| 204 return self._plan.value | |
| 205 | |
| 206 @property | |
| 207 def private_gists(self): | |
| 208 """ | |
| 209 :type: integer | |
| 210 """ | |
| 211 self._completeIfNotSet(self._private_gists) | |
| 212 return self._private_gists.value | |
| 213 | |
| 214 @property | |
| 215 def public_gists(self): | |
| 216 """ | |
| 217 :type: integer | |
| 218 """ | |
| 219 self._completeIfNotSet(self._public_gists) | |
| 220 return self._public_gists.value | |
| 221 | |
| 222 @property | |
| 223 def public_members_url(self): | |
| 224 """ | |
| 225 :type: string | |
| 226 """ | |
| 227 self._completeIfNotSet(self._public_members_url) | |
| 228 return self._public_members_url.value | |
| 229 | |
| 230 @property | |
| 231 def public_repos(self): | |
| 232 """ | |
| 233 :type: integer | |
| 234 """ | |
| 235 self._completeIfNotSet(self._public_repos) | |
| 236 return self._public_repos.value | |
| 237 | |
| 238 @property | |
| 239 def repos_url(self): | |
| 240 """ | |
| 241 :type: string | |
| 242 """ | |
| 243 self._completeIfNotSet(self._repos_url) | |
| 244 return self._repos_url.value | |
| 245 | |
| 246 @property | |
| 247 def total_private_repos(self): | |
| 248 """ | |
| 249 :type: integer | |
| 250 """ | |
| 251 self._completeIfNotSet(self._total_private_repos) | |
| 252 return self._total_private_repos.value | |
| 253 | |
| 254 @property | |
| 255 def type(self): | |
| 256 """ | |
| 257 :type: string | |
| 258 """ | |
| 259 self._completeIfNotSet(self._type) | |
| 260 return self._type.value | |
| 261 | |
| 262 @property | |
| 263 def updated_at(self): | |
| 264 """ | |
| 265 :type: datetime.datetime | |
| 266 """ | |
| 267 self._completeIfNotSet(self._updated_at) | |
| 268 return self._updated_at.value | |
| 269 | |
| 270 @property | |
| 271 def url(self): | |
| 272 """ | |
| 273 :type: string | |
| 274 """ | |
| 275 self._completeIfNotSet(self._url) | |
| 276 return self._url.value | |
| 277 | |
| 278 def add_to_public_members(self, public_member): | |
| 279 """ | |
| 280 :calls: `PUT /orgs/:org/public_members/:user <http://developer.github.com/v3/orgs/members>`_ | |
| 281 :param public_member: :class:`github.NamedUser.NamedUser` | |
| 282 :rtype: None | |
| 283 """ | |
| 284 assert isinstance(public_member, github.NamedUser.NamedUser), public_member | |
| 285 headers, data = self._requester.requestJsonAndCheck( | |
| 286 "PUT", | |
| 287 self.url + "/public_members/" + public_member._identity | |
| 288 ) | |
| 289 | |
| 290 def create_fork(self, repo): | |
| 291 """ | |
| 292 :calls: `POST /repos/:owner/:repo/forks <http://developer.github.com/v3/repos/forks>`_ | |
| 293 :param repo: :class:`github.Repository.Repository` | |
| 294 :rtype: :class:`github.Repository.Repository` | |
| 295 """ | |
| 296 assert isinstance(repo, github.Repository.Repository), repo | |
| 297 url_parameters = { | |
| 298 "org": self.login, | |
| 299 } | |
| 300 headers, data = self._requester.requestJsonAndCheck( | |
| 301 "POST", | |
| 302 "/repos/" + repo.owner.login + "/" + repo.name + "/forks", | |
| 303 parameters=url_parameters | |
| 304 ) | |
| 305 return github.Repository.Repository(self._requester, headers, data, completed=True) | |
| 306 | |
| 307 def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, team_id=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet): | |
| 308 """ | |
| 309 :calls: `POST /orgs/:org/repos <http://developer.github.com/v3/repos>`_ | |
| 310 :param name: string | |
| 311 :param description: string | |
| 312 :param homepage: string | |
| 313 :param private: bool | |
| 314 :param has_issues: bool | |
| 315 :param has_wiki: bool | |
| 316 :param has_downloads: bool | |
| 317 :param team_id: :class:`github.Team.Team` | |
| 318 :param auto_init: bool | |
| 319 :param gitignore_template: string | |
| 320 :rtype: :class:`github.Repository.Repository` | |
| 321 """ | |
| 322 assert isinstance(name, (str, unicode)), name | |
| 323 assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description | |
| 324 assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage | |
| 325 assert private is github.GithubObject.NotSet or isinstance(private, bool), private | |
| 326 assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues | |
| 327 assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki | |
| 328 assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads | |
| 329 assert team_id is github.GithubObject.NotSet or isinstance(team_id, github.Team.Team), team_id | |
| 330 assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init | |
| 331 assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template | |
| 332 post_parameters = { | |
| 333 "name": name, | |
| 334 } | |
| 335 if description is not github.GithubObject.NotSet: | |
| 336 post_parameters["description"] = description | |
| 337 if homepage is not github.GithubObject.NotSet: | |
| 338 post_parameters["homepage"] = homepage | |
| 339 if private is not github.GithubObject.NotSet: | |
| 340 post_parameters["private"] = private | |
| 341 if has_issues is not github.GithubObject.NotSet: | |
| 342 post_parameters["has_issues"] = has_issues | |
| 343 if has_wiki is not github.GithubObject.NotSet: | |
| 344 post_parameters["has_wiki"] = has_wiki | |
| 345 if has_downloads is not github.GithubObject.NotSet: | |
| 346 post_parameters["has_downloads"] = has_downloads | |
| 347 if team_id is not github.GithubObject.NotSet: | |
| 348 post_parameters["team_id"] = team_id._identity | |
| 349 if auto_init is not github.GithubObject.NotSet: | |
| 350 post_parameters["auto_init"] = auto_init | |
| 351 if gitignore_template is not github.GithubObject.NotSet: | |
| 352 post_parameters["gitignore_template"] = gitignore_template | |
| 353 headers, data = self._requester.requestJsonAndCheck( | |
| 354 "POST", | |
| 355 self.url + "/repos", | |
| 356 input=post_parameters | |
| 357 ) | |
| 358 return github.Repository.Repository(self._requester, headers, data, completed=True) | |
| 359 | |
| 360 def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet): | |
| 361 """ | |
| 362 :calls: `POST /orgs/:org/teams <http://developer.github.com/v3/orgs/teams>`_ | |
| 363 :param name: string | |
| 364 :param repo_names: list of :class:`github.Repository.Repository` | |
| 365 :param permission: string | |
| 366 :rtype: :class:`github.Team.Team` | |
| 367 """ | |
| 368 assert isinstance(name, (str, unicode)), name | |
| 369 assert repo_names is github.GithubObject.NotSet or all(isinstance(element, github.Repository.Repository) for element in repo_names), repo_names | |
| 370 assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission | |
| 371 post_parameters = { | |
| 372 "name": name, | |
| 373 } | |
| 374 if repo_names is not github.GithubObject.NotSet: | |
| 375 post_parameters["repo_names"] = [element._identity for element in repo_names] | |
| 376 if permission is not github.GithubObject.NotSet: | |
| 377 post_parameters["permission"] = permission | |
| 378 headers, data = self._requester.requestJsonAndCheck( | |
| 379 "POST", | |
| 380 self.url + "/teams", | |
| 381 input=post_parameters | |
| 382 ) | |
| 383 return github.Team.Team(self._requester, headers, data, completed=True) | |
| 384 | |
| 385 def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet): | |
| 386 """ | |
| 387 :calls: `PATCH /orgs/:org <http://developer.github.com/v3/orgs>`_ | |
| 388 :param billing_email: string | |
| 389 :param blog: string | |
| 390 :param company: string | |
| 391 :param email: string | |
| 392 :param location: string | |
| 393 :param name: string | |
| 394 :rtype: None | |
| 395 """ | |
| 396 assert billing_email is github.GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email | |
| 397 assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog | |
| 398 assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company | |
| 399 assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email | |
| 400 assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location | |
| 401 assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name | |
| 402 post_parameters = dict() | |
| 403 if billing_email is not github.GithubObject.NotSet: | |
| 404 post_parameters["billing_email"] = billing_email | |
| 405 if blog is not github.GithubObject.NotSet: | |
| 406 post_parameters["blog"] = blog | |
| 407 if company is not github.GithubObject.NotSet: | |
| 408 post_parameters["company"] = company | |
| 409 if email is not github.GithubObject.NotSet: | |
| 410 post_parameters["email"] = email | |
| 411 if location is not github.GithubObject.NotSet: | |
| 412 post_parameters["location"] = location | |
| 413 if name is not github.GithubObject.NotSet: | |
| 414 post_parameters["name"] = name | |
| 415 headers, data = self._requester.requestJsonAndCheck( | |
| 416 "PATCH", | |
| 417 self.url, | |
| 418 input=post_parameters | |
| 419 ) | |
| 420 self._useAttributes(data) | |
| 421 | |
| 422 def get_events(self): | |
| 423 """ | |
| 424 :calls: `GET /orgs/:org/events <http://developer.github.com/v3/activity/events>`_ | |
| 425 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event` | |
| 426 """ | |
| 427 return github.PaginatedList.PaginatedList( | |
| 428 github.Event.Event, | |
| 429 self._requester, | |
| 430 self.url + "/events", | |
| 431 None | |
| 432 ) | |
| 433 | |
| 434 def get_issues(self, filter=github.GithubObject.NotSet, state=github.GithubObject.NotSet, labels=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet): | |
| 435 """ | |
| 436 :calls: `GET /orgs/:org/issues <http://developer.github.com/v3/issues>`_ | |
| 437 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` | |
| 438 :param filter: string | |
| 439 :param state: string | |
| 440 :param labels: list of :class:`github.Label.Label` | |
| 441 :param sort: string | |
| 442 :param direction: string | |
| 443 :param since: datetime.datetime | |
| 444 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` | |
| 445 """ | |
| 446 assert filter is github.GithubObject.NotSet or isinstance(filter, (str, unicode)), filter | |
| 447 assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state | |
| 448 assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels | |
| 449 assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort | |
| 450 assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction | |
| 451 assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since | |
| 452 url_parameters = dict() | |
| 453 if filter is not github.GithubObject.NotSet: | |
| 454 url_parameters["filter"] = filter | |
| 455 if state is not github.GithubObject.NotSet: | |
| 456 url_parameters["state"] = state | |
| 457 if labels is not github.GithubObject.NotSet: | |
| 458 url_parameters["labels"] = ",".join(label.name for label in labels) | |
| 459 if sort is not github.GithubObject.NotSet: | |
| 460 url_parameters["sort"] = sort | |
| 461 if direction is not github.GithubObject.NotSet: | |
| 462 url_parameters["direction"] = direction | |
| 463 if since is not github.GithubObject.NotSet: | |
| 464 url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ") | |
| 465 return github.PaginatedList.PaginatedList( | |
| 466 github.Issue.Issue, | |
| 467 self._requester, | |
| 468 self.url + "/issues", | |
| 469 url_parameters | |
| 470 ) | |
| 471 | |
| 472 def get_members(self): | |
| 473 """ | |
| 474 :calls: `GET /orgs/:org/members <http://developer.github.com/v3/orgs/members>`_ | |
| 475 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` | |
| 476 """ | |
| 477 return github.PaginatedList.PaginatedList( | |
| 478 github.NamedUser.NamedUser, | |
| 479 self._requester, | |
| 480 self.url + "/members", | |
| 481 None | |
| 482 ) | |
| 483 | |
| 484 def get_public_members(self): | |
| 485 """ | |
| 486 :calls: `GET /orgs/:org/public_members <http://developer.github.com/v3/orgs/members>`_ | |
| 487 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` | |
| 488 """ | |
| 489 return github.PaginatedList.PaginatedList( | |
| 490 github.NamedUser.NamedUser, | |
| 491 self._requester, | |
| 492 self.url + "/public_members", | |
| 493 None | |
| 494 ) | |
| 495 | |
| 496 def get_repo(self, name): | |
| 497 """ | |
| 498 :calls: `GET /repos/:owner/:repo <http://developer.github.com/v3/repos>`_ | |
| 499 :param name: string | |
| 500 :rtype: :class:`github.Repository.Repository` | |
| 501 """ | |
| 502 assert isinstance(name, (str, unicode)), name | |
| 503 headers, data = self._requester.requestJsonAndCheck( | |
| 504 "GET", | |
| 505 "/repos/" + self.login + "/" + name | |
| 506 ) | |
| 507 return github.Repository.Repository(self._requester, headers, data, completed=True) | |
| 508 | |
| 509 def get_repos(self, type=github.GithubObject.NotSet): | |
| 510 """ | |
| 511 :calls: `GET /orgs/:org/repos <http://developer.github.com/v3/repos>`_ | |
| 512 :param type: string | |
| 513 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` | |
| 514 """ | |
| 515 assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type | |
| 516 url_parameters = dict() | |
| 517 if type is not github.GithubObject.NotSet: | |
| 518 url_parameters["type"] = type | |
| 519 return github.PaginatedList.PaginatedList( | |
| 520 github.Repository.Repository, | |
| 521 self._requester, | |
| 522 self.url + "/repos", | |
| 523 url_parameters | |
| 524 ) | |
| 525 | |
| 526 def get_team(self, id): | |
| 527 """ | |
| 528 :calls: `GET /teams/:id <http://developer.github.com/v3/orgs/teams>`_ | |
| 529 :param id: integer | |
| 530 :rtype: :class:`github.Team.Team` | |
| 531 """ | |
| 532 assert isinstance(id, (int, long)), id | |
| 533 headers, data = self._requester.requestJsonAndCheck( | |
| 534 "GET", | |
| 535 "/teams/" + str(id) | |
| 536 ) | |
| 537 return github.Team.Team(self._requester, headers, data, completed=True) | |
| 538 | |
| 539 def get_teams(self): | |
| 540 """ | |
| 541 :calls: `GET /orgs/:org/teams <http://developer.github.com/v3/orgs/teams>`_ | |
| 542 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team` | |
| 543 """ | |
| 544 return github.PaginatedList.PaginatedList( | |
| 545 github.Team.Team, | |
| 546 self._requester, | |
| 547 self.url + "/teams", | |
| 548 None | |
| 549 ) | |
| 550 | |
| 551 def has_in_members(self, member): | |
| 552 """ | |
| 553 :calls: `GET /orgs/:org/members/:user <http://developer.github.com/v3/orgs/members>`_ | |
| 554 :param member: :class:`github.NamedUser.NamedUser` | |
| 555 :rtype: bool | |
| 556 """ | |
| 557 assert isinstance(member, github.NamedUser.NamedUser), member | |
| 558 status, headers, data = self._requester.requestJson( | |
| 559 "GET", | |
| 560 self.url + "/members/" + member._identity | |
| 561 ) | |
| 562 return status == 204 | |
| 563 | |
| 564 def has_in_public_members(self, public_member): | |
| 565 """ | |
| 566 :calls: `GET /orgs/:org/public_members/:user <http://developer.github.com/v3/orgs/members>`_ | |
| 567 :param public_member: :class:`github.NamedUser.NamedUser` | |
| 568 :rtype: bool | |
| 569 """ | |
| 570 assert isinstance(public_member, github.NamedUser.NamedUser), public_member | |
| 571 status, headers, data = self._requester.requestJson( | |
| 572 "GET", | |
| 573 self.url + "/public_members/" + public_member._identity | |
| 574 ) | |
| 575 return status == 204 | |
| 576 | |
| 577 def remove_from_members(self, member): | |
| 578 """ | |
| 579 :calls: `DELETE /orgs/:org/members/:user <http://developer.github.com/v3/orgs/members>`_ | |
| 580 :param member: :class:`github.NamedUser.NamedUser` | |
| 581 :rtype: None | |
| 582 """ | |
| 583 assert isinstance(member, github.NamedUser.NamedUser), member | |
| 584 headers, data = self._requester.requestJsonAndCheck( | |
| 585 "DELETE", | |
| 586 self.url + "/members/" + member._identity | |
| 587 ) | |
| 588 | |
| 589 def remove_from_public_members(self, public_member): | |
| 590 """ | |
| 591 :calls: `DELETE /orgs/:org/public_members/:user <http://developer.github.com/v3/orgs/members>`_ | |
| 592 :param public_member: :class:`github.NamedUser.NamedUser` | |
| 593 :rtype: None | |
| 594 """ | |
| 595 assert isinstance(public_member, github.NamedUser.NamedUser), public_member | |
| 596 headers, data = self._requester.requestJsonAndCheck( | |
| 597 "DELETE", | |
| 598 self.url + "/public_members/" + public_member._identity | |
| 599 ) | |
| 600 | |
| 601 def _initAttributes(self): | |
| 602 self._avatar_url = github.GithubObject.NotSet | |
| 603 self._billing_email = github.GithubObject.NotSet | |
| 604 self._blog = github.GithubObject.NotSet | |
| 605 self._collaborators = github.GithubObject.NotSet | |
| 606 self._company = github.GithubObject.NotSet | |
| 607 self._created_at = github.GithubObject.NotSet | |
| 608 self._disk_usage = github.GithubObject.NotSet | |
| 609 self._email = github.GithubObject.NotSet | |
| 610 self._events_url = github.GithubObject.NotSet | |
| 611 self._followers = github.GithubObject.NotSet | |
| 612 self._following = github.GithubObject.NotSet | |
| 613 self._gravatar_id = github.GithubObject.NotSet | |
| 614 self._html_url = github.GithubObject.NotSet | |
| 615 self._id = github.GithubObject.NotSet | |
| 616 self._location = github.GithubObject.NotSet | |
| 617 self._login = github.GithubObject.NotSet | |
| 618 self._members_url = github.GithubObject.NotSet | |
| 619 self._name = github.GithubObject.NotSet | |
| 620 self._owned_private_repos = github.GithubObject.NotSet | |
| 621 self._plan = github.GithubObject.NotSet | |
| 622 self._private_gists = github.GithubObject.NotSet | |
| 623 self._public_gists = github.GithubObject.NotSet | |
| 624 self._public_members_url = github.GithubObject.NotSet | |
| 625 self._public_repos = github.GithubObject.NotSet | |
| 626 self._repos_url = github.GithubObject.NotSet | |
| 627 self._total_private_repos = github.GithubObject.NotSet | |
| 628 self._type = github.GithubObject.NotSet | |
| 629 self._updated_at = github.GithubObject.NotSet | |
| 630 self._url = github.GithubObject.NotSet | |
| 631 | |
| 632 def _useAttributes(self, attributes): | |
| 633 if "avatar_url" in attributes: # pragma no branch | |
| 634 self._avatar_url = self._makeStringAttribute(attributes["avatar_url"]) | |
| 635 if "billing_email" in attributes: # pragma no branch | |
| 636 self._billing_email = self._makeStringAttribute(attributes["billing_email"]) | |
| 637 if "blog" in attributes: # pragma no branch | |
| 638 self._blog = self._makeStringAttribute(attributes["blog"]) | |
| 639 if "collaborators" in attributes: # pragma no branch | |
| 640 self._collaborators = self._makeIntAttribute(attributes["collaborators"]) | |
| 641 if "company" in attributes: # pragma no branch | |
| 642 self._company = self._makeStringAttribute(attributes["company"]) | |
| 643 if "created_at" in attributes: # pragma no branch | |
| 644 self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) | |
| 645 if "disk_usage" in attributes: # pragma no branch | |
| 646 self._disk_usage = self._makeIntAttribute(attributes["disk_usage"]) | |
| 647 if "email" in attributes: # pragma no branch | |
| 648 self._email = self._makeStringAttribute(attributes["email"]) | |
| 649 if "events_url" in attributes: # pragma no branch | |
| 650 self._events_url = self._makeStringAttribute(attributes["events_url"]) | |
| 651 if "followers" in attributes: # pragma no branch | |
| 652 self._followers = self._makeIntAttribute(attributes["followers"]) | |
| 653 if "following" in attributes: # pragma no branch | |
| 654 self._following = self._makeIntAttribute(attributes["following"]) | |
| 655 if "gravatar_id" in attributes: # pragma no branch | |
| 656 self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"]) | |
| 657 if "html_url" in attributes: # pragma no branch | |
| 658 self._html_url = self._makeStringAttribute(attributes["html_url"]) | |
| 659 if "id" in attributes: # pragma no branch | |
| 660 self._id = self._makeIntAttribute(attributes["id"]) | |
| 661 if "location" in attributes: # pragma no branch | |
| 662 self._location = self._makeStringAttribute(attributes["location"]) | |
| 663 if "login" in attributes: # pragma no branch | |
| 664 self._login = self._makeStringAttribute(attributes["login"]) | |
| 665 if "members_url" in attributes: # pragma no branch | |
| 666 self._members_url = self._makeStringAttribute(attributes["members_url"]) | |
| 667 if "name" in attributes: # pragma no branch | |
| 668 self._name = self._makeStringAttribute(attributes["name"]) | |
| 669 if "owned_private_repos" in attributes: # pragma no branch | |
| 670 self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"]) | |
| 671 if "plan" in attributes: # pragma no branch | |
| 672 self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"]) | |
| 673 if "private_gists" in attributes: # pragma no branch | |
| 674 self._private_gists = self._makeIntAttribute(attributes["private_gists"]) | |
| 675 if "public_gists" in attributes: # pragma no branch | |
| 676 self._public_gists = self._makeIntAttribute(attributes["public_gists"]) | |
| 677 if "public_members_url" in attributes: # pragma no branch | |
| 678 self._public_members_url = self._makeStringAttribute(attributes["public_members_url"]) | |
| 679 if "public_repos" in attributes: # pragma no branch | |
| 680 self._public_repos = self._makeIntAttribute(attributes["public_repos"]) | |
| 681 if "repos_url" in attributes: # pragma no branch | |
| 682 self._repos_url = self._makeStringAttribute(attributes["repos_url"]) | |
| 683 if "total_private_repos" in attributes: # pragma no branch | |
| 684 self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"]) | |
| 685 if "type" in attributes: # pragma no branch | |
| 686 self._type = self._makeStringAttribute(attributes["type"]) | |
| 687 if "updated_at" in attributes: # pragma no branch | |
| 688 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) | |
| 689 if "url" in attributes: # pragma no branch | |
| 690 self._url = self._makeStringAttribute(attributes["url"]) |
