Update
This commit is contained in:
21
plug-ins/ARTv2/Core/Scripts/ThirdParty/LICENSE
vendored
Normal file
21
plug-ins/ARTv2/Core/Scripts/ThirdParty/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Marcus Ottosson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
192
plug-ins/ARTv2/Core/Scripts/ThirdParty/PyGithub.tps
vendored
Normal file
192
plug-ins/ARTv2/Core/Scripts/ThirdParty/PyGithub.tps
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TpsData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>PyGithub</Name>
|
||||
<Location>//depot/UE4-UserContent/</Location>
|
||||
<Date>2016-06-24T12:36:33.3558766-04:00</Date>
|
||||
<Function>A python library that allows interaction with github. </Function>
|
||||
<Justification>For the animation and rigging toolkit v2, I have created an auto-updater that utilizes github (eventually Epic's github) to check latest version and auto-download and extract the latest zip of tools. see Q:\Jeremy.Ernst\autoUpdater.wmv for example</Justification>
|
||||
<Platforms>
|
||||
<Platform>PC</Platform>
|
||||
<Platform>Mac</Platform>
|
||||
<Platform>Linux</Platform>
|
||||
</Platforms>
|
||||
<Products>
|
||||
<Product>UDK4</Product>
|
||||
<Product>UE4</Product>
|
||||
</Products>
|
||||
<TpsType>lib</TpsType>
|
||||
<Eula>https://github.com/PyGithub/PyGithub/blob/master/setup.py</Eula>
|
||||
<RedistributeTo>
|
||||
<EndUserGroup>Git</EndUserGroup>
|
||||
<EndUserGroup>P4</EndUserGroup>
|
||||
</RedistributeTo>
|
||||
<Redistribute>false</Redistribute>
|
||||
<IsSourceAvailable>false</IsSourceAvailable>
|
||||
<NoticeType>Full EULA Text</NoticeType>
|
||||
<Notification> GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.</Notification>
|
||||
<LicenseFolder />
|
||||
</TpsData>
|
||||
2155
plug-ins/ARTv2/Core/Scripts/ThirdParty/Qt.py
vendored
Normal file
2155
plug-ins/ARTv2/Core/Scripts/ThirdParty/Qt.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
plug-ins/ARTv2/Core/Scripts/ThirdParty/Qt.py.tps
vendored
Normal file
28
plug-ins/ARTv2/Core/Scripts/ThirdParty/Qt.py.tps
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TpsData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>Qt.py</Name>
|
||||
<Location>//depot/ArtTools/TechAnimTools/ThirdParty/</Location>
|
||||
<Date>2016-08-31T11:30:20.7817791-04:00</Date>
|
||||
<Function>Is a module that dynamically converts code to switch between PySide and PySide2, which are the python bindings for the Qt toolkit (allows you access to Maya's UI). </Function>
|
||||
<Justification>Allows the Animation and Rigging Toolkit to support both Maya 2017 and also older versions. Without this, you could only support Maya version pre or post 2017, not both without maintaining 2 versions of the ART tool</Justification>
|
||||
<Platforms>
|
||||
<Platform>PC</Platform>
|
||||
<Platform>Mac</Platform>
|
||||
</Platforms>
|
||||
<Products>
|
||||
<Product>UDK4</Product>
|
||||
<Product>UE4</Product>
|
||||
</Products>
|
||||
<TpsType>lib</TpsType>
|
||||
<Eula>https://github.com/mottosso/Qt.py/blob/master/LICENSE</Eula>
|
||||
<RedistributeTo>
|
||||
<EndUserGroup>Licensees</EndUserGroup>
|
||||
<EndUserGroup>Git</EndUserGroup>
|
||||
<EndUserGroup>P4</EndUserGroup>
|
||||
</RedistributeTo>
|
||||
<Redistribute>false</Redistribute>
|
||||
<IsSourceAvailable>false</IsSourceAvailable>
|
||||
<NoticeType>None</NoticeType>
|
||||
<Notification />
|
||||
<LicenseFolder>None</LicenseFolder>
|
||||
</TpsData>
|
||||
0
plug-ins/ARTv2/Core/Scripts/ThirdParty/__init__.py
vendored
Normal file
0
plug-ins/ARTv2/Core/Scripts/ThirdParty/__init__.py
vendored
Normal file
1158
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/AuthenticatedUser.py
vendored
Normal file
1158
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/AuthenticatedUser.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
181
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Authorization.py
vendored
Normal file
181
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Authorization.py
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.AuthorizationApplication
|
||||
|
||||
|
||||
class Authorization(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Authorizations as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def app(self):
|
||||
"""
|
||||
:type: :class:`github.AuthorizationApplication.AuthorizationApplication`
|
||||
"""
|
||||
self._completeIfNotSet(self._app)
|
||||
return self._app.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def note(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._note)
|
||||
return self._note.value
|
||||
|
||||
@property
|
||||
def note_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._note_url)
|
||||
return self._note_url.value
|
||||
|
||||
@property
|
||||
def scopes(self):
|
||||
"""
|
||||
:type: list of string
|
||||
"""
|
||||
self._completeIfNotSet(self._scopes)
|
||||
return self._scopes.value
|
||||
|
||||
@property
|
||||
def token(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._token)
|
||||
return self._token.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /authorizations/:id <http://developer.github.com/v3/oauth>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, scopes=github.GithubObject.NotSet, add_scopes=github.GithubObject.NotSet, remove_scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /authorizations/:id <http://developer.github.com/v3/oauth>`_
|
||||
:param scopes: list of string
|
||||
:param add_scopes: list of string
|
||||
:param remove_scopes: list of string
|
||||
:param note: string
|
||||
:param note_url: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
|
||||
assert add_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes
|
||||
assert remove_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes
|
||||
assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note
|
||||
assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url
|
||||
post_parameters = dict()
|
||||
if scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["scopes"] = scopes
|
||||
if add_scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["add_scopes"] = add_scopes
|
||||
if remove_scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["remove_scopes"] = remove_scopes
|
||||
if note is not github.GithubObject.NotSet:
|
||||
post_parameters["note"] = note
|
||||
if note_url is not github.GithubObject.NotSet:
|
||||
post_parameters["note_url"] = note_url
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._app = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._note = github.GithubObject.NotSet
|
||||
self._note_url = github.GithubObject.NotSet
|
||||
self._scopes = github.GithubObject.NotSet
|
||||
self._token = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "app" in attributes: # pragma no branch
|
||||
self._app = self._makeClassAttribute(github.AuthorizationApplication.AuthorizationApplication, attributes["app"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "note" in attributes: # pragma no branch
|
||||
self._note = self._makeStringAttribute(attributes["note"])
|
||||
if "note_url" in attributes: # pragma no branch
|
||||
self._note_url = self._makeStringAttribute(attributes["note_url"])
|
||||
if "scopes" in attributes: # pragma no branch
|
||||
self._scopes = self._makeListOfStringsAttribute(attributes["scopes"])
|
||||
if "token" in attributes: # pragma no branch
|
||||
self._token = self._makeStringAttribute(attributes["token"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
59
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/AuthorizationApplication.py
vendored
Normal file
59
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/AuthorizationApplication.py
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class AuthorizationApplication(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents AuthorizationApplications as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
60
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Branch.py
vendored
Normal file
60
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Branch.py
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Commit
|
||||
|
||||
|
||||
class Branch(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Branchs. The reference can be found here http://developer.github.com/v3/repos/#list-branches
|
||||
"""
|
||||
|
||||
@property
|
||||
def commit(self):
|
||||
"""
|
||||
:type: :class:`github.Commit.Commit`
|
||||
"""
|
||||
return self._commit.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._name.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._commit = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "commit" in attributes: # pragma no branch
|
||||
self._commit = self._makeClassAttribute(github.Commit.Commit, attributes["commit"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
242
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Commit.py
vendored
Normal file
242
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Commit.py
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.GitCommit
|
||||
import github.NamedUser
|
||||
import github.CommitStatus
|
||||
import github.File
|
||||
import github.CommitStats
|
||||
import github.CommitComment
|
||||
|
||||
|
||||
class Commit(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Commits. The reference can be found here http://developer.github.com/v3/git/commits/
|
||||
"""
|
||||
|
||||
@property
|
||||
def author(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._author)
|
||||
return self._author.value
|
||||
|
||||
@property
|
||||
def comments_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._comments_url)
|
||||
return self._comments_url.value
|
||||
|
||||
@property
|
||||
def commit(self):
|
||||
"""
|
||||
:type: :class:`github.GitCommit.GitCommit`
|
||||
"""
|
||||
self._completeIfNotSet(self._commit)
|
||||
return self._commit.value
|
||||
|
||||
@property
|
||||
def committer(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._committer)
|
||||
return self._committer.value
|
||||
|
||||
@property
|
||||
def files(self):
|
||||
"""
|
||||
:type: list of :class:`github.File.File`
|
||||
"""
|
||||
self._completeIfNotSet(self._files)
|
||||
return self._files.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def parents(self):
|
||||
"""
|
||||
:type: list of :class:`github.Commit.Commit`
|
||||
"""
|
||||
self._completeIfNotSet(self._parents)
|
||||
return self._parents.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._sha)
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def stats(self):
|
||||
"""
|
||||
:type: :class:`github.CommitStats.CommitStats`
|
||||
"""
|
||||
self._completeIfNotSet(self._stats)
|
||||
return self._stats.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/commits/:sha/comments <http://developer.github.com/v3/repos/comments>`_
|
||||
:param body: string
|
||||
:param line: integer
|
||||
:param path: string
|
||||
:param position: integer
|
||||
:rtype: :class:`github.CommitComment.CommitComment`
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
assert line is github.GithubObject.NotSet or isinstance(line, (int, long)), line
|
||||
assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path
|
||||
assert position is github.GithubObject.NotSet or isinstance(position, (int, long)), position
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
if line is not github.GithubObject.NotSet:
|
||||
post_parameters["line"] = line
|
||||
if path is not github.GithubObject.NotSet:
|
||||
post_parameters["path"] = path
|
||||
if position is not github.GithubObject.NotSet:
|
||||
post_parameters["position"] = position
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/comments",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.CommitComment.CommitComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet, context=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/statuses/:sha <http://developer.github.com/v3/repos/statuses>`_
|
||||
:param state: string
|
||||
:param target_url: string
|
||||
:param description: string
|
||||
:param context: string
|
||||
:rtype: :class:`github.CommitStatus.CommitStatus`
|
||||
"""
|
||||
assert isinstance(state, (str, unicode)), state
|
||||
assert target_url is github.GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert context is github.GithubObject.NotSet or isinstance(context, (str, unicode)), context
|
||||
post_parameters = {
|
||||
"state": state,
|
||||
}
|
||||
if target_url is not github.GithubObject.NotSet:
|
||||
post_parameters["target_url"] = target_url
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if context is not github.GithubObject.NotSet:
|
||||
post_parameters["context"] = context
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,
|
||||
input=post_parameters
|
||||
)
|
||||
return github.CommitStatus.CommitStatus(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/commits/:sha/comments <http://developer.github.com/v3/repos/comments>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitComment.CommitComment`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.CommitComment.CommitComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_statuses(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/statuses/:ref <http://developer.github.com/v3/repos/statuses>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitStatus.CommitStatus`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.CommitStatus.CommitStatus,
|
||||
self._requester,
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,
|
||||
None
|
||||
)
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.sha
|
||||
|
||||
def _initAttributes(self):
|
||||
self._author = github.GithubObject.NotSet
|
||||
self._comments_url = github.GithubObject.NotSet
|
||||
self._commit = github.GithubObject.NotSet
|
||||
self._committer = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._parents = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._stats = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["author"])
|
||||
if "comments_url" in attributes: # pragma no branch
|
||||
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
||||
if "commit" in attributes: # pragma no branch
|
||||
self._commit = self._makeClassAttribute(github.GitCommit.GitCommit, attributes["commit"])
|
||||
if "committer" in attributes: # pragma no branch
|
||||
self._committer = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["committer"])
|
||||
if "files" in attributes: # pragma no branch
|
||||
self._files = self._makeListOfClassesAttribute(github.File.File, attributes["files"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "parents" in attributes: # pragma no branch
|
||||
self._parents = self._makeListOfClassesAttribute(Commit, attributes["parents"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "stats" in attributes: # pragma no branch
|
||||
self._stats = self._makeClassAttribute(github.CommitStats.CommitStats, attributes["stats"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
187
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/CommitComment.py
vendored
Normal file
187
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/CommitComment.py
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class CommitComment(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents CommitComments as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def commit_id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._commit_id)
|
||||
return self._commit_id.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def line(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._line)
|
||||
return self._line.value
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._path)
|
||||
return self._path.value
|
||||
|
||||
@property
|
||||
def position(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._position)
|
||||
return self._position.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/comments/:id <http://developer.github.com/v3/repos/comments>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, body):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/comments/:id <http://developer.github.com/v3/repos/comments>`_
|
||||
:param body: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._line = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._position = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "commit_id" in attributes: # pragma no branch
|
||||
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "line" in attributes: # pragma no branch
|
||||
self._line = self._makeIntAttribute(attributes["line"])
|
||||
if "path" in attributes: # pragma no branch
|
||||
self._path = self._makeStringAttribute(attributes["path"])
|
||||
if "position" in attributes: # pragma no branch
|
||||
self._position = self._makeIntAttribute(attributes["position"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/CommitStats.py
vendored
Normal file
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/CommitStats.py
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class CommitStats(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents CommitStatss as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def additions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._additions.value
|
||||
|
||||
@property
|
||||
def deletions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._deletions.value
|
||||
|
||||
@property
|
||||
def total(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._total.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._total = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
self._additions = self._makeIntAttribute(attributes["additions"])
|
||||
if "deletions" in attributes: # pragma no branch
|
||||
self._deletions = self._makeIntAttribute(attributes["deletions"])
|
||||
if "total" in attributes: # pragma no branch
|
||||
self._total = self._makeIntAttribute(attributes["total"])
|
||||
119
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/CommitStatus.py
vendored
Normal file
119
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/CommitStatus.py
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class CommitStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents CommitStatuss as returned for example by https://developer.github.com/v3/repos/statuses/
|
||||
"""
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def creator(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return self._creator.value
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._description.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._state.value
|
||||
|
||||
@property
|
||||
def target_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._target_url.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._creator = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._target_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "creator" in attributes: # pragma no branch
|
||||
self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
|
||||
if "description" in attributes: # pragma no branch
|
||||
self._description = self._makeStringAttribute(attributes["description"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "state" in attributes: # pragma no branch
|
||||
self._state = self._makeStringAttribute(attributes["state"])
|
||||
if "target_url" in attributes: # pragma no branch
|
||||
self._target_url = self._makeStringAttribute(attributes["target_url"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
183
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Comparison.py
vendored
Normal file
183
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Comparison.py
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Commit
|
||||
import github.File
|
||||
|
||||
|
||||
class Comparison(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Comparisons as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def ahead_by(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._ahead_by)
|
||||
return self._ahead_by.value
|
||||
|
||||
@property
|
||||
def base_commit(self):
|
||||
"""
|
||||
:type: :class:`github.Commit.Commit`
|
||||
"""
|
||||
self._completeIfNotSet(self._base_commit)
|
||||
return self._base_commit.value
|
||||
|
||||
@property
|
||||
def behind_by(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._behind_by)
|
||||
return self._behind_by.value
|
||||
|
||||
@property
|
||||
def commits(self):
|
||||
"""
|
||||
:type: list of :class:`github.Commit.Commit`
|
||||
"""
|
||||
self._completeIfNotSet(self._commits)
|
||||
return self._commits.value
|
||||
|
||||
@property
|
||||
def diff_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._diff_url)
|
||||
return self._diff_url.value
|
||||
|
||||
@property
|
||||
def files(self):
|
||||
"""
|
||||
:type: list of :class:`github.File.File`
|
||||
"""
|
||||
self._completeIfNotSet(self._files)
|
||||
return self._files.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def merge_base_commit(self):
|
||||
"""
|
||||
:type: :class:`github.Commit.Commit`
|
||||
"""
|
||||
self._completeIfNotSet(self._merge_base_commit)
|
||||
return self._merge_base_commit.value
|
||||
|
||||
@property
|
||||
def patch_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._patch_url)
|
||||
return self._patch_url.value
|
||||
|
||||
@property
|
||||
def permalink_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._permalink_url)
|
||||
return self._permalink_url.value
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._status)
|
||||
return self._status.value
|
||||
|
||||
@property
|
||||
def total_commits(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._total_commits)
|
||||
return self._total_commits.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._ahead_by = github.GithubObject.NotSet
|
||||
self._base_commit = github.GithubObject.NotSet
|
||||
self._behind_by = github.GithubObject.NotSet
|
||||
self._commits = github.GithubObject.NotSet
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._merge_base_commit = github.GithubObject.NotSet
|
||||
self._patch_url = github.GithubObject.NotSet
|
||||
self._permalink_url = github.GithubObject.NotSet
|
||||
self._status = github.GithubObject.NotSet
|
||||
self._total_commits = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "ahead_by" in attributes: # pragma no branch
|
||||
self._ahead_by = self._makeIntAttribute(attributes["ahead_by"])
|
||||
if "base_commit" in attributes: # pragma no branch
|
||||
self._base_commit = self._makeClassAttribute(github.Commit.Commit, attributes["base_commit"])
|
||||
if "behind_by" in attributes: # pragma no branch
|
||||
self._behind_by = self._makeIntAttribute(attributes["behind_by"])
|
||||
if "commits" in attributes: # pragma no branch
|
||||
self._commits = self._makeListOfClassesAttribute(github.Commit.Commit, attributes["commits"])
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
||||
if "files" in attributes: # pragma no branch
|
||||
self._files = self._makeListOfClassesAttribute(github.File.File, attributes["files"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "merge_base_commit" in attributes: # pragma no branch
|
||||
self._merge_base_commit = self._makeClassAttribute(github.Commit.Commit, attributes["merge_base_commit"])
|
||||
if "patch_url" in attributes: # pragma no branch
|
||||
self._patch_url = self._makeStringAttribute(attributes["patch_url"])
|
||||
if "permalink_url" in attributes: # pragma no branch
|
||||
self._permalink_url = self._makeStringAttribute(attributes["permalink_url"])
|
||||
if "status" in attributes: # pragma no branch
|
||||
self._status = self._makeStringAttribute(attributes["status"])
|
||||
if "total_commits" in attributes: # pragma no branch
|
||||
self._total_commits = self._makeIntAttribute(attributes["total_commits"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
44
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Consts.py
vendored
Normal file
44
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Consts.py
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
# #193: Line endings should be linux style
|
||||
|
||||
# TODO: As of Thu Aug 21 22:40:13 (BJT) Chinese Standard Time 2013
|
||||
# lots of consts in this project are explict
|
||||
# should realy round them up and reference them by consts
|
||||
# EDIT: well, maybe :-)
|
||||
|
||||
# ##############################################################################
|
||||
# Request Header #
|
||||
# (Case sensitive) #
|
||||
# ##############################################################################
|
||||
REQ_IF_NONE_MATCH = "If-None-Match"
|
||||
REQ_IF_MODIFIED_SINCE = "If-Modified-Since"
|
||||
|
||||
# ##############################################################################
|
||||
# Response Header #
|
||||
# (Lower Case) #
|
||||
# ##############################################################################
|
||||
RES_ETAG = "etag"
|
||||
RES_LAST_MODIFED = "last-modified"
|
||||
176
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/ContentFile.py
vendored
Normal file
176
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/ContentFile.py
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import base64
|
||||
import sys
|
||||
|
||||
import github.GithubObject
|
||||
import github.Repository
|
||||
|
||||
|
||||
atLeastPython3 = sys.hexversion >= 0x03000000
|
||||
|
||||
|
||||
class ContentFile(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents ContentFiles as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._content)
|
||||
return self._content.value
|
||||
|
||||
@property
|
||||
def decoded_content(self):
|
||||
assert self.encoding == "base64", "unsupported encoding: %s" % self.encoding
|
||||
if atLeastPython3:
|
||||
content = bytearray(self.content, "utf-8") # pragma no cover (covered by tests with Python 3.2)
|
||||
else:
|
||||
content = self.content
|
||||
return base64.b64decode(content)
|
||||
|
||||
@property
|
||||
def encoding(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._encoding)
|
||||
return self._encoding.value
|
||||
|
||||
@property
|
||||
def git_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._git_url)
|
||||
return self._git_url.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._path)
|
||||
return self._path.value
|
||||
|
||||
@property
|
||||
def repository(self):
|
||||
"""
|
||||
:type: :class:`github.Repository.Repository`
|
||||
"""
|
||||
if self._repository is github.GithubObject.NotSet:
|
||||
# The repository was not set automatically, so it must be looked up by url.
|
||||
repo_url = "/".join(self.url.split("/")[:6]) # pragma no cover (Should be covered)
|
||||
self._repository = github.GithubObject._ValuedAttribute(github.Repository.Repository(self._requester, self._headers, {'url': repo_url}, completed=False)) # pragma no cover (Should be covered)
|
||||
return self._repository.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._sha)
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._size)
|
||||
return self._size.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._type)
|
||||
return self._type.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._content = github.GithubObject.NotSet
|
||||
self._encoding = github.GithubObject.NotSet
|
||||
self._git_url = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._repository = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "content" in attributes: # pragma no branch
|
||||
self._content = self._makeStringAttribute(attributes["content"])
|
||||
if "encoding" in attributes: # pragma no branch
|
||||
self._encoding = self._makeStringAttribute(attributes["encoding"])
|
||||
if "git_url" in attributes: # pragma no branch
|
||||
self._git_url = self._makeStringAttribute(attributes["git_url"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "path" in attributes: # pragma no branch
|
||||
self._path = self._makeStringAttribute(attributes["path"])
|
||||
if "repository" in attributes: # pragma no branch
|
||||
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "size" in attributes: # pragma no branch
|
||||
self._size = self._makeIntAttribute(attributes["size"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
267
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Download.py
vendored
Normal file
267
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Download.py
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Download(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Downloads as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def accesskeyid(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._accesskeyid)
|
||||
return self._accesskeyid.value
|
||||
|
||||
@property
|
||||
def acl(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._acl)
|
||||
return self._acl.value
|
||||
|
||||
@property
|
||||
def bucket(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._bucket)
|
||||
return self._bucket.value
|
||||
|
||||
@property
|
||||
def content_type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._content_type)
|
||||
return self._content_type.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._description)
|
||||
return self._description.value
|
||||
|
||||
@property
|
||||
def download_count(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._download_count)
|
||||
return self._download_count.value
|
||||
|
||||
@property
|
||||
def expirationdate(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._expirationdate)
|
||||
return self._expirationdate.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def mime_type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._mime_type)
|
||||
return self._mime_type.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._path)
|
||||
return self._path.value
|
||||
|
||||
@property
|
||||
def policy(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._policy)
|
||||
return self._policy.value
|
||||
|
||||
@property
|
||||
def prefix(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._prefix)
|
||||
return self._prefix.value
|
||||
|
||||
@property
|
||||
def redirect(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._redirect)
|
||||
return self._redirect.value
|
||||
|
||||
@property
|
||||
def s3_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._s3_url)
|
||||
return self._s3_url.value
|
||||
|
||||
@property
|
||||
def signature(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._signature)
|
||||
return self._signature.value
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._size)
|
||||
return self._size.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/downloads/:id <http://developer.github.com/v3/repos/downloads>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._accesskeyid = github.GithubObject.NotSet
|
||||
self._acl = github.GithubObject.NotSet
|
||||
self._bucket = github.GithubObject.NotSet
|
||||
self._content_type = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._download_count = github.GithubObject.NotSet
|
||||
self._expirationdate = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._mime_type = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._policy = github.GithubObject.NotSet
|
||||
self._prefix = github.GithubObject.NotSet
|
||||
self._redirect = github.GithubObject.NotSet
|
||||
self._s3_url = github.GithubObject.NotSet
|
||||
self._signature = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "accesskeyid" in attributes: # pragma no branch
|
||||
self._accesskeyid = self._makeStringAttribute(attributes["accesskeyid"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "acl" in attributes: # pragma no branch
|
||||
self._acl = self._makeStringAttribute(attributes["acl"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "bucket" in attributes: # pragma no branch
|
||||
self._bucket = self._makeStringAttribute(attributes["bucket"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "content_type" in attributes: # pragma no branch
|
||||
self._content_type = self._makeStringAttribute(attributes["content_type"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "description" in attributes: # pragma no branch
|
||||
self._description = self._makeStringAttribute(attributes["description"])
|
||||
if "download_count" in attributes: # pragma no branch
|
||||
self._download_count = self._makeIntAttribute(attributes["download_count"])
|
||||
if "expirationdate" in attributes: # pragma no branch
|
||||
self._expirationdate = self._makeDatetimeAttribute(attributes["expirationdate"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "mime_type" in attributes: # pragma no branch
|
||||
self._mime_type = self._makeStringAttribute(attributes["mime_type"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "path" in attributes: # pragma no branch
|
||||
self._path = self._makeStringAttribute(attributes["path"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "policy" in attributes: # pragma no branch
|
||||
self._policy = self._makeStringAttribute(attributes["policy"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "prefix" in attributes: # pragma no branch
|
||||
self._prefix = self._makeStringAttribute(attributes["prefix"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "redirect" in attributes: # pragma no branch
|
||||
self._redirect = self._makeBoolAttribute(attributes["redirect"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "s3_url" in attributes: # pragma no branch
|
||||
self._s3_url = self._makeStringAttribute(attributes["s3_url"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "signature" in attributes: # pragma no branch
|
||||
self._signature = self._makeStringAttribute(attributes["signature"]) # pragma no cover (was covered only by create_download, which has been removed)
|
||||
if "size" in attributes: # pragma no branch
|
||||
self._size = self._makeIntAttribute(attributes["size"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
122
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Event.py
vendored
Normal file
122
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Event.py
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Organization
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class Event(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Events. The reference can be found here http://developer.github.com/v3/activity/events/
|
||||
"""
|
||||
|
||||
@property
|
||||
def actor(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return self._actor.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def org(self):
|
||||
"""
|
||||
:type: :class:`github.Organization.Organization`
|
||||
"""
|
||||
return self._org.value
|
||||
|
||||
@property
|
||||
def payload(self):
|
||||
"""
|
||||
:type: dict
|
||||
"""
|
||||
return self._payload.value
|
||||
|
||||
@property
|
||||
def public(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
return self._public.value
|
||||
|
||||
@property
|
||||
def repo(self):
|
||||
"""
|
||||
:type: :class:`github.Repository.Repository`
|
||||
"""
|
||||
return self._repo.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._type.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._actor = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._org = github.GithubObject.NotSet
|
||||
self._payload = github.GithubObject.NotSet
|
||||
self._public = github.GithubObject.NotSet
|
||||
self._repo = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "actor" in attributes: # pragma no branch
|
||||
self._actor = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeStringAttribute(attributes["id"])
|
||||
if "org" in attributes: # pragma no branch
|
||||
self._org = self._makeClassAttribute(github.Organization.Organization, attributes["org"])
|
||||
if "payload" in attributes: # pragma no branch
|
||||
self._payload = self._makeDictAttribute(attributes["payload"])
|
||||
if "public" in attributes: # pragma no branch
|
||||
self._public = self._makeBoolAttribute(attributes["public"])
|
||||
if "repo" in attributes: # pragma no branch
|
||||
self._repo = self._makeClassAttribute(github.Repository.Repository, attributes["repo"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
137
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/File.py
vendored
Normal file
137
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/File.py
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class File(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Files as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def additions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._additions.value
|
||||
|
||||
@property
|
||||
def blob_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._blob_url.value
|
||||
|
||||
@property
|
||||
def changes(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._changes.value
|
||||
|
||||
@property
|
||||
def contents_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._contents_url.value
|
||||
|
||||
@property
|
||||
def deletions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._deletions.value
|
||||
|
||||
@property
|
||||
def filename(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._filename.value
|
||||
|
||||
@property
|
||||
def patch(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._patch.value
|
||||
|
||||
@property
|
||||
def raw_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._raw_url.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._status.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._blob_url = github.GithubObject.NotSet
|
||||
self._changes = github.GithubObject.NotSet
|
||||
self._contents_url = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._filename = github.GithubObject.NotSet
|
||||
self._patch = github.GithubObject.NotSet
|
||||
self._raw_url = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._status = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
self._additions = self._makeIntAttribute(attributes["additions"])
|
||||
if "blob_url" in attributes: # pragma no branch
|
||||
self._blob_url = self._makeStringAttribute(attributes["blob_url"])
|
||||
if "changes" in attributes: # pragma no branch
|
||||
self._changes = self._makeIntAttribute(attributes["changes"])
|
||||
if "contents_url" in attributes: # pragma no branch
|
||||
self._contents_url = self._makeStringAttribute(attributes["contents_url"])
|
||||
if "deletions" in attributes: # pragma no branch
|
||||
self._deletions = self._makeIntAttribute(attributes["deletions"])
|
||||
if "filename" in attributes: # pragma no branch
|
||||
self._filename = self._makeStringAttribute(attributes["filename"])
|
||||
if "patch" in attributes: # pragma no branch
|
||||
self._patch = self._makeStringAttribute(attributes["patch"])
|
||||
if "raw_url" in attributes: # pragma no branch
|
||||
self._raw_url = self._makeStringAttribute(attributes["raw_url"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "status" in attributes: # pragma no branch
|
||||
self._status = self._makeStringAttribute(attributes["status"])
|
||||
368
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Gist.py
vendored
Normal file
368
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Gist.py
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.GistComment
|
||||
import github.NamedUser
|
||||
import github.GistFile
|
||||
import github.GistHistoryState
|
||||
|
||||
|
||||
class Gist(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Gists as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def comments(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._comments)
|
||||
return self._comments.value
|
||||
|
||||
@property
|
||||
def comments_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._comments_url)
|
||||
return self._comments_url.value
|
||||
|
||||
@property
|
||||
def commits_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._commits_url)
|
||||
return self._commits_url.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._description)
|
||||
return self._description.value
|
||||
|
||||
@property
|
||||
def files(self):
|
||||
"""
|
||||
:type: dict of string to :class:`github.GistFile.GistFile`
|
||||
"""
|
||||
self._completeIfNotSet(self._files)
|
||||
return self._files.value
|
||||
|
||||
@property
|
||||
def fork_of(self):
|
||||
"""
|
||||
:type: :class:`github.Gist.Gist`
|
||||
"""
|
||||
self._completeIfNotSet(self._fork_of)
|
||||
return self._fork_of.value
|
||||
|
||||
@property
|
||||
def forks(self):
|
||||
"""
|
||||
:type: list of :class:`github.Gist.Gist`
|
||||
"""
|
||||
self._completeIfNotSet(self._forks)
|
||||
return self._forks.value
|
||||
|
||||
@property
|
||||
def forks_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._forks_url)
|
||||
return self._forks_url.value
|
||||
|
||||
@property
|
||||
def git_pull_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._git_pull_url)
|
||||
return self._git_pull_url.value
|
||||
|
||||
@property
|
||||
def git_push_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._git_push_url)
|
||||
return self._git_push_url.value
|
||||
|
||||
@property
|
||||
def history(self):
|
||||
"""
|
||||
:type: list of :class:`github.GistHistoryState.GistHistoryState`
|
||||
"""
|
||||
self._completeIfNotSet(self._history)
|
||||
return self._history.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def owner(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._owner)
|
||||
return self._owner.value
|
||||
|
||||
@property
|
||||
def public(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._public)
|
||||
return self._public.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def create_comment(self, body):
|
||||
"""
|
||||
:calls: `POST /gists/:gist_id/comments <http://developer.github.com/v3/gists/comments>`_
|
||||
:param body: string
|
||||
:rtype: :class:`github.GistComment.GistComment`
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/comments",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.GistComment.GistComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_fork(self):
|
||||
"""
|
||||
:calls: `POST /gists/:id/forks <http://developer.github.com/v3/gists>`_
|
||||
:rtype: :class:`github.Gist.Gist`
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/forks"
|
||||
)
|
||||
return Gist(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /gists/:id <http://developer.github.com/v3/gists>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /gists/:id <http://developer.github.com/v3/gists>`_
|
||||
:param description: string
|
||||
:param files: dict of string to :class:`github.InputFileContent.InputFileContent`
|
||||
:rtype: None
|
||||
"""
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert files is github.GithubObject.NotSet or all(element is None or isinstance(element, github.InputFileContent) for element in files.itervalues()), files
|
||||
post_parameters = dict()
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if files is not github.GithubObject.NotSet:
|
||||
post_parameters["files"] = dict((key, None if value is None else value._identity) for key, value in files.iteritems())
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_comment(self, id):
|
||||
"""
|
||||
:calls: `GET /gists/:gist_id/comments/:id <http://developer.github.com/v3/gists/comments>`_
|
||||
:param id: integer
|
||||
:rtype: :class:`github.GistComment.GistComment`
|
||||
"""
|
||||
assert isinstance(id, (int, long)), id
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.url + "/comments/" + str(id)
|
||||
)
|
||||
return github.GistComment.GistComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
:calls: `GET /gists/:gist_id/comments <http://developer.github.com/v3/gists/comments>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GistComment.GistComment`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.GistComment.GistComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def is_starred(self):
|
||||
"""
|
||||
:calls: `GET /gists/:id/star <http://developer.github.com/v3/gists>`_
|
||||
:rtype: bool
|
||||
"""
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/star"
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def reset_starred(self):
|
||||
"""
|
||||
:calls: `DELETE /gists/:id/star <http://developer.github.com/v3/gists>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/star"
|
||||
)
|
||||
|
||||
def set_starred(self):
|
||||
"""
|
||||
:calls: `PUT /gists/:id/star <http://developer.github.com/v3/gists>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PUT",
|
||||
self.url + "/star"
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._comments_url = github.GithubObject.NotSet
|
||||
self._commits_url = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._fork_of = github.GithubObject.NotSet
|
||||
self._forks = github.GithubObject.NotSet
|
||||
self._forks_url = github.GithubObject.NotSet
|
||||
self._git_pull_url = github.GithubObject.NotSet
|
||||
self._git_push_url = github.GithubObject.NotSet
|
||||
self._history = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._owner = github.GithubObject.NotSet
|
||||
self._public = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "comments" in attributes: # pragma no branch
|
||||
self._comments = self._makeIntAttribute(attributes["comments"])
|
||||
if "comments_url" in attributes: # pragma no branch
|
||||
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
||||
if "commits_url" in attributes: # pragma no branch
|
||||
self._commits_url = self._makeStringAttribute(attributes["commits_url"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "description" in attributes: # pragma no branch
|
||||
self._description = self._makeStringAttribute(attributes["description"])
|
||||
if "files" in attributes: # pragma no branch
|
||||
self._files = self._makeDictOfStringsToClassesAttribute(github.GistFile.GistFile, attributes["files"])
|
||||
if "fork_of" in attributes: # pragma no branch
|
||||
self._fork_of = self._makeClassAttribute(Gist, attributes["fork_of"])
|
||||
if "forks" in attributes: # pragma no branch
|
||||
self._forks = self._makeListOfClassesAttribute(Gist, attributes["forks"])
|
||||
if "forks_url" in attributes: # pragma no branch
|
||||
self._forks_url = self._makeStringAttribute(attributes["forks_url"])
|
||||
if "git_pull_url" in attributes: # pragma no branch
|
||||
self._git_pull_url = self._makeStringAttribute(attributes["git_pull_url"])
|
||||
if "git_push_url" in attributes: # pragma no branch
|
||||
self._git_push_url = self._makeStringAttribute(attributes["git_push_url"])
|
||||
if "history" in attributes: # pragma no branch
|
||||
self._history = self._makeListOfClassesAttribute(github.GistHistoryState.GistHistoryState, attributes["history"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeStringAttribute(attributes["id"])
|
||||
if "owner" in attributes: # pragma no branch
|
||||
self._owner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
|
||||
if "public" in attributes: # pragma no branch
|
||||
self._public = self._makeBoolAttribute(attributes["public"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
132
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GistComment.py
vendored
Normal file
132
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GistComment.py
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class GistComment(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GistComments as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /gists/:gist_id/comments/:id <http://developer.github.com/v3/gists/comments>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, body):
|
||||
"""
|
||||
:calls: `PATCH /gists/:gist_id/comments/:id <http://developer.github.com/v3/gists/comments>`_
|
||||
:param body: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
97
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GistFile.py
vendored
Normal file
97
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GistFile.py
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GistFile(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GistFiles as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._content.value
|
||||
|
||||
@property
|
||||
def filename(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._filename.value
|
||||
|
||||
@property
|
||||
def language(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._language.value
|
||||
|
||||
@property
|
||||
def raw_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._raw_url.value
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._size.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._type.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._content = github.GithubObject.NotSet
|
||||
self._filename = github.GithubObject.NotSet
|
||||
self._language = github.GithubObject.NotSet
|
||||
self._raw_url = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "content" in attributes: # pragma no branch
|
||||
self._content = self._makeStringAttribute(attributes["content"])
|
||||
if "filename" in attributes: # pragma no branch
|
||||
self._filename = self._makeStringAttribute(attributes["filename"])
|
||||
if "language" in attributes: # pragma no branch
|
||||
self._language = self._makeStringAttribute(attributes["language"])
|
||||
if "raw_url" in attributes: # pragma no branch
|
||||
self._raw_url = self._makeStringAttribute(attributes["raw_url"])
|
||||
if "size" in attributes: # pragma no branch
|
||||
self._size = self._makeIntAttribute(attributes["size"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
272
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GistHistoryState.py
vendored
Normal file
272
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GistHistoryState.py
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
import github.CommitStats
|
||||
import github.Gist
|
||||
|
||||
|
||||
class GistHistoryState(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GistHistoryStates as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def change_status(self):
|
||||
"""
|
||||
:type: :class:`github.CommitStats.CommitStats`
|
||||
"""
|
||||
self._completeIfNotSet(self._change_status)
|
||||
return self._change_status.value
|
||||
|
||||
@property
|
||||
def comments(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._comments)
|
||||
return self._comments.value
|
||||
|
||||
@property
|
||||
def comments_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._comments_url)
|
||||
return self._comments_url.value
|
||||
|
||||
@property
|
||||
def commits_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._commits_url)
|
||||
return self._commits_url.value
|
||||
|
||||
@property
|
||||
def committed_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._committed_at)
|
||||
return self._committed_at.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._description)
|
||||
return self._description.value
|
||||
|
||||
@property
|
||||
def files(self):
|
||||
"""
|
||||
:type: dict of string to :class:`github.GistFile.GistFile`
|
||||
"""
|
||||
self._completeIfNotSet(self._files)
|
||||
return self._files.value
|
||||
|
||||
@property
|
||||
def forks(self):
|
||||
"""
|
||||
:type: list of :class:`github.Gist.Gist`
|
||||
"""
|
||||
self._completeIfNotSet(self._forks)
|
||||
return self._forks.value
|
||||
|
||||
@property
|
||||
def forks_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._forks_url)
|
||||
return self._forks_url.value
|
||||
|
||||
@property
|
||||
def git_pull_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._git_pull_url)
|
||||
return self._git_pull_url.value
|
||||
|
||||
@property
|
||||
def git_push_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._git_push_url)
|
||||
return self._git_push_url.value
|
||||
|
||||
@property
|
||||
def history(self):
|
||||
"""
|
||||
:type: list of :class:`GistHistoryState`
|
||||
"""
|
||||
self._completeIfNotSet(self._history)
|
||||
return self._history.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def owner(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._owner)
|
||||
return self._owner.value
|
||||
|
||||
@property
|
||||
def public(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._public)
|
||||
return self._public.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._version)
|
||||
return self._version.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._change_status = github.GithubObject.NotSet
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._comments_url = github.GithubObject.NotSet
|
||||
self._commits_url = github.GithubObject.NotSet
|
||||
self._committed_at = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._forks = github.GithubObject.NotSet
|
||||
self._forks_url = github.GithubObject.NotSet
|
||||
self._git_pull_url = github.GithubObject.NotSet
|
||||
self._git_push_url = github.GithubObject.NotSet
|
||||
self._history = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._owner = github.GithubObject.NotSet
|
||||
self._public = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
self._version = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "change_status" in attributes: # pragma no branch
|
||||
self._change_status = self._makeClassAttribute(github.CommitStats.CommitStats, attributes["change_status"])
|
||||
if "comments" in attributes: # pragma no branch
|
||||
self._comments = self._makeIntAttribute(attributes["comments"])
|
||||
if "comments_url" in attributes: # pragma no branch
|
||||
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
||||
if "commits_url" in attributes: # pragma no branch
|
||||
self._commits_url = self._makeStringAttribute(attributes["commits_url"])
|
||||
if "committed_at" in attributes: # pragma no branch
|
||||
self._committed_at = self._makeDatetimeAttribute(attributes["committed_at"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "description" in attributes: # pragma no branch
|
||||
self._description = self._makeStringAttribute(attributes["description"])
|
||||
if "files" in attributes: # pragma no branch
|
||||
self._files = self._makeDictOfStringsToClassesAttribute(github.GistFile.GistFile, attributes["files"])
|
||||
if "forks" in attributes: # pragma no branch
|
||||
self._forks = self._makeListOfClassesAttribute(github.Gist.Gist, attributes["forks"])
|
||||
if "forks_url" in attributes: # pragma no branch
|
||||
self._forks_url = self._makeStringAttribute(attributes["forks_url"])
|
||||
if "git_pull_url" in attributes: # pragma no branch
|
||||
self._git_pull_url = self._makeStringAttribute(attributes["git_pull_url"])
|
||||
if "git_push_url" in attributes: # pragma no branch
|
||||
self._git_push_url = self._makeStringAttribute(attributes["git_push_url"])
|
||||
if "history" in attributes: # pragma no branch
|
||||
self._history = self._makeListOfClassesAttribute(GistHistoryState, attributes["history"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeStringAttribute(attributes["id"])
|
||||
if "owner" in attributes: # pragma no branch
|
||||
self._owner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
|
||||
if "public" in attributes: # pragma no branch
|
||||
self._public = self._makeBoolAttribute(attributes["public"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
if "version" in attributes: # pragma no branch
|
||||
self._version = self._makeStringAttribute(attributes["version"])
|
||||
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitAuthor.py
vendored
Normal file
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitAuthor.py
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitAuthor(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitAuthors as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def date(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._date.value
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._email.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._name.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._date = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "date" in attributes: # pragma no branch
|
||||
self._date = self._makeDatetimeAttribute(attributes["date"])
|
||||
if "email" in attributes: # pragma no branch
|
||||
self._email = self._makeStringAttribute(attributes["email"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
92
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitBlob.py
vendored
Normal file
92
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitBlob.py
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitBlob(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GitBlobs as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._content)
|
||||
return self._content.value
|
||||
|
||||
@property
|
||||
def encoding(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._encoding)
|
||||
return self._encoding.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._sha)
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._size)
|
||||
return self._size.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._content = github.GithubObject.NotSet
|
||||
self._encoding = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "content" in attributes: # pragma no branch
|
||||
self._content = self._makeStringAttribute(attributes["content"])
|
||||
if "encoding" in attributes: # pragma no branch
|
||||
self._encoding = self._makeStringAttribute(attributes["encoding"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "size" in attributes: # pragma no branch
|
||||
self._size = self._makeIntAttribute(attributes["size"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
132
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitCommit.py
vendored
Normal file
132
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitCommit.py
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.GitAuthor
|
||||
import github.GitTree
|
||||
|
||||
|
||||
class GitCommit(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GitCommits as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def author(self):
|
||||
"""
|
||||
:type: :class:`github.GitAuthor.GitAuthor`
|
||||
"""
|
||||
self._completeIfNotSet(self._author)
|
||||
return self._author.value
|
||||
|
||||
@property
|
||||
def committer(self):
|
||||
"""
|
||||
:type: :class:`github.GitAuthor.GitAuthor`
|
||||
"""
|
||||
self._completeIfNotSet(self._committer)
|
||||
return self._committer.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._message)
|
||||
return self._message.value
|
||||
|
||||
@property
|
||||
def parents(self):
|
||||
"""
|
||||
:type: list of :class:`github.GitCommit.GitCommit`
|
||||
"""
|
||||
self._completeIfNotSet(self._parents)
|
||||
return self._parents.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._sha)
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def tree(self):
|
||||
"""
|
||||
:type: :class:`github.GitTree.GitTree`
|
||||
"""
|
||||
self._completeIfNotSet(self._tree)
|
||||
return self._tree.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.sha
|
||||
|
||||
def _initAttributes(self):
|
||||
self._author = github.GithubObject.NotSet
|
||||
self._committer = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._parents = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._tree = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
self._author = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["author"])
|
||||
if "committer" in attributes: # pragma no branch
|
||||
self._committer = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["committer"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "message" in attributes: # pragma no branch
|
||||
self._message = self._makeStringAttribute(attributes["message"])
|
||||
if "parents" in attributes: # pragma no branch
|
||||
self._parents = self._makeListOfClassesAttribute(GitCommit, attributes["parents"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "tree" in attributes: # pragma no branch
|
||||
self._tree = self._makeClassAttribute(github.GitTree.GitTree, attributes["tree"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitObject.py
vendored
Normal file
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitObject.py
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitObject(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitObjects as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._type.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
103
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitRef.py
vendored
Normal file
103
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitRef.py
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.GitObject
|
||||
|
||||
|
||||
class GitRef(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GitRefs as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def object(self):
|
||||
"""
|
||||
:type: :class:`github.GitObject.GitObject`
|
||||
"""
|
||||
self._completeIfNotSet(self._object)
|
||||
return self._object.value
|
||||
|
||||
@property
|
||||
def ref(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._ref)
|
||||
return self._ref.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/git/refs/:ref <http://developer.github.com/v3/git/refs>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, sha, force=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/git/refs/:ref <http://developer.github.com/v3/git/refs>`_
|
||||
:param sha: string
|
||||
:param force: bool
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(sha, (str, unicode)), sha
|
||||
assert force is github.GithubObject.NotSet or isinstance(force, bool), force
|
||||
post_parameters = {
|
||||
"sha": sha,
|
||||
}
|
||||
if force is not github.GithubObject.NotSet:
|
||||
post_parameters["force"] = force
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._object = github.GithubObject.NotSet
|
||||
self._ref = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "object" in attributes: # pragma no branch
|
||||
self._object = self._makeClassAttribute(github.GitObject.GitObject, attributes["object"])
|
||||
if "ref" in attributes: # pragma no branch
|
||||
self._ref = self._makeStringAttribute(attributes["ref"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
127
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitRelease.py
vendored
Normal file
127
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitRelease.py
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2015 Ed Holland <eholland@alertlogic.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.GitAuthor
|
||||
|
||||
|
||||
class GitRelease(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GitRelease as returned for example by https://developer.github.com/v3/repos/releases
|
||||
"""
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._title)
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def tag_name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._tag_name)
|
||||
return self._tag_name.value
|
||||
|
||||
@property
|
||||
def author(self):
|
||||
"""
|
||||
:type: :class:`github.GitAuthor.GitAuthor`
|
||||
"""
|
||||
self._completeIfNotSet(self._author)
|
||||
return self._author.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def upload_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._upload_url)
|
||||
return self._upload_url.value
|
||||
|
||||
def delete_release(self):
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
return True
|
||||
|
||||
def update_release(self, name, message, draft=False, prerelease=False):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(message, (str, unicode)), message
|
||||
assert isinstance(draft, bool), draft
|
||||
assert isinstance(prerelease, bool), prerelease
|
||||
post_parameters = {
|
||||
"tag_name": self.tag_name,
|
||||
"name": name,
|
||||
"body": message,
|
||||
"draft": draft,
|
||||
"prerelease": prerelease,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._tag_name = github.GithubObject.NotSet
|
||||
self._author = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._upload_url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes:
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "name" in attributes:
|
||||
self._title = self._makeStringAttribute(attributes["name"])
|
||||
if "tag_name" in attributes:
|
||||
self._tag_name = self._makeStringAttribute(attributes["tag_name"])
|
||||
if "author" in attributes:
|
||||
self._author = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["author"])
|
||||
if "url" in attributes:
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "upload_url" in attributes:
|
||||
self._upload_url = self._makeStringAttribute(attributes["upload_url"])
|
||||
106
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitTag.py
vendored
Normal file
106
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitTag.py
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.GitAuthor
|
||||
import github.GitObject
|
||||
|
||||
|
||||
class GitTag(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GitTags as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._message)
|
||||
return self._message.value
|
||||
|
||||
@property
|
||||
def object(self):
|
||||
"""
|
||||
:type: :class:`github.GitObject.GitObject`
|
||||
"""
|
||||
self._completeIfNotSet(self._object)
|
||||
return self._object.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._sha)
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def tag(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._tag)
|
||||
return self._tag.value
|
||||
|
||||
@property
|
||||
def tagger(self):
|
||||
"""
|
||||
:type: :class:`github.GitAuthor.GitAuthor`
|
||||
"""
|
||||
self._completeIfNotSet(self._tagger)
|
||||
return self._tagger.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._object = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._tag = github.GithubObject.NotSet
|
||||
self._tagger = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "message" in attributes: # pragma no branch
|
||||
self._message = self._makeStringAttribute(attributes["message"])
|
||||
if "object" in attributes: # pragma no branch
|
||||
self._object = self._makeClassAttribute(github.GitObject.GitObject, attributes["object"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "tag" in attributes: # pragma no branch
|
||||
self._tag = self._makeStringAttribute(attributes["tag"])
|
||||
if "tagger" in attributes: # pragma no branch
|
||||
self._tagger = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["tagger"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
76
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitTree.py
vendored
Normal file
76
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitTree.py
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.GitTreeElement
|
||||
|
||||
|
||||
class GitTree(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents GitTrees as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._sha)
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def tree(self):
|
||||
"""
|
||||
:type: list of :class:`github.GitTreeElement.GitTreeElement`
|
||||
"""
|
||||
self._completeIfNotSet(self._tree)
|
||||
return self._tree.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.sha
|
||||
|
||||
def _initAttributes(self):
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._tree = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "tree" in attributes: # pragma no branch
|
||||
self._tree = self._makeListOfClassesAttribute(github.GitTreeElement.GitTreeElement, attributes["tree"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
97
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitTreeElement.py
vendored
Normal file
97
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitTreeElement.py
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitTreeElement(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitTreeElements as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def mode(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._mode.value
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._path.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._size.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._type.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._mode = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "mode" in attributes: # pragma no branch
|
||||
self._mode = self._makeStringAttribute(attributes["mode"])
|
||||
if "path" in attributes: # pragma no branch
|
||||
self._path = self._makeStringAttribute(attributes["path"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "size" in attributes: # pragma no branch
|
||||
self._size = self._makeIntAttribute(attributes["size"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
116
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GithubException.py
vendored
Normal file
116
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GithubException.py
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
|
||||
class GithubException(Exception):
|
||||
"""
|
||||
Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub (but :class:`github.GithubException.BadAttributeException`).
|
||||
|
||||
Some other types of exceptions might be raised by underlying libraries, for example for network-related issues.
|
||||
"""
|
||||
|
||||
def __init__(self, status, data):
|
||||
Exception.__init__(self)
|
||||
self.__status = status
|
||||
self.__data = data
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
The status returned by the Github API
|
||||
"""
|
||||
return self.__status
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
"""
|
||||
The (decoded) data returned by the Github API
|
||||
"""
|
||||
return self.__data
|
||||
|
||||
def __str__(self):
|
||||
return str(self.status) + " " + str(self.data)
|
||||
|
||||
|
||||
class BadCredentialsException(GithubException):
|
||||
"""
|
||||
Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status)
|
||||
"""
|
||||
|
||||
|
||||
class UnknownObjectException(GithubException):
|
||||
"""
|
||||
Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status)
|
||||
"""
|
||||
|
||||
|
||||
class BadUserAgentException(GithubException):
|
||||
"""
|
||||
Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user agent HTML status)
|
||||
"""
|
||||
|
||||
|
||||
class RateLimitExceededException(GithubException):
|
||||
"""
|
||||
Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML status)
|
||||
"""
|
||||
|
||||
|
||||
class BadAttributeException(Exception):
|
||||
"""
|
||||
Exception raised when Github returns an attribute with the wrong type.
|
||||
"""
|
||||
def __init__(self, actualValue, expectedType, transformationException):
|
||||
self.__actualValue = actualValue
|
||||
self.__expectedType = expectedType
|
||||
self.__transformationException = transformationException
|
||||
|
||||
@property
|
||||
def actual_value(self):
|
||||
"""
|
||||
The value returned by Github
|
||||
"""
|
||||
return self.__actualValue
|
||||
|
||||
@property
|
||||
def expected_type(self):
|
||||
"""
|
||||
The type PyGithub expected
|
||||
"""
|
||||
return self.__expectedType
|
||||
|
||||
@property
|
||||
def transformation_exception(self):
|
||||
"""
|
||||
The exception raised when PyGithub tried to parse the value
|
||||
"""
|
||||
return self.__transformationException
|
||||
|
||||
|
||||
class TwoFactorException(GithubException):
|
||||
"""
|
||||
Exception raised when Github requires a onetime password for two-factor authentication
|
||||
"""
|
||||
264
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GithubObject.py
vendored
Normal file
264
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GithubObject.py
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import GithubException
|
||||
import Consts
|
||||
|
||||
|
||||
class _NotSetType:
|
||||
def __repr__(self):
|
||||
return "NotSet"
|
||||
|
||||
value = None
|
||||
NotSet = _NotSetType()
|
||||
|
||||
|
||||
class _ValuedAttribute:
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
|
||||
class _BadAttribute:
|
||||
def __init__(self, value, expectedType, exception=None):
|
||||
self.__value = value
|
||||
self.__expectedType = expectedType
|
||||
self.__exception = exception
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
raise GithubException.BadAttributeException(self.__value, self.__expectedType, self.__exception)
|
||||
|
||||
|
||||
class GithubObject(object):
|
||||
"""
|
||||
Base class for all classes representing objects returned by the API.
|
||||
"""
|
||||
|
||||
'''
|
||||
A global debug flag to enable header validation by requester for all objects
|
||||
'''
|
||||
CHECK_AFTER_INIT_FLAG = False
|
||||
|
||||
@classmethod
|
||||
def setCheckAfterInitFlag(cls, flag):
|
||||
cls.CHECK_AFTER_INIT_FLAG = flag
|
||||
|
||||
def __init__(self, requester, headers, attributes, completed):
|
||||
self._requester = requester
|
||||
self._initAttributes()
|
||||
self._storeAndUseAttributes(headers, attributes)
|
||||
|
||||
# Ask requester to do some checking, for debug and test purpose
|
||||
# Since it's most handy to access and kinda all-knowing
|
||||
if self.CHECK_AFTER_INIT_FLAG: # pragma no branch (Flag always set in tests)
|
||||
requester.check_me(self)
|
||||
|
||||
def _storeAndUseAttributes(self, headers, attributes):
|
||||
# Make sure headers are assigned before calling _useAttributes
|
||||
# (Some derived classes will use headers in _useAttributes)
|
||||
self._headers = headers
|
||||
self._rawData = attributes
|
||||
self._useAttributes(attributes)
|
||||
|
||||
@property
|
||||
def raw_data(self):
|
||||
"""
|
||||
:type: dict
|
||||
"""
|
||||
self._completeIfNeeded()
|
||||
return self._rawData
|
||||
|
||||
@property
|
||||
def raw_headers(self):
|
||||
"""
|
||||
:type: dict
|
||||
"""
|
||||
self._completeIfNeeded()
|
||||
return self._headers
|
||||
|
||||
@staticmethod
|
||||
def _parentUrl(url):
|
||||
return "/".join(url.split("/")[: -1])
|
||||
|
||||
@staticmethod
|
||||
def __makeSimpleAttribute(value, type):
|
||||
if value is None or isinstance(value, type):
|
||||
return _ValuedAttribute(value)
|
||||
else:
|
||||
return _BadAttribute(value, type)
|
||||
|
||||
@staticmethod
|
||||
def __makeSimpleListAttribute(value, type):
|
||||
if isinstance(value, list) and all(isinstance(element, type) for element in value):
|
||||
return _ValuedAttribute(value)
|
||||
else:
|
||||
return _BadAttribute(value, [type])
|
||||
|
||||
@staticmethod
|
||||
def __makeTransformedAttribute(value, type, transform):
|
||||
if value is None:
|
||||
return _ValuedAttribute(None)
|
||||
elif isinstance(value, type):
|
||||
try:
|
||||
return _ValuedAttribute(transform(value))
|
||||
except Exception as e:
|
||||
return _BadAttribute(value, type, e)
|
||||
else:
|
||||
return _BadAttribute(value, type)
|
||||
|
||||
@staticmethod
|
||||
def _makeStringAttribute(value):
|
||||
return GithubObject.__makeSimpleAttribute(value, (str, unicode))
|
||||
|
||||
@staticmethod
|
||||
def _makeIntAttribute(value):
|
||||
return GithubObject.__makeSimpleAttribute(value, (int, long))
|
||||
|
||||
@staticmethod
|
||||
def _makeBoolAttribute(value):
|
||||
return GithubObject.__makeSimpleAttribute(value, bool)
|
||||
|
||||
@staticmethod
|
||||
def _makeDictAttribute(value):
|
||||
return GithubObject.__makeSimpleAttribute(value, dict)
|
||||
|
||||
@staticmethod
|
||||
def _makeTimestampAttribute(value):
|
||||
return GithubObject.__makeTransformedAttribute(value, (int, long), datetime.datetime.utcfromtimestamp)
|
||||
|
||||
@staticmethod
|
||||
def _makeDatetimeAttribute(value):
|
||||
def parseDatetime(s):
|
||||
if len(s) == 24: # pragma no branch (This branch was used only when creating a download)
|
||||
# The Downloads API has been removed. I'm keeping this branch because I have no mean
|
||||
# to check if it's really useless now.
|
||||
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z") # pragma no cover (This branch was used only when creating a download)
|
||||
elif len(s) == 25:
|
||||
return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
|
||||
else:
|
||||
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
return GithubObject.__makeTransformedAttribute(value, (str, unicode), parseDatetime)
|
||||
|
||||
def _makeClassAttribute(self, klass, value):
|
||||
return GithubObject.__makeTransformedAttribute(value, dict, lambda value: klass(self._requester, self._headers, value, completed=False))
|
||||
|
||||
@staticmethod
|
||||
def _makeListOfStringsAttribute(value):
|
||||
return GithubObject.__makeSimpleListAttribute(value, (str, unicode))
|
||||
|
||||
@staticmethod
|
||||
def _makeListOfIntsAttribute(value):
|
||||
return GithubObject.__makeSimpleListAttribute(value, int)
|
||||
|
||||
@staticmethod
|
||||
def _makeListOfListOfStringsAttribute(value):
|
||||
return GithubObject.__makeSimpleListAttribute(value, list)
|
||||
|
||||
def _makeListOfClassesAttribute(self, klass, value):
|
||||
if isinstance(value, list) and all(isinstance(element, dict) for element in value):
|
||||
return _ValuedAttribute([klass(self._requester, self._headers, element, completed=False) for element in value])
|
||||
else:
|
||||
return _BadAttribute(value, [dict])
|
||||
|
||||
def _makeDictOfStringsToClassesAttribute(self, klass, value):
|
||||
if isinstance(value, dict) and all(isinstance(key, (str, unicode)) and isinstance(element, dict) for key, element in value.iteritems()):
|
||||
return _ValuedAttribute(dict((key, klass(self._requester, self._headers, element, completed=False)) for key, element in value.iteritems()))
|
||||
else:
|
||||
return _BadAttribute(value, {(str, unicode): dict})
|
||||
|
||||
@property
|
||||
def etag(self):
|
||||
'''
|
||||
:type: str
|
||||
'''
|
||||
return self._headers.get(Consts.RES_ETAG)
|
||||
|
||||
@property
|
||||
def last_modified(self):
|
||||
'''
|
||||
:type: str
|
||||
'''
|
||||
return self._headers.get(Consts.RES_LAST_MODIFED)
|
||||
|
||||
|
||||
class NonCompletableGithubObject(GithubObject):
|
||||
def _completeIfNeeded(self):
|
||||
pass
|
||||
|
||||
|
||||
class CompletableGithubObject(GithubObject):
|
||||
def __init__(self, requester, headers, attributes, completed):
|
||||
GithubObject.__init__(self, requester, headers, attributes, completed)
|
||||
self.__completed = completed
|
||||
|
||||
def __eq__(self, other):
|
||||
return other.__class__ is self.__class__ and other._url.value == self._url.value
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def _completeIfNotSet(self, value):
|
||||
if value is NotSet:
|
||||
self._completeIfNeeded()
|
||||
|
||||
def _completeIfNeeded(self):
|
||||
if not self.__completed:
|
||||
self.__complete()
|
||||
|
||||
def __complete(self):
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self._url.value
|
||||
)
|
||||
self._storeAndUseAttributes(headers, data)
|
||||
self.__completed = True
|
||||
|
||||
def update(self):
|
||||
'''
|
||||
Check and update the object with conditional request
|
||||
:rtype: Boolean value indicating whether the object is changed
|
||||
'''
|
||||
conditionalRequestHeader = dict()
|
||||
if self.etag is not None:
|
||||
conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag
|
||||
if self.last_modified is not None:
|
||||
conditionalRequestHeader[Consts.REQ_IF_MODIFIED_SINCE] = self.last_modified
|
||||
|
||||
status, responseHeaders, output = self._requester.requestJson(
|
||||
"GET",
|
||||
self._url.value,
|
||||
headers=conditionalRequestHeader
|
||||
)
|
||||
if status == 304:
|
||||
return False
|
||||
else:
|
||||
headers, data = self._requester._Requester__check(status, responseHeaders, output)
|
||||
self._storeAndUseAttributes(headers, data)
|
||||
self.__completed = True
|
||||
return True
|
||||
56
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitignoreTemplate.py
vendored
Normal file
56
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/GitignoreTemplate.py
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitignoreTemplate(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitignoreTemplates as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._source.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._name.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._source = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "source" in attributes: # pragma no branch
|
||||
self._source = self._makeStringAttribute(attributes["source"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
205
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Hook.py
vendored
Normal file
205
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Hook.py
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.HookResponse
|
||||
|
||||
|
||||
class Hook(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Hooks as returned for example by http://developer.github.com/v3/repos/hooks
|
||||
"""
|
||||
|
||||
@property
|
||||
def active(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._active)
|
||||
return self._active.value
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
"""
|
||||
:type: dict
|
||||
"""
|
||||
self._completeIfNotSet(self._config)
|
||||
return self._config.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def events(self):
|
||||
"""
|
||||
:type: list of string
|
||||
"""
|
||||
self._completeIfNotSet(self._events)
|
||||
return self._events.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def last_response(self):
|
||||
"""
|
||||
:type: :class:`github.HookResponse.HookResponse`
|
||||
"""
|
||||
self._completeIfNotSet(self._last_response)
|
||||
return self._last_response.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def test_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._test_url)
|
||||
return self._test_url.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/hooks/:id <http://developer.github.com/v3/repos/hooks>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/hooks/:id <http://developer.github.com/v3/repos/hooks>`_
|
||||
:param name: string
|
||||
:param config: dict
|
||||
:param events: list of string
|
||||
:param add_events: list of string
|
||||
:param remove_events: list of string
|
||||
:param active: bool
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(config, dict), config
|
||||
assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
|
||||
assert add_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_events), add_events
|
||||
assert remove_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_events), remove_events
|
||||
assert active is github.GithubObject.NotSet or isinstance(active, bool), active
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
"config": config,
|
||||
}
|
||||
if events is not github.GithubObject.NotSet:
|
||||
post_parameters["events"] = events
|
||||
if add_events is not github.GithubObject.NotSet:
|
||||
post_parameters["add_events"] = add_events
|
||||
if remove_events is not github.GithubObject.NotSet:
|
||||
post_parameters["remove_events"] = remove_events
|
||||
if active is not github.GithubObject.NotSet:
|
||||
post_parameters["active"] = active
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def test(self):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/hooks/:id/tests <http://developer.github.com/v3/repos/hooks>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/tests"
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._active = github.GithubObject.NotSet
|
||||
self._config = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._events = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._last_response = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._test_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "active" in attributes: # pragma no branch
|
||||
self._active = self._makeBoolAttribute(attributes["active"])
|
||||
if "config" in attributes: # pragma no branch
|
||||
self._config = self._makeDictAttribute(attributes["config"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "events" in attributes: # pragma no branch
|
||||
self._events = self._makeListOfStringsAttribute(attributes["events"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "last_response" in attributes: # pragma no branch
|
||||
self._last_response = self._makeClassAttribute(github.HookResponse.HookResponse, attributes["last_response"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "test_url" in attributes: # pragma no branch
|
||||
self._test_url = self._makeStringAttribute(attributes["test_url"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
77
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/HookDescription.py
vendored
Normal file
77
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/HookDescription.py
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class HookDescription(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents HookDescriptions as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def events(self):
|
||||
"""
|
||||
:type: list of string
|
||||
"""
|
||||
return self._events.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
"""
|
||||
:type: list of list of string
|
||||
"""
|
||||
return self._schema.value
|
||||
|
||||
@property
|
||||
def supported_events(self):
|
||||
"""
|
||||
:type: list of string
|
||||
"""
|
||||
return self._supported_events.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._events = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._schema = github.GithubObject.NotSet
|
||||
self._supported_events = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "events" in attributes: # pragma no branch
|
||||
self._events = self._makeListOfStringsAttribute(attributes["events"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "schema" in attributes: # pragma no branch
|
||||
self._schema = self._makeListOfListOfStringsAttribute(attributes["schema"])
|
||||
if "supported_events" in attributes: # pragma no branch
|
||||
self._supported_events = self._makeListOfStringsAttribute(attributes["supported_events"])
|
||||
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/HookResponse.py
vendored
Normal file
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/HookResponse.py
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class HookResponse(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents HookResponses as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._code.value
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._message.value
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._status.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._code = github.GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._status = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "code" in attributes: # pragma no branch
|
||||
self._code = self._makeIntAttribute(attributes["code"])
|
||||
if "message" in attributes: # pragma no branch
|
||||
self._message = self._makeStringAttribute(attributes["message"])
|
||||
if "status" in attributes: # pragma no branch
|
||||
self._status = self._makeStringAttribute(attributes["status"])
|
||||
51
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/InputFileContent.py
vendored
Normal file
51
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/InputFileContent.py
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class InputFileContent(object):
|
||||
"""
|
||||
"""
|
||||
|
||||
def __init__(self, content, new_name=github.GithubObject.NotSet):
|
||||
"""
|
||||
:param content: string
|
||||
:param new_name: string
|
||||
"""
|
||||
|
||||
assert isinstance(content, (str, unicode)), content
|
||||
assert new_name is github.GithubObject.NotSet or isinstance(new_name, (str, unicode)), new_name
|
||||
self.__newName = new_name
|
||||
self.__content = content
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
identity = {
|
||||
"content": self.__content,
|
||||
}
|
||||
if self.__newName is not github.GithubObject.NotSet:
|
||||
identity["filename"] = self.__newName
|
||||
return identity
|
||||
56
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/InputGitAuthor.py
vendored
Normal file
56
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/InputGitAuthor.py
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class InputGitAuthor(object):
|
||||
"""
|
||||
"""
|
||||
|
||||
def __init__(self, name, email, date=github.GithubObject.NotSet):
|
||||
"""
|
||||
:param name: string
|
||||
:param email: string
|
||||
:param date: string
|
||||
"""
|
||||
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(email, (str, unicode)), email
|
||||
assert date is github.GithubObject.NotSet or isinstance(date, (str, unicode)), date # @todo Datetime?
|
||||
|
||||
self.__name = name
|
||||
self.__email = email
|
||||
self.__date = date
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
identity = {
|
||||
"name": self.__name,
|
||||
"email": self.__email,
|
||||
}
|
||||
if self.__date is not github.GithubObject.NotSet:
|
||||
identity["date"] = self.__date
|
||||
return identity
|
||||
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/InputGitTreeElement.py
vendored
Normal file
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/InputGitTreeElement.py
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class InputGitTreeElement(object):
|
||||
"""
|
||||
"""
|
||||
|
||||
def __init__(self, path, mode, type, content=github.GithubObject.NotSet, sha=github.GithubObject.NotSet):
|
||||
"""
|
||||
:param path: string
|
||||
:param mode: string
|
||||
:param type: string
|
||||
:param content: string
|
||||
:param sha: string
|
||||
"""
|
||||
|
||||
assert isinstance(path, (str, unicode)), path
|
||||
assert isinstance(mode, (str, unicode)), mode
|
||||
assert isinstance(type, (str, unicode)), type
|
||||
assert content is github.GithubObject.NotSet or isinstance(content, (str, unicode)), content
|
||||
assert sha is github.GithubObject.NotSet or isinstance(sha, (str, unicode)), sha
|
||||
self.__path = path
|
||||
self.__mode = mode
|
||||
self.__type = type
|
||||
self.__content = content
|
||||
self.__sha = sha
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
identity = {
|
||||
"path": self.__path,
|
||||
"mode": self.__mode,
|
||||
"type": self.__type,
|
||||
}
|
||||
if self.__sha is not github.GithubObject.NotSet:
|
||||
identity["sha"] = self.__sha
|
||||
if self.__content is not github.GithubObject.NotSet:
|
||||
identity["content"] = self.__content
|
||||
return identity
|
||||
449
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Issue.py
vendored
Normal file
449
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Issue.py
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Andrew Bettison <andrewb@zip.com.au> #
|
||||
# Copyright 2012 Philip Kimmey <philip@rover.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Stuart Glaser <stuglaser@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import urllib
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.Repository
|
||||
import github.IssueEvent
|
||||
import github.Label
|
||||
import github.NamedUser
|
||||
import github.Milestone
|
||||
import github.IssueComment
|
||||
import github.IssuePullRequest
|
||||
|
||||
|
||||
class Issue(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Issues as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def assignee(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._assignee)
|
||||
return self._assignee.value
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def closed_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._closed_at)
|
||||
return self._closed_at.value
|
||||
|
||||
@property
|
||||
def closed_by(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._closed_by)
|
||||
return self._closed_by.value
|
||||
|
||||
@property
|
||||
def comments(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._comments)
|
||||
return self._comments.value
|
||||
|
||||
@property
|
||||
def comments_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._comments_url)
|
||||
return self._comments_url.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def events_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._events_url)
|
||||
return self._events_url.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def labels(self):
|
||||
"""
|
||||
:type: list of :class:`github.Label.Label`
|
||||
"""
|
||||
self._completeIfNotSet(self._labels)
|
||||
return self._labels.value
|
||||
|
||||
@property
|
||||
def labels_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._labels_url)
|
||||
return self._labels_url.value
|
||||
|
||||
@property
|
||||
def milestone(self):
|
||||
"""
|
||||
:type: :class:`github.Milestone.Milestone`
|
||||
"""
|
||||
self._completeIfNotSet(self._milestone)
|
||||
return self._milestone.value
|
||||
|
||||
@property
|
||||
def number(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._number)
|
||||
return self._number.value
|
||||
|
||||
@property
|
||||
def pull_request(self):
|
||||
"""
|
||||
:type: :class:`github.IssuePullRequest.IssuePullRequest`
|
||||
"""
|
||||
self._completeIfNotSet(self._pull_request)
|
||||
return self._pull_request.value
|
||||
|
||||
@property
|
||||
def repository(self):
|
||||
"""
|
||||
:type: :class:`github.Repository.Repository`
|
||||
"""
|
||||
self._completeIfNotSet(self._repository)
|
||||
if self._repository is github.GithubObject.NotSet:
|
||||
# The repository was not set automatically, so it must be looked up by url.
|
||||
repo_url = "/".join(self.url.split("/")[:-2])
|
||||
self._repository = github.GithubObject._ValuedAttribute(github.Repository.Repository(self._requester, self._headers, {'url': repo_url}, completed=False))
|
||||
return self._repository.value
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._state)
|
||||
return self._state.value
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._title)
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def add_to_labels(self, *labels):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/issues/:number/labels <http://developer.github.com/v3/issues/labels>`_
|
||||
:param label: :class:`github.Label.Label` or string
|
||||
:rtype: None
|
||||
"""
|
||||
assert all(isinstance(element, (github.Label.Label, str, unicode)) for element in labels), labels
|
||||
post_parameters = [label.name if isinstance(label, github.Label.Label) else label for label in labels]
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/labels",
|
||||
input=post_parameters
|
||||
)
|
||||
|
||||
def create_comment(self, body):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/issues/:number/comments <http://developer.github.com/v3/issues/comments>`_
|
||||
:param body: string
|
||||
:rtype: :class:`github.IssueComment.IssueComment`
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/comments",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete_labels(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/issues/:number/labels <http://developer.github.com/v3/issues/labels>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/labels"
|
||||
)
|
||||
|
||||
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, state=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/issues/:number <http://developer.github.com/v3/issues>`_
|
||||
:param title: string
|
||||
:param body: string
|
||||
:param assignee: string or :class:`github.NamedUser.NamedUser` or None
|
||||
:param state: string
|
||||
:param milestone: :class:`github.Milestone.Milestone` or None
|
||||
:param labels: list of string
|
||||
:rtype: None
|
||||
"""
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert assignee is github.GithubObject.NotSet or assignee is None or isinstance(assignee, github.NamedUser.NamedUser) or isinstance(assignee, (str, unicode)), assignee
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert milestone is github.GithubObject.NotSet or milestone is None or isinstance(milestone, github.Milestone.Milestone), milestone
|
||||
assert labels is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in labels), labels
|
||||
post_parameters = dict()
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters["body"] = body
|
||||
if assignee is not github.GithubObject.NotSet:
|
||||
if isinstance(assignee, (str, unicode)):
|
||||
post_parameters["assignee"] = assignee
|
||||
else:
|
||||
post_parameters["assignee"] = assignee._identity if assignee else ''
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
if milestone is not github.GithubObject.NotSet:
|
||||
post_parameters["milestone"] = milestone._identity if milestone else ''
|
||||
if labels is not github.GithubObject.NotSet:
|
||||
post_parameters["labels"] = labels
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_comment(self, id):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/comments/:id <http://developer.github.com/v3/issues/comments>`_
|
||||
:param id: integer
|
||||
:rtype: :class:`github.IssueComment.IssueComment`
|
||||
"""
|
||||
assert isinstance(id, (int, long)), id
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self._parentUrl(self.url) + "/comments/" + str(id)
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/:number/comments <http://developer.github.com/v3/issues/comments>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueComment.IssueComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_events(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/:issue_number/events <http://developer.github.com/v3/issues/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueEvent.IssueEvent`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueEvent.IssueEvent,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_labels(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/:number/labels <http://developer.github.com/v3/issues/labels>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Label.Label`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Label.Label,
|
||||
self._requester,
|
||||
self.url + "/labels",
|
||||
None
|
||||
)
|
||||
|
||||
def remove_from_labels(self, label):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/issues/:number/labels/:name <http://developer.github.com/v3/issues/labels>`_
|
||||
:param label: :class:`github.Label.Label` or string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(label, (github.Label.Label, str, unicode)), label
|
||||
if isinstance(label, github.Label.Label):
|
||||
label = label._identity
|
||||
else:
|
||||
label = urllib.quote(label)
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/labels/" + label
|
||||
)
|
||||
|
||||
def set_labels(self, *labels):
|
||||
"""
|
||||
:calls: `PUT /repos/:owner/:repo/issues/:number/labels <http://developer.github.com/v3/issues/labels>`_
|
||||
:param label: :class:`github.Label.Label`
|
||||
:rtype: None
|
||||
"""
|
||||
assert all(isinstance(element, (github.Label.Label, str, unicode)) for element in labels), labels
|
||||
post_parameters = [label.name if isinstance(label, github.Label.Label) else label for label in labels]
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PUT",
|
||||
self.url + "/labels",
|
||||
input=post_parameters
|
||||
)
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.number
|
||||
|
||||
def _initAttributes(self):
|
||||
self._assignee = github.GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._closed_at = github.GithubObject.NotSet
|
||||
self._closed_by = github.GithubObject.NotSet
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._comments_url = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._events_url = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._labels = github.GithubObject.NotSet
|
||||
self._labels_url = github.GithubObject.NotSet
|
||||
self._milestone = github.GithubObject.NotSet
|
||||
self._number = github.GithubObject.NotSet
|
||||
self._pull_request = github.GithubObject.NotSet
|
||||
self._repository = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "closed_at" in attributes: # pragma no branch
|
||||
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
||||
if "closed_by" in attributes: # pragma no branch
|
||||
self._closed_by = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["closed_by"])
|
||||
if "comments" in attributes: # pragma no branch
|
||||
self._comments = self._makeIntAttribute(attributes["comments"])
|
||||
if "comments_url" in attributes: # pragma no branch
|
||||
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "events_url" in attributes: # pragma no branch
|
||||
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "labels" in attributes: # pragma no branch
|
||||
self._labels = self._makeListOfClassesAttribute(github.Label.Label, attributes["labels"])
|
||||
if "labels_url" in attributes: # pragma no branch
|
||||
self._labels_url = self._makeStringAttribute(attributes["labels_url"])
|
||||
if "milestone" in attributes: # pragma no branch
|
||||
self._milestone = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
|
||||
if "number" in attributes: # pragma no branch
|
||||
self._number = self._makeIntAttribute(attributes["number"])
|
||||
if "pull_request" in attributes: # pragma no branch
|
||||
self._pull_request = self._makeClassAttribute(github.IssuePullRequest.IssuePullRequest, attributes["pull_request"])
|
||||
if "repository" in attributes: # pragma no branch
|
||||
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
|
||||
if "state" in attributes: # pragma no branch
|
||||
self._state = self._makeStringAttribute(attributes["state"])
|
||||
if "title" in attributes: # pragma no branch
|
||||
self._title = self._makeStringAttribute(attributes["title"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
155
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/IssueComment.py
vendored
Normal file
155
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/IssueComment.py
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class IssueComment(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents IssueComments as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def issue_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._issue_url)
|
||||
return self._issue_url.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/issues/comments/:id <http://developer.github.com/v3/issues/comments>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, body):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/issues/comments/:id <http://developer.github.com/v3/issues/comments>`_
|
||||
:param body: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._issue_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "issue_url" in attributes: # pragma no branch
|
||||
self._issue_url = self._makeStringAttribute(attributes["issue_url"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
117
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/IssueEvent.py
vendored
Normal file
117
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/IssueEvent.py
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Issue
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class IssueEvent(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents IssueEvents as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def actor(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._actor)
|
||||
return self._actor.value
|
||||
|
||||
@property
|
||||
def commit_id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._commit_id)
|
||||
return self._commit_id.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def event(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._event)
|
||||
return self._event.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def issue(self):
|
||||
"""
|
||||
:type: :class:`github.Issue.Issue`
|
||||
"""
|
||||
self._completeIfNotSet(self._issue)
|
||||
return self._issue.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._actor = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._event = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._issue = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "actor" in attributes: # pragma no branch
|
||||
self._actor = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"])
|
||||
if "commit_id" in attributes: # pragma no branch
|
||||
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "event" in attributes: # pragma no branch
|
||||
self._event = self._makeStringAttribute(attributes["event"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "issue" in attributes: # pragma no branch
|
||||
self._issue = self._makeClassAttribute(github.Issue.Issue, attributes["issue"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/IssuePullRequest.py
vendored
Normal file
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/IssuePullRequest.py
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class IssuePullRequest(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents IssuePullRequests as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def diff_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._diff_url.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def patch_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._patch_url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._patch_url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "patch_url" in attributes: # pragma no branch
|
||||
self._patch_url = self._makeStringAttribute(attributes["patch_url"])
|
||||
107
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Label.py
vendored
Normal file
107
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Label.py
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import urllib
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Label(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Labels. The reference can be found here http://developer.github.com/v3/issues/labels/
|
||||
"""
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._color)
|
||||
return self._color.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/labels/:name <http://developer.github.com/v3/issues/labels>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, name, color):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/labels/:name <http://developer.github.com/v3/issues/labels>`_
|
||||
:param name: string
|
||||
:param color: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(color, (str, unicode)), color
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
"color": color,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return urllib.quote(self.name)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._color = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "color" in attributes: # pragma no branch
|
||||
self._color = self._makeStringAttribute(attributes["color"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
149
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Legacy.py
vendored
Normal file
149
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Legacy.py
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import urlparse
|
||||
|
||||
import github.PaginatedList
|
||||
|
||||
|
||||
class PaginatedList(github.PaginatedList.PaginatedListBase):
|
||||
def __init__(self, url, args, requester, key, convert, contentClass):
|
||||
github.PaginatedList.PaginatedListBase.__init__(self)
|
||||
self.__url = url
|
||||
self.__args = args
|
||||
self.__requester = requester
|
||||
self.__key = key
|
||||
self.__convert = convert
|
||||
self.__contentClass = contentClass
|
||||
self.__nextPage = 0
|
||||
self.__continue = True
|
||||
|
||||
def _couldGrow(self):
|
||||
return self.__continue
|
||||
|
||||
def _fetchNextPage(self):
|
||||
page = self.__nextPage
|
||||
self.__nextPage += 1
|
||||
return self.get_page(page)
|
||||
|
||||
def get_page(self, page):
|
||||
assert isinstance(page, (int, long)), page
|
||||
args = dict(self.__args)
|
||||
if page != 0:
|
||||
args["start_page"] = page + 1
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.__url,
|
||||
parameters=args
|
||||
)
|
||||
self.__continue = len(data[self.__key]) > 0
|
||||
|
||||
return [
|
||||
self.__contentClass(self.__requester, headers, self.__convert(element), completed=False)
|
||||
for element in data[self.__key]
|
||||
]
|
||||
|
||||
|
||||
def convertUser(attributes):
|
||||
convertedAttributes = {
|
||||
"login": attributes["login"],
|
||||
"url": "/users/" + attributes["login"],
|
||||
}
|
||||
if "gravatar_id" in attributes: # pragma no branch
|
||||
convertedAttributes["gravatar_id"] = attributes["gravatar_id"]
|
||||
if "followers" in attributes: # pragma no branch
|
||||
convertedAttributes["followers"] = attributes["followers"]
|
||||
if "repos" in attributes: # pragma no branch
|
||||
convertedAttributes["public_repos"] = attributes["repos"]
|
||||
if "name" in attributes: # pragma no branch
|
||||
convertedAttributes["name"] = attributes["name"]
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
convertedAttributes["created_at"] = attributes["created_at"]
|
||||
if "location" in attributes: # pragma no branch
|
||||
convertedAttributes["location"] = attributes["location"]
|
||||
return convertedAttributes
|
||||
|
||||
|
||||
def convertRepo(attributes):
|
||||
convertedAttributes = {
|
||||
"owner": {"login": attributes["owner"], "url": "/users/" + attributes["owner"]},
|
||||
"url": "/repos/" + attributes["owner"] + "/" + attributes["name"],
|
||||
}
|
||||
if "pushed_at" in attributes: # pragma no branch
|
||||
convertedAttributes["pushed_at"] = attributes["pushed_at"]
|
||||
if "homepage" in attributes: # pragma no branch
|
||||
convertedAttributes["homepage"] = attributes["homepage"]
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
convertedAttributes["created_at"] = attributes["created_at"]
|
||||
if "watchers" in attributes: # pragma no branch
|
||||
convertedAttributes["watchers"] = attributes["watchers"]
|
||||
if "has_downloads" in attributes: # pragma no branch
|
||||
convertedAttributes["has_downloads"] = attributes["has_downloads"]
|
||||
if "fork" in attributes: # pragma no branch
|
||||
convertedAttributes["fork"] = attributes["fork"]
|
||||
if "has_issues" in attributes: # pragma no branch
|
||||
convertedAttributes["has_issues"] = attributes["has_issues"]
|
||||
if "has_wiki" in attributes: # pragma no branch
|
||||
convertedAttributes["has_wiki"] = attributes["has_wiki"]
|
||||
if "forks" in attributes: # pragma no branch
|
||||
convertedAttributes["forks"] = attributes["forks"]
|
||||
if "size" in attributes: # pragma no branch
|
||||
convertedAttributes["size"] = attributes["size"]
|
||||
if "private" in attributes: # pragma no branch
|
||||
convertedAttributes["private"] = attributes["private"]
|
||||
if "open_issues" in attributes: # pragma no branch
|
||||
convertedAttributes["open_issues"] = attributes["open_issues"]
|
||||
if "description" in attributes: # pragma no branch
|
||||
convertedAttributes["description"] = attributes["description"]
|
||||
if "language" in attributes: # pragma no branch
|
||||
convertedAttributes["language"] = attributes["language"]
|
||||
if "name" in attributes: # pragma no branch
|
||||
convertedAttributes["name"] = attributes["name"]
|
||||
return convertedAttributes
|
||||
|
||||
|
||||
def convertIssue(attributes):
|
||||
convertedAttributes = {
|
||||
"number": attributes["number"],
|
||||
"url": "/repos" + urlparse.urlparse(attributes["html_url"]).path,
|
||||
"user": {"login": attributes["user"], "url": "/users/" + attributes["user"]},
|
||||
}
|
||||
if "labels" in attributes: # pragma no branch
|
||||
convertedAttributes["labels"] = [{"name": label} for label in attributes["labels"]]
|
||||
if "title" in attributes: # pragma no branch
|
||||
convertedAttributes["title"] = attributes["title"]
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
convertedAttributes["created_at"] = attributes["created_at"]
|
||||
if "comments" in attributes: # pragma no branch
|
||||
convertedAttributes["comments"] = attributes["comments"]
|
||||
if "body" in attributes: # pragma no branch
|
||||
convertedAttributes["body"] = attributes["body"]
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
convertedAttributes["updated_at"] = attributes["updated_at"]
|
||||
if "state" in attributes: # pragma no branch
|
||||
convertedAttributes["state"] = attributes["state"]
|
||||
return convertedAttributes
|
||||
591
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/MainClass.py
vendored
Normal file
591
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/MainClass.py
vendored
Normal file
@@ -0,0 +1,591 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Ed Jackson <ed.jackson@gmail.com> #
|
||||
# Copyright 2013 Jonathan J Hunt <hunt@braincorporation.com> #
|
||||
# Copyright 2013 Peter Golm <golm.peter@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import urllib
|
||||
import pickle
|
||||
|
||||
from Requester import Requester
|
||||
import AuthenticatedUser
|
||||
import NamedUser
|
||||
import Organization
|
||||
import Gist
|
||||
import github.PaginatedList
|
||||
import Repository
|
||||
import Legacy
|
||||
import github.GithubObject
|
||||
import HookDescription
|
||||
import GitignoreTemplate
|
||||
import Status
|
||||
import StatusMessage
|
||||
import RateLimit
|
||||
|
||||
|
||||
DEFAULT_BASE_URL = "https://api.github.com"
|
||||
DEFAULT_TIMEOUT = 10
|
||||
DEFAULT_PER_PAGE = 30
|
||||
|
||||
|
||||
class Github(object):
|
||||
"""
|
||||
This is the main class you instanciate to access the Github API v3. Optional parameters allow different authentication methods.
|
||||
"""
|
||||
|
||||
def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT, client_id=None, client_secret=None, user_agent='PyGithub/Python', per_page=DEFAULT_PER_PAGE, api_preview=False):
|
||||
"""
|
||||
:param login_or_token: string
|
||||
:param password: string
|
||||
:param base_url: string
|
||||
:param timeout: integer
|
||||
:param client_id: string
|
||||
:param client_secret: string
|
||||
:param user_agent: string
|
||||
:param per_page: int
|
||||
"""
|
||||
|
||||
assert login_or_token is None or isinstance(login_or_token, (str, unicode)), login_or_token
|
||||
assert password is None or isinstance(password, (str, unicode)), password
|
||||
assert isinstance(base_url, (str, unicode)), base_url
|
||||
assert isinstance(timeout, (int, long)), timeout
|
||||
assert client_id is None or isinstance(client_id, (str, unicode)), client_id
|
||||
assert client_secret is None or isinstance(client_secret, (str, unicode)), client_secret
|
||||
assert user_agent is None or isinstance(user_agent, (str, unicode)), user_agent
|
||||
assert isinstance(api_preview, (bool))
|
||||
self.__requester = Requester(login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page, api_preview)
|
||||
|
||||
def __get_FIX_REPO_GET_GIT_REF(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
return self.__requester.FIX_REPO_GET_GIT_REF
|
||||
|
||||
def __set_FIX_REPO_GET_GIT_REF(self, value):
|
||||
self.__requester.FIX_REPO_GET_GIT_REF = value
|
||||
|
||||
FIX_REPO_GET_GIT_REF = property(__get_FIX_REPO_GET_GIT_REF, __set_FIX_REPO_GET_GIT_REF)
|
||||
|
||||
def __get_per_page(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self.__requester.per_page
|
||||
|
||||
def __set_per_page(self, value):
|
||||
self.__requester.per_page = value
|
||||
|
||||
# v2: Remove this property? Why should it be necessary to read/modify it after construction
|
||||
per_page = property(__get_per_page, __set_per_page)
|
||||
|
||||
# v2: Provide a unified way to access values of headers of last response
|
||||
# v2: (and add/keep ad hoc properties for specific useful headers like rate limiting, oauth scopes, etc.)
|
||||
# v2: Return an instance of a class: using a tuple did not allow to add a field "resettime"
|
||||
@property
|
||||
def rate_limiting(self):
|
||||
"""
|
||||
First value is requests remaining, second value is request limit.
|
||||
:type: (int, int)
|
||||
"""
|
||||
remaining, limit = self.__requester.rate_limiting
|
||||
if limit < 0:
|
||||
self.get_rate_limit()
|
||||
return self.__requester.rate_limiting
|
||||
|
||||
@property
|
||||
def rate_limiting_resettime(self):
|
||||
"""
|
||||
Unix timestamp indicating when rate limiting will reset.
|
||||
:type: int
|
||||
"""
|
||||
if self.__requester.rate_limiting_resettime == 0:
|
||||
self.get_rate_limit()
|
||||
return self.__requester.rate_limiting_resettime
|
||||
|
||||
def get_rate_limit(self):
|
||||
"""
|
||||
Don't forget you can access the rate limit returned in headers of last Github API v3 response, by :attr:`github.MainClass.Github.rate_limiting` and :attr:`github.MainClass.Github.rate_limiting_resettime`.
|
||||
|
||||
:calls: `GET /rate_limit <http://developer.github.com/v3/rate_limit>`_
|
||||
:rtype: :class:`github.RateLimit.RateLimit`
|
||||
"""
|
||||
headers, attributes = self.__requester.requestJsonAndCheck(
|
||||
'GET',
|
||||
'/rate_limit'
|
||||
)
|
||||
return RateLimit.RateLimit(self.__requester, headers, attributes, True)
|
||||
|
||||
@property
|
||||
def oauth_scopes(self):
|
||||
"""
|
||||
:type: list of string
|
||||
"""
|
||||
return self.__requester.oauth_scopes
|
||||
|
||||
def get_user(self, login=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users/:user <http://developer.github.com/v3/users>`_ or `GET /user <http://developer.github.com/v3/users>`_
|
||||
:param login: string
|
||||
:rtype: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login
|
||||
if login is github.GithubObject.NotSet:
|
||||
return AuthenticatedUser.AuthenticatedUser(self.__requester, {}, {"url": "/user"}, completed=False)
|
||||
else:
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/users/" + login
|
||||
)
|
||||
return github.NamedUser.NamedUser(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_users(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users <http://developer.github.com/v3/users>`_
|
||||
:param since: integer
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, (int, long)), since
|
||||
url_parameters = dict()
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
"/users",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_organization(self, login):
|
||||
"""
|
||||
:calls: `GET /orgs/:org <http://developer.github.com/v3/orgs>`_
|
||||
:param login: string
|
||||
:rtype: :class:`github.Organization.Organization`
|
||||
"""
|
||||
assert isinstance(login, (str, unicode)), login
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/orgs/" + login
|
||||
)
|
||||
return github.Organization.Organization(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_repo(self, full_name_or_id, lazy=True):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo <http://developer.github.com/v3/repos>`_ or `GET /repositories/:id <http://developer.github.com/v3/repos>`_
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(full_name_or_id, (str, unicode, int, long)), full_name_or_id
|
||||
url_base = "/repositories/" if isinstance(full_name_or_id, int) or isinstance(full_name_or_id, long) else "/repos/"
|
||||
url = "%s%s" % (url_base, full_name_or_id)
|
||||
if lazy:
|
||||
return Repository.Repository(self.__requester, {}, {"url": url}, completed=False)
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"%s%s" % (url_base, full_name_or_id)
|
||||
)
|
||||
return Repository.Repository(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /repositories <http://developer.github.com/v3/repos/#list-all-public-repositories>`_
|
||||
:param since: integer
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, (int, long)), since
|
||||
url_parameters = dict()
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self.__requester,
|
||||
"/repositories",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_gist(self, id):
|
||||
"""
|
||||
:calls: `GET /gists/:id <http://developer.github.com/v3/gists>`_
|
||||
:param id: string
|
||||
:rtype: :class:`github.Gist.Gist`
|
||||
"""
|
||||
assert isinstance(id, (str, unicode)), id
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/gists/" + id
|
||||
)
|
||||
return github.Gist.Gist(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_gists(self):
|
||||
"""
|
||||
:calls: `GET /gists/public <http://developer.github.com/v3/gists>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self.__requester,
|
||||
"/gists/public",
|
||||
None
|
||||
)
|
||||
|
||||
def legacy_search_repos(self, keyword, language=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /legacy/repos/search/:keyword <http://developer.github.com/v3/search/legacy>`_
|
||||
:param keyword: string
|
||||
:param language: string
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(keyword, (str, unicode)), keyword
|
||||
assert language is github.GithubObject.NotSet or isinstance(language, (str, unicode)), language
|
||||
args = {} if language is github.GithubObject.NotSet else {"language": language}
|
||||
return Legacy.PaginatedList(
|
||||
"/legacy/repos/search/" + urllib.quote_plus(keyword, safe='/%:><'),
|
||||
args,
|
||||
self.__requester,
|
||||
"repositories",
|
||||
Legacy.convertRepo,
|
||||
github.Repository.Repository,
|
||||
)
|
||||
|
||||
def legacy_search_users(self, keyword):
|
||||
"""
|
||||
:calls: `GET /legacy/user/search/:keyword <http://developer.github.com/v3/search/legacy>`_
|
||||
:param keyword: string
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert isinstance(keyword, (str, unicode)), keyword
|
||||
return Legacy.PaginatedList(
|
||||
"/legacy/user/search/" + urllib.quote_plus(keyword, safe='/%:><'),
|
||||
{},
|
||||
self.__requester,
|
||||
"users",
|
||||
Legacy.convertUser,
|
||||
github.NamedUser.NamedUser,
|
||||
)
|
||||
|
||||
def legacy_search_user_by_email(self, email):
|
||||
"""
|
||||
:calls: `GET /legacy/user/email/:email <http://developer.github.com/v3/search/legacy>`_
|
||||
:param email: string
|
||||
:rtype: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert isinstance(email, (str, unicode)), email
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/legacy/user/email/" + email
|
||||
)
|
||||
return github.NamedUser.NamedUser(self.__requester, headers, Legacy.convertUser(data["user"]), completed=False)
|
||||
|
||||
def search_repositories(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers):
|
||||
"""
|
||||
:calls: `GET /search/repositories <http://developer.github.com/v3/search>`_
|
||||
:param query: string
|
||||
:param sort: string ('stars', 'forks', 'updated')
|
||||
:param order: string ('asc', 'desc')
|
||||
:param qualifiers: keyword dict query qualifiers
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(query, (str, unicode)), query
|
||||
url_parameters = dict()
|
||||
if sort is not github.GithubObject.NotSet: # pragma no branch (Should be covered)
|
||||
assert sort in ('stars', 'forks', 'updated'), sort
|
||||
url_parameters["sort"] = sort
|
||||
if order is not github.GithubObject.NotSet: # pragma no branch (Should be covered)
|
||||
assert order in ('asc', 'desc'), order
|
||||
url_parameters["order"] = order
|
||||
|
||||
query_chunks = []
|
||||
if query: # pragma no branch (Should be covered)
|
||||
query_chunks.append(query)
|
||||
|
||||
for qualifier, value in qualifiers.items():
|
||||
query_chunks.append("%s:%s" % (qualifier, value))
|
||||
|
||||
url_parameters["q"] = ' '.join(query_chunks)
|
||||
assert url_parameters["q"], "need at least one qualifier"
|
||||
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self.__requester,
|
||||
"/search/repositories",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def search_users(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers):
|
||||
"""
|
||||
:calls: `GET /search/users <http://developer.github.com/v3/search>`_
|
||||
:param query: string
|
||||
:param sort: string ('followers', 'repositories', 'joined')
|
||||
:param order: string ('asc', 'desc')
|
||||
:param qualifiers: keyword dict query qualifiers
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert isinstance(query, (str, unicode)), query
|
||||
url_parameters = dict()
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
assert sort in ('followers', 'repositories', 'joined'), sort
|
||||
url_parameters["sort"] = sort
|
||||
if order is not github.GithubObject.NotSet:
|
||||
assert order in ('asc', 'desc'), order
|
||||
url_parameters["order"] = order
|
||||
|
||||
query_chunks = []
|
||||
if query:
|
||||
query_chunks.append(query)
|
||||
|
||||
for qualifier, value in qualifiers.items():
|
||||
query_chunks.append("%s:%s" % (qualifier, value))
|
||||
|
||||
url_parameters["q"] = ' '.join(query_chunks)
|
||||
assert url_parameters["q"], "need at least one qualifier"
|
||||
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
"/search/users",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def search_issues(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers):
|
||||
"""
|
||||
:calls: `GET /search/issues <http://developer.github.com/v3/search>`_
|
||||
:param query: string
|
||||
:param sort: string ('comments', 'created', 'updated')
|
||||
:param order: string ('asc', 'desc')
|
||||
:param qualifiers: keyword dict query qualifiers
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
|
||||
"""
|
||||
assert isinstance(query, (str, unicode)), query
|
||||
url_parameters = dict()
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
assert sort in ('comments', 'created', 'updated'), sort
|
||||
url_parameters["sort"] = sort
|
||||
if order is not github.GithubObject.NotSet:
|
||||
assert order in ('asc', 'desc'), order
|
||||
url_parameters["order"] = order
|
||||
|
||||
query_chunks = []
|
||||
if query: # pragma no branch (Should be covered)
|
||||
query_chunks.append(query)
|
||||
|
||||
for qualifier, value in qualifiers.items():
|
||||
query_chunks.append("%s:%s" % (qualifier, value))
|
||||
|
||||
url_parameters["q"] = ' '.join(query_chunks)
|
||||
assert url_parameters["q"], "need at least one qualifier"
|
||||
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Issue.Issue,
|
||||
self.__requester,
|
||||
"/search/issues",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def search_code(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers):
|
||||
"""
|
||||
:calls: `GET /search/code <http://developer.github.com/v3/search>`_
|
||||
:param query: string
|
||||
:param sort: string ('indexed')
|
||||
:param order: string ('asc', 'desc')
|
||||
:param qualifiers: keyword dict query qualifiers
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.ContentFile.ContentFile`
|
||||
"""
|
||||
assert isinstance(query, (str, unicode)), query
|
||||
url_parameters = dict()
|
||||
if sort is not github.GithubObject.NotSet: # pragma no branch (Should be covered)
|
||||
assert sort in ('indexed',), sort
|
||||
url_parameters["sort"] = sort
|
||||
if order is not github.GithubObject.NotSet: # pragma no branch (Should be covered)
|
||||
assert order in ('asc', 'desc'), order
|
||||
url_parameters["order"] = order
|
||||
|
||||
query_chunks = []
|
||||
if query: # pragma no branch (Should be covered)
|
||||
query_chunks.append(query)
|
||||
|
||||
for qualifier, value in qualifiers.items():
|
||||
query_chunks.append("%s:%s" % (qualifier, value))
|
||||
|
||||
url_parameters["q"] = ' '.join(query_chunks)
|
||||
assert url_parameters["q"], "need at least one qualifier"
|
||||
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.ContentFile.ContentFile,
|
||||
self.__requester,
|
||||
"/search/code",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def render_markdown(self, text, context=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /markdown <http://developer.github.com/v3/markdown>`_
|
||||
:param text: string
|
||||
:param context: :class:`github.Repository.Repository`
|
||||
:rtype: string
|
||||
"""
|
||||
assert isinstance(text, (str, unicode)), text
|
||||
assert context is github.GithubObject.NotSet or isinstance(context, github.Repository.Repository), context
|
||||
post_parameters = {
|
||||
"text": text
|
||||
}
|
||||
if context is not github.GithubObject.NotSet:
|
||||
post_parameters["mode"] = "gfm"
|
||||
post_parameters["context"] = context._identity
|
||||
status, headers, data = self.__requester.requestJson(
|
||||
"POST",
|
||||
"/markdown",
|
||||
input=post_parameters
|
||||
)
|
||||
return data
|
||||
|
||||
def get_hook(self, name):
|
||||
"""
|
||||
:calls: `GET /hooks/:name <http://developer.github.com/v3/repos/hooks/>`_
|
||||
:param name: string
|
||||
:rtype: :class:`github.HookDescription.HookDescription`
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
headers, attributes = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/hooks/" + name
|
||||
)
|
||||
return HookDescription.HookDescription(self.__requester, headers, attributes, completed=True)
|
||||
|
||||
def get_hooks(self):
|
||||
"""
|
||||
:calls: `GET /hooks <http://developer.github.com/v3/repos/hooks/>`_
|
||||
:rtype: list of :class:`github.HookDescription.HookDescription`
|
||||
"""
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/hooks"
|
||||
)
|
||||
return [HookDescription.HookDescription(self.__requester, headers, attributes, completed=True) for attributes in data]
|
||||
|
||||
def get_gitignore_templates(self):
|
||||
"""
|
||||
:calls: `GET /gitignore/templates <http://developer.github.com/v3/gitignore>`_
|
||||
:rtype: list of string
|
||||
"""
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/gitignore/templates"
|
||||
)
|
||||
return data
|
||||
|
||||
def get_gitignore_template(self, name):
|
||||
"""
|
||||
:calls: `GET /gitignore/templates/:name <http://developer.github.com/v3/gitignore>`_
|
||||
:rtype: :class:`github.GitignoreTemplate.GitignoreTemplate`
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
headers, attributes = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/gitignore/templates/" + name
|
||||
)
|
||||
return GitignoreTemplate.GitignoreTemplate(self.__requester, headers, attributes, completed=True)
|
||||
|
||||
def get_emojis(self):
|
||||
"""
|
||||
:calls: `GET /emojis <http://developer.github.com/v3/emojis/>`_
|
||||
:rtype: dictionary of type => url for emoji`
|
||||
"""
|
||||
headers, attributes = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/emojis"
|
||||
)
|
||||
return attributes
|
||||
|
||||
def create_from_raw_data(self, klass, raw_data, headers={}):
|
||||
"""
|
||||
Creates an object from raw_data previously obtained by :attr:`github.GithubObject.GithubObject.raw_data`,
|
||||
and optionaly headers previously obtained by :attr:`github.GithubObject.GithubObject.raw_headers`.
|
||||
|
||||
:param klass: the class of the object to create
|
||||
:param raw_data: dict
|
||||
:param headers: dict
|
||||
:rtype: instance of class ``klass``
|
||||
"""
|
||||
return klass(self.__requester, headers, raw_data, completed=True)
|
||||
|
||||
def dump(self, obj, file, protocol=0):
|
||||
"""
|
||||
Dumps (pickles) a PyGithub object to a file-like object.
|
||||
Some effort is made to not pickle sensitive informations like the Github credentials used in the :class:`Github` instance.
|
||||
But NO EFFORT is made to remove sensitive information from the object's attributes.
|
||||
|
||||
:param obj: the object to pickle
|
||||
:param file: the file-like object to pickle to
|
||||
:param protocol: the `pickling protocol <http://docs.python.org/2.7/library/pickle.html#data-stream-format>`_
|
||||
"""
|
||||
pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol)
|
||||
|
||||
def load(self, f):
|
||||
"""
|
||||
Loads (unpickles) a PyGithub object from a file-like object.
|
||||
|
||||
:param f: the file-like object to unpickle from
|
||||
:return: the unpickled object
|
||||
"""
|
||||
return self.create_from_raw_data(*pickle.load(f))
|
||||
|
||||
def get_api_status(self):
|
||||
"""
|
||||
This doesn't work with a Github Enterprise installation, because it always targets https://status.github.com.
|
||||
|
||||
:calls: `GET /api/status.json <https://status.github.com/api>`_
|
||||
:rtype: :class:`github.Status.Status`
|
||||
"""
|
||||
headers, attributes = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/api/status.json",
|
||||
cnx="status"
|
||||
)
|
||||
return Status.Status(self.__requester, headers, attributes, completed=True)
|
||||
|
||||
def get_last_api_status_message(self):
|
||||
"""
|
||||
This doesn't work with a Github Enterprise installation, because it always targets https://status.github.com.
|
||||
|
||||
:calls: `GET /api/last-message.json <https://status.github.com/api>`_
|
||||
:rtype: :class:`github.StatusMessage.StatusMessage`
|
||||
"""
|
||||
headers, attributes = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/api/last-message.json",
|
||||
cnx="status"
|
||||
)
|
||||
return StatusMessage.StatusMessage(self.__requester, headers, attributes, completed=True)
|
||||
|
||||
def get_api_status_messages(self):
|
||||
"""
|
||||
This doesn't work with a Github Enterprise installation, because it always targets https://status.github.com.
|
||||
|
||||
:calls: `GET /api/messages.json <https://status.github.com/api>`_
|
||||
:rtype: list of :class:`github.StatusMessage.StatusMessage`
|
||||
"""
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/api/messages.json",
|
||||
cnx="status"
|
||||
)
|
||||
return [StatusMessage.StatusMessage(self.__requester, headers, attributes, completed=True) for attributes in data]
|
||||
242
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Milestone.py
vendored
Normal file
242
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Milestone.py
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.NamedUser
|
||||
import github.Label
|
||||
|
||||
|
||||
class Milestone(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Milestones. The reference can be found here http://developer.github.com/v3/issues/milestones/
|
||||
"""
|
||||
|
||||
@property
|
||||
def closed_issues(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._closed_issues)
|
||||
return self._closed_issues.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def creator(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._creator)
|
||||
return self._creator.value
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._description)
|
||||
return self._description.value
|
||||
|
||||
@property
|
||||
def due_on(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._due_on)
|
||||
return self._due_on.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def labels_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._labels_url)
|
||||
return self._labels_url.value
|
||||
|
||||
@property
|
||||
def number(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._number)
|
||||
return self._number.value
|
||||
|
||||
@property
|
||||
def open_issues(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._open_issues)
|
||||
return self._open_issues.value
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._state)
|
||||
return self._state.value
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._title)
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/milestones/:number <http://developer.github.com/v3/issues/milestones>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/milestones/:number <http://developer.github.com/v3/issues/milestones>`_
|
||||
:param title: string
|
||||
:param state: string
|
||||
:param description: string
|
||||
:param due_on: date
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on
|
||||
post_parameters = {
|
||||
"title": title,
|
||||
}
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if due_on is not github.GithubObject.NotSet:
|
||||
post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_labels(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/milestones/:number/labels <http://developer.github.com/v3/issues/labels>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Label.Label`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Label.Label,
|
||||
self._requester,
|
||||
self.url + "/labels",
|
||||
None
|
||||
)
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.number
|
||||
|
||||
def _initAttributes(self):
|
||||
self._closed_issues = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._creator = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._due_on = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._labels_url = github.GithubObject.NotSet
|
||||
self._number = github.GithubObject.NotSet
|
||||
self._open_issues = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "closed_issues" in attributes: # pragma no branch
|
||||
self._closed_issues = self._makeIntAttribute(attributes["closed_issues"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "creator" in attributes: # pragma no branch
|
||||
self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
|
||||
if "description" in attributes: # pragma no branch
|
||||
self._description = self._makeStringAttribute(attributes["description"])
|
||||
if "due_on" in attributes: # pragma no branch
|
||||
self._due_on = self._makeDatetimeAttribute(attributes["due_on"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "labels_url" in attributes: # pragma no branch
|
||||
self._labels_url = self._makeStringAttribute(attributes["labels_url"])
|
||||
if "number" in attributes: # pragma no branch
|
||||
self._number = self._makeIntAttribute(attributes["number"])
|
||||
if "open_issues" in attributes: # pragma no branch
|
||||
self._open_issues = self._makeIntAttribute(attributes["open_issues"])
|
||||
if "state" in attributes: # pragma no branch
|
||||
self._state = self._makeStringAttribute(attributes["state"])
|
||||
if "title" in attributes: # pragma no branch
|
||||
self._title = self._makeStringAttribute(attributes["title"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
633
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/NamedUser.py
vendored
Normal file
633
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/NamedUser.py
vendored
Normal file
@@ -0,0 +1,633 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.Gist
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
import github.Plan
|
||||
import github.Organization
|
||||
import github.Event
|
||||
|
||||
|
||||
class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents NamedUsers as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def avatar_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._avatar_url)
|
||||
return self._avatar_url.value
|
||||
|
||||
@property
|
||||
def bio(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._bio)
|
||||
return self._bio.value
|
||||
|
||||
@property
|
||||
def blog(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._blog)
|
||||
return self._blog.value
|
||||
|
||||
@property
|
||||
def collaborators(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._collaborators)
|
||||
return self._collaborators.value
|
||||
|
||||
@property
|
||||
def company(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._company)
|
||||
return self._company.value
|
||||
|
||||
@property
|
||||
def contributions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._contributions)
|
||||
return self._contributions.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def disk_usage(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._disk_usage)
|
||||
return self._disk_usage.value
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._email)
|
||||
return self._email.value
|
||||
|
||||
@property
|
||||
def events_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._events_url)
|
||||
return self._events_url.value
|
||||
|
||||
@property
|
||||
def followers(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._followers)
|
||||
return self._followers.value
|
||||
|
||||
@property
|
||||
def followers_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._followers_url)
|
||||
return self._followers_url.value
|
||||
|
||||
@property
|
||||
def following(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._following)
|
||||
return self._following.value
|
||||
|
||||
@property
|
||||
def following_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._following_url)
|
||||
return self._following_url.value
|
||||
|
||||
@property
|
||||
def gists_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._gists_url)
|
||||
return self._gists_url.value
|
||||
|
||||
@property
|
||||
def gravatar_id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._gravatar_id)
|
||||
return self._gravatar_id.value
|
||||
|
||||
@property
|
||||
def hireable(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._hireable)
|
||||
return self._hireable.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def location(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._location)
|
||||
return self._location.value
|
||||
|
||||
@property
|
||||
def login(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._login)
|
||||
return self._login.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def organizations_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._organizations_url)
|
||||
return self._organizations_url.value
|
||||
|
||||
@property
|
||||
def owned_private_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._owned_private_repos)
|
||||
return self._owned_private_repos.value
|
||||
|
||||
@property
|
||||
def plan(self):
|
||||
"""
|
||||
:type: :class:`github.Plan.Plan`
|
||||
"""
|
||||
self._completeIfNotSet(self._plan)
|
||||
return self._plan.value
|
||||
|
||||
@property
|
||||
def private_gists(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._private_gists)
|
||||
return self._private_gists.value
|
||||
|
||||
@property
|
||||
def public_gists(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._public_gists)
|
||||
return self._public_gists.value
|
||||
|
||||
@property
|
||||
def public_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._public_repos)
|
||||
return self._public_repos.value
|
||||
|
||||
@property
|
||||
def received_events_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._received_events_url)
|
||||
return self._received_events_url.value
|
||||
|
||||
@property
|
||||
def repos_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._repos_url)
|
||||
return self._repos_url.value
|
||||
|
||||
@property
|
||||
def starred_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._starred_url)
|
||||
return self._starred_url.value
|
||||
|
||||
@property
|
||||
def subscriptions_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._subscriptions_url)
|
||||
return self._subscriptions_url.value
|
||||
|
||||
@property
|
||||
def total_private_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._total_private_repos)
|
||||
return self._total_private_repos.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._type)
|
||||
return self._type.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def get_events(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/events <http://developer.github.com/v3/activity/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_followers(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/followers <http://developer.github.com/v3/users/followers>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self._requester,
|
||||
self.url + "/followers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_following(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/following <http://developer.github.com/v3/users/followers>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self._requester,
|
||||
self.url + "/following",
|
||||
None
|
||||
)
|
||||
|
||||
def get_gists(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/gists <http://developer.github.com/v3/gists>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self._requester,
|
||||
self.url + "/gists",
|
||||
None
|
||||
)
|
||||
|
||||
def get_keys(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/keys <http://developer.github.com/v3/users/keys>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.UserKey.UserKey`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.UserKey.UserKey,
|
||||
self._requester,
|
||||
self.url + "/keys",
|
||||
None
|
||||
)
|
||||
|
||||
def get_orgs(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/orgs <http://developer.github.com/v3/orgs>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Organization.Organization,
|
||||
self._requester,
|
||||
self.url + "/orgs",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_events(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/events/public <http://developer.github.com/v3/activity/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events/public",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_received_events(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/received_events/public <http://developer.github.com/v3/activity/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/received_events/public",
|
||||
None
|
||||
)
|
||||
|
||||
def get_received_events(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/received_events <http://developer.github.com/v3/activity/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/received_events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repo(self, name):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
|
||||
:param name: string
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/repos/" + self.login + "/" + name
|
||||
)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users/:user/repos <http://developer.github.com/v3/repos>`_
|
||||
:param type: string
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
url_parameters = dict()
|
||||
if type is not github.GithubObject.NotSet:
|
||||
url_parameters["type"] = type
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_starred(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/starred <http://developer.github.com/v3/activity/starring>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscriptions(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/subscriptions <http://developer.github.com/v3/activity/watching>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/subscriptions",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watched(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/watched <http://developer.github.com/v3/activity/starring>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/watched",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_following(self, following):
|
||||
"""
|
||||
:calls: `GET /users/:user/following/:target_user <http://developer.github.com/v3/users/followers/#check-if-one-user-follows-another>`_
|
||||
:param following: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(following, github.NamedUser.NamedUser), following
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/following/" + following._identity
|
||||
)
|
||||
return status == 204
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.login
|
||||
|
||||
def _initAttributes(self):
|
||||
self._avatar_url = github.GithubObject.NotSet
|
||||
self._bio = github.GithubObject.NotSet
|
||||
self._blog = github.GithubObject.NotSet
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._company = github.GithubObject.NotSet
|
||||
self._contributions = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._disk_usage = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._events_url = github.GithubObject.NotSet
|
||||
self._followers = github.GithubObject.NotSet
|
||||
self._followers_url = github.GithubObject.NotSet
|
||||
self._following = github.GithubObject.NotSet
|
||||
self._following_url = github.GithubObject.NotSet
|
||||
self._gists_url = github.GithubObject.NotSet
|
||||
self._gravatar_id = github.GithubObject.NotSet
|
||||
self._hireable = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._location = github.GithubObject.NotSet
|
||||
self._login = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._organizations_url = github.GithubObject.NotSet
|
||||
self._owned_private_repos = github.GithubObject.NotSet
|
||||
self._plan = github.GithubObject.NotSet
|
||||
self._private_gists = github.GithubObject.NotSet
|
||||
self._public_gists = github.GithubObject.NotSet
|
||||
self._public_repos = github.GithubObject.NotSet
|
||||
self._received_events_url = github.GithubObject.NotSet
|
||||
self._repos_url = github.GithubObject.NotSet
|
||||
self._starred_url = github.GithubObject.NotSet
|
||||
self._subscriptions_url = github.GithubObject.NotSet
|
||||
self._total_private_repos = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "avatar_url" in attributes: # pragma no branch
|
||||
self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
|
||||
if "bio" in attributes: # pragma no branch
|
||||
self._bio = self._makeStringAttribute(attributes["bio"])
|
||||
if "blog" in attributes: # pragma no branch
|
||||
self._blog = self._makeStringAttribute(attributes["blog"])
|
||||
if "collaborators" in attributes: # pragma no branch
|
||||
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
|
||||
if "company" in attributes: # pragma no branch
|
||||
self._company = self._makeStringAttribute(attributes["company"])
|
||||
if "contributions" in attributes: # pragma no branch
|
||||
self._contributions = self._makeIntAttribute(attributes["contributions"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "disk_usage" in attributes: # pragma no branch
|
||||
self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
|
||||
if "email" in attributes: # pragma no branch
|
||||
self._email = self._makeStringAttribute(attributes["email"])
|
||||
if "events_url" in attributes: # pragma no branch
|
||||
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
||||
if "followers" in attributes: # pragma no branch
|
||||
self._followers = self._makeIntAttribute(attributes["followers"])
|
||||
if "followers_url" in attributes: # pragma no branch
|
||||
self._followers_url = self._makeStringAttribute(attributes["followers_url"])
|
||||
if "following" in attributes: # pragma no branch
|
||||
self._following = self._makeIntAttribute(attributes["following"])
|
||||
if "following_url" in attributes: # pragma no branch
|
||||
self._following_url = self._makeStringAttribute(attributes["following_url"])
|
||||
if "gists_url" in attributes: # pragma no branch
|
||||
self._gists_url = self._makeStringAttribute(attributes["gists_url"])
|
||||
if "gravatar_id" in attributes: # pragma no branch
|
||||
self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
|
||||
if "hireable" in attributes: # pragma no branch
|
||||
self._hireable = self._makeBoolAttribute(attributes["hireable"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "location" in attributes: # pragma no branch
|
||||
self._location = self._makeStringAttribute(attributes["location"])
|
||||
if "login" in attributes: # pragma no branch
|
||||
self._login = self._makeStringAttribute(attributes["login"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "organizations_url" in attributes: # pragma no branch
|
||||
self._organizations_url = self._makeStringAttribute(attributes["organizations_url"])
|
||||
if "owned_private_repos" in attributes: # pragma no branch
|
||||
self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
|
||||
if "plan" in attributes: # pragma no branch
|
||||
self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
self._private_gists = self._makeIntAttribute(attributes["private_gists"])
|
||||
if "public_gists" in attributes: # pragma no branch
|
||||
self._public_gists = self._makeIntAttribute(attributes["public_gists"])
|
||||
if "public_repos" in attributes: # pragma no branch
|
||||
self._public_repos = self._makeIntAttribute(attributes["public_repos"])
|
||||
if "received_events_url" in attributes: # pragma no branch
|
||||
self._received_events_url = self._makeStringAttribute(attributes["received_events_url"])
|
||||
if "repos_url" in attributes: # pragma no branch
|
||||
self._repos_url = self._makeStringAttribute(attributes["repos_url"])
|
||||
if "starred_url" in attributes: # pragma no branch
|
||||
self._starred_url = self._makeStringAttribute(attributes["starred_url"])
|
||||
if "subscriptions_url" in attributes: # pragma no branch
|
||||
self._subscriptions_url = self._makeStringAttribute(attributes["subscriptions_url"])
|
||||
if "total_private_repos" in attributes: # pragma no branch
|
||||
self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
138
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Notification.py
vendored
Normal file
138
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Notification.py
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Peter Golm <golm.peter@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Repository
|
||||
import github.NotificationSubject
|
||||
|
||||
|
||||
class Notification(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Notifications. The reference can be found here http://developer.github.com/v3/activity/notifications/
|
||||
"""
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def last_read_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._last_read_at)
|
||||
return self._last_read_at.value
|
||||
|
||||
@property
|
||||
def repository(self):
|
||||
"""
|
||||
:type: :class:`github.Repository.Repository`
|
||||
"""
|
||||
self._completeIfNotSet(self._repository)
|
||||
return self._repository.value
|
||||
|
||||
@property
|
||||
def subject(self):
|
||||
"""
|
||||
:type: :class:`github.NotificationSubject.NotificationSubject`
|
||||
"""
|
||||
self._completeIfNotSet(self._subject)
|
||||
return self._subject.value
|
||||
|
||||
@property
|
||||
def reason(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._reason)
|
||||
return self._reason.value
|
||||
|
||||
@property
|
||||
def subscription_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._subscription_url)
|
||||
return self._subscription_url.value
|
||||
|
||||
@property
|
||||
def unread(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._unread)
|
||||
return self._unread.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._last_read_at = github.GithubObject.NotSet
|
||||
self._repository = github.GithubObject.NotSet
|
||||
self._reason = github.GithubObject.NotSet
|
||||
self._subscription_url = github.GithubObject.NotSet
|
||||
self._unread = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeStringAttribute(attributes["id"])
|
||||
if "last_read_at" in attributes: # pragma no branch
|
||||
self._last_read_at = self._makeDatetimeAttribute(attributes["last_read_at"])
|
||||
if "repository" in attributes: # pragma no branch
|
||||
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
|
||||
if "subject" in attributes: # pragma no branch
|
||||
self._subject = self._makeClassAttribute(github.NotificationSubject.NotificationSubject, attributes["subject"])
|
||||
if "reason" in attributes: # pragma no branch
|
||||
self._reason = self._makeStringAttribute(attributes["reason"])
|
||||
if "subscription_url" in attributes: # pragma no branch
|
||||
self._subscription_url = self._makeStringAttribute(attributes["subscription_url"])
|
||||
if "unread" in attributes: # pragma no branch
|
||||
self._unread = self._makeBoolAttribute(attributes["unread"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
75
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/NotificationSubject.py
vendored
Normal file
75
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/NotificationSubject.py
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class NotificationSubject(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Subjects of Notifications as returned for example by http://developer.github.com/v3/activity/notifications/#list-your-notifications
|
||||
"""
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def latest_comment_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._latest_comment_url.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._type.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._latest_comment_url = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "title" in attributes: # pragma no branch
|
||||
self._title = self._makeStringAttribute(attributes["title"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "latest_comment_url" in attributes: # pragma no branch
|
||||
self._latest_comment_url = self._makeStringAttribute(attributes["latest_comment_url"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
703
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Organization.py
vendored
Normal file
703
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Organization.py
vendored
Normal file
@@ -0,0 +1,703 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.Plan
|
||||
import github.Team
|
||||
import github.Event
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class Organization(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Organizations. The reference can be found here http://developer.github.com/v3/orgs/
|
||||
"""
|
||||
|
||||
@property
|
||||
def avatar_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._avatar_url)
|
||||
return self._avatar_url.value
|
||||
|
||||
@property
|
||||
def billing_email(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._billing_email)
|
||||
return self._billing_email.value
|
||||
|
||||
@property
|
||||
def blog(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._blog)
|
||||
return self._blog.value
|
||||
|
||||
@property
|
||||
def collaborators(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._collaborators)
|
||||
return self._collaborators.value
|
||||
|
||||
@property
|
||||
def company(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._company)
|
||||
return self._company.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def disk_usage(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._disk_usage)
|
||||
return self._disk_usage.value
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._email)
|
||||
return self._email.value
|
||||
|
||||
@property
|
||||
def events_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._events_url)
|
||||
return self._events_url.value
|
||||
|
||||
@property
|
||||
def followers(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._followers)
|
||||
return self._followers.value
|
||||
|
||||
@property
|
||||
def following(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._following)
|
||||
return self._following.value
|
||||
|
||||
@property
|
||||
def gravatar_id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._gravatar_id)
|
||||
return self._gravatar_id.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def location(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._location)
|
||||
return self._location.value
|
||||
|
||||
@property
|
||||
def login(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._login)
|
||||
return self._login.value
|
||||
|
||||
@property
|
||||
def members_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._members_url)
|
||||
return self._members_url.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def owned_private_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._owned_private_repos)
|
||||
return self._owned_private_repos.value
|
||||
|
||||
@property
|
||||
def plan(self):
|
||||
"""
|
||||
:type: :class:`github.Plan.Plan`
|
||||
"""
|
||||
self._completeIfNotSet(self._plan)
|
||||
return self._plan.value
|
||||
|
||||
@property
|
||||
def private_gists(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._private_gists)
|
||||
return self._private_gists.value
|
||||
|
||||
@property
|
||||
def public_gists(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._public_gists)
|
||||
return self._public_gists.value
|
||||
|
||||
@property
|
||||
def public_members_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._public_members_url)
|
||||
return self._public_members_url.value
|
||||
|
||||
@property
|
||||
def public_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._public_repos)
|
||||
return self._public_repos.value
|
||||
|
||||
@property
|
||||
def repos_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._repos_url)
|
||||
return self._repos_url.value
|
||||
|
||||
@property
|
||||
def total_private_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._total_private_repos)
|
||||
return self._total_private_repos.value
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._type)
|
||||
return self._type.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def add_to_public_members(self, public_member):
|
||||
"""
|
||||
:calls: `PUT /orgs/:org/public_members/:user <http://developer.github.com/v3/orgs/members>`_
|
||||
:param public_member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PUT",
|
||||
self.url + "/public_members/" + public_member._identity
|
||||
)
|
||||
|
||||
def create_fork(self, repo):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/forks <http://developer.github.com/v3/repos/forks>`_
|
||||
:param repo: :class:`github.Repository.Repository`
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
url_parameters = {
|
||||
"org": self.login,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
"/repos/" + repo.owner.login + "/" + repo.name + "/forks",
|
||||
parameters=url_parameters
|
||||
)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
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):
|
||||
"""
|
||||
:calls: `POST /orgs/:org/repos <http://developer.github.com/v3/repos>`_
|
||||
:param name: string
|
||||
:param description: string
|
||||
:param homepage: string
|
||||
:param private: bool
|
||||
:param has_issues: bool
|
||||
:param has_wiki: bool
|
||||
:param has_downloads: bool
|
||||
:param team_id: :class:`github.Team.Team`
|
||||
:param auto_init: bool
|
||||
:param gitignore_template: string
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert private is github.GithubObject.NotSet or isinstance(private, bool), private
|
||||
assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert team_id is github.GithubObject.NotSet or isinstance(team_id, github.Team.Team), team_id
|
||||
assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init
|
||||
assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if homepage is not github.GithubObject.NotSet:
|
||||
post_parameters["homepage"] = homepage
|
||||
if private is not github.GithubObject.NotSet:
|
||||
post_parameters["private"] = private
|
||||
if has_issues is not github.GithubObject.NotSet:
|
||||
post_parameters["has_issues"] = has_issues
|
||||
if has_wiki is not github.GithubObject.NotSet:
|
||||
post_parameters["has_wiki"] = has_wiki
|
||||
if has_downloads is not github.GithubObject.NotSet:
|
||||
post_parameters["has_downloads"] = has_downloads
|
||||
if team_id is not github.GithubObject.NotSet:
|
||||
post_parameters["team_id"] = team_id._identity
|
||||
if auto_init is not github.GithubObject.NotSet:
|
||||
post_parameters["auto_init"] = auto_init
|
||||
if gitignore_template is not github.GithubObject.NotSet:
|
||||
post_parameters["gitignore_template"] = gitignore_template
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/repos",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /orgs/:org/teams <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param name: string
|
||||
:param repo_names: list of :class:`github.Repository.Repository`
|
||||
:param permission: string
|
||||
:rtype: :class:`github.Team.Team`
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert repo_names is github.GithubObject.NotSet or all(isinstance(element, github.Repository.Repository) for element in repo_names), repo_names
|
||||
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if repo_names is not github.GithubObject.NotSet:
|
||||
post_parameters["repo_names"] = [element._identity for element in repo_names]
|
||||
if permission is not github.GithubObject.NotSet:
|
||||
post_parameters["permission"] = permission
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/teams",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.Team.Team(self._requester, headers, data, completed=True)
|
||||
|
||||
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):
|
||||
"""
|
||||
:calls: `PATCH /orgs/:org <http://developer.github.com/v3/orgs>`_
|
||||
:param billing_email: string
|
||||
:param blog: string
|
||||
:param company: string
|
||||
:param email: string
|
||||
:param location: string
|
||||
:param name: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert billing_email is github.GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email
|
||||
assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
|
||||
assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company
|
||||
assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email
|
||||
assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location
|
||||
assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name
|
||||
post_parameters = dict()
|
||||
if billing_email is not github.GithubObject.NotSet:
|
||||
post_parameters["billing_email"] = billing_email
|
||||
if blog is not github.GithubObject.NotSet:
|
||||
post_parameters["blog"] = blog
|
||||
if company is not github.GithubObject.NotSet:
|
||||
post_parameters["company"] = company
|
||||
if email is not github.GithubObject.NotSet:
|
||||
post_parameters["email"] = email
|
||||
if location is not github.GithubObject.NotSet:
|
||||
post_parameters["location"] = location
|
||||
if name is not github.GithubObject.NotSet:
|
||||
post_parameters["name"] = name
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_events(self):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/events <http://developer.github.com/v3/activity/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
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):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/issues <http://developer.github.com/v3/issues>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
|
||||
:param filter: string
|
||||
:param state: string
|
||||
:param labels: list of :class:`github.Label.Label`
|
||||
:param sort: string
|
||||
:param direction: string
|
||||
:param since: datetime.datetime
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
|
||||
"""
|
||||
assert filter is github.GithubObject.NotSet or isinstance(filter, (str, unicode)), filter
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels
|
||||
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
|
||||
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
|
||||
url_parameters = dict()
|
||||
if filter is not github.GithubObject.NotSet:
|
||||
url_parameters["filter"] = filter
|
||||
if state is not github.GithubObject.NotSet:
|
||||
url_parameters["state"] = state
|
||||
if labels is not github.GithubObject.NotSet:
|
||||
url_parameters["labels"] = ",".join(label.name for label in labels)
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
url_parameters["sort"] = sort
|
||||
if direction is not github.GithubObject.NotSet:
|
||||
url_parameters["direction"] = direction
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Issue.Issue,
|
||||
self._requester,
|
||||
self.url + "/issues",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_members(self, filter_=github.GithubObject.NotSet,
|
||||
role=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/members <http://developer.github.com/v3/orgs/members>`_
|
||||
:param filter_: string
|
||||
:param role: string
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert (filter_ is github.GithubObject.NotSet or
|
||||
isinstance(filter_, (str, unicode))), filter_
|
||||
assert (role is github.GithubObject.NotSet or
|
||||
isinstance(role, (str, unicode))), role
|
||||
|
||||
url_parameters = {}
|
||||
if filter_ is not github.GithubObject.NotSet:
|
||||
url_parameters["filter"] = filter_
|
||||
if role is not github.GithubObject.NotSet:
|
||||
url_parameters["role"] = role
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/members",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_public_members(self):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/public_members <http://developer.github.com/v3/orgs/members>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/public_members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repo(self, name):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
|
||||
:param name: string
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/repos/" + self.login + "/" + name
|
||||
)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/repos <http://developer.github.com/v3/repos>`_
|
||||
:param type: string
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
url_parameters = dict()
|
||||
if type is not github.GithubObject.NotSet:
|
||||
url_parameters["type"] = type
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_team(self, id):
|
||||
"""
|
||||
:calls: `GET /teams/:id <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param id: integer
|
||||
:rtype: :class:`github.Team.Team`
|
||||
"""
|
||||
assert isinstance(id, (int, long)), id
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/teams/" + str(id)
|
||||
)
|
||||
return github.Team.Team(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_teams(self):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/teams <http://developer.github.com/v3/orgs/teams>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Team.Team,
|
||||
self._requester,
|
||||
self.url + "/teams",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_members(self, member):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/members/:user <http://developer.github.com/v3/orgs/members>`_
|
||||
:param member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/members/" + member._identity
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def has_in_public_members(self, public_member):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/public_members/:user <http://developer.github.com/v3/orgs/members>`_
|
||||
:param public_member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/public_members/" + public_member._identity
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def remove_from_members(self, member):
|
||||
"""
|
||||
:calls: `DELETE /orgs/:org/members/:user <http://developer.github.com/v3/orgs/members>`_
|
||||
:param member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/members/" + member._identity
|
||||
)
|
||||
|
||||
def remove_from_public_members(self, public_member):
|
||||
"""
|
||||
:calls: `DELETE /orgs/:org/public_members/:user <http://developer.github.com/v3/orgs/members>`_
|
||||
:param public_member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/public_members/" + public_member._identity
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._avatar_url = github.GithubObject.NotSet
|
||||
self._billing_email = github.GithubObject.NotSet
|
||||
self._blog = github.GithubObject.NotSet
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._company = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._disk_usage = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._events_url = github.GithubObject.NotSet
|
||||
self._followers = github.GithubObject.NotSet
|
||||
self._following = github.GithubObject.NotSet
|
||||
self._gravatar_id = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._location = github.GithubObject.NotSet
|
||||
self._login = github.GithubObject.NotSet
|
||||
self._members_url = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._owned_private_repos = github.GithubObject.NotSet
|
||||
self._plan = github.GithubObject.NotSet
|
||||
self._private_gists = github.GithubObject.NotSet
|
||||
self._public_gists = github.GithubObject.NotSet
|
||||
self._public_members_url = github.GithubObject.NotSet
|
||||
self._public_repos = github.GithubObject.NotSet
|
||||
self._repos_url = github.GithubObject.NotSet
|
||||
self._total_private_repos = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "avatar_url" in attributes: # pragma no branch
|
||||
self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
|
||||
if "billing_email" in attributes: # pragma no branch
|
||||
self._billing_email = self._makeStringAttribute(attributes["billing_email"])
|
||||
if "blog" in attributes: # pragma no branch
|
||||
self._blog = self._makeStringAttribute(attributes["blog"])
|
||||
if "collaborators" in attributes: # pragma no branch
|
||||
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
|
||||
if "company" in attributes: # pragma no branch
|
||||
self._company = self._makeStringAttribute(attributes["company"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "disk_usage" in attributes: # pragma no branch
|
||||
self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
|
||||
if "email" in attributes: # pragma no branch
|
||||
self._email = self._makeStringAttribute(attributes["email"])
|
||||
if "events_url" in attributes: # pragma no branch
|
||||
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
||||
if "followers" in attributes: # pragma no branch
|
||||
self._followers = self._makeIntAttribute(attributes["followers"])
|
||||
if "following" in attributes: # pragma no branch
|
||||
self._following = self._makeIntAttribute(attributes["following"])
|
||||
if "gravatar_id" in attributes: # pragma no branch
|
||||
self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "location" in attributes: # pragma no branch
|
||||
self._location = self._makeStringAttribute(attributes["location"])
|
||||
if "login" in attributes: # pragma no branch
|
||||
self._login = self._makeStringAttribute(attributes["login"])
|
||||
if "members_url" in attributes: # pragma no branch
|
||||
self._members_url = self._makeStringAttribute(attributes["members_url"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "owned_private_repos" in attributes: # pragma no branch
|
||||
self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
|
||||
if "plan" in attributes: # pragma no branch
|
||||
self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
self._private_gists = self._makeIntAttribute(attributes["private_gists"])
|
||||
if "public_gists" in attributes: # pragma no branch
|
||||
self._public_gists = self._makeIntAttribute(attributes["public_gists"])
|
||||
if "public_members_url" in attributes: # pragma no branch
|
||||
self._public_members_url = self._makeStringAttribute(attributes["public_members_url"])
|
||||
if "public_repos" in attributes: # pragma no branch
|
||||
self._public_repos = self._makeIntAttribute(attributes["public_repos"])
|
||||
if "repos_url" in attributes: # pragma no branch
|
||||
self._repos_url = self._makeStringAttribute(attributes["repos_url"])
|
||||
if "total_private_repos" in attributes: # pragma no branch
|
||||
self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
|
||||
if "type" in attributes: # pragma no branch
|
||||
self._type = self._makeStringAttribute(attributes["type"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
218
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PaginatedList.py
vendored
Normal file
218
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PaginatedList.py
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Bill Mill <bill.mill@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 davidbrai <davidbrai@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class PaginatedListBase:
|
||||
def __init__(self):
|
||||
self.__elements = list()
|
||||
|
||||
def __getitem__(self, index):
|
||||
assert isinstance(index, (int, slice))
|
||||
if isinstance(index, (int, long)):
|
||||
self.__fetchToIndex(index)
|
||||
return self.__elements[index]
|
||||
else:
|
||||
return self._Slice(self, index)
|
||||
|
||||
def __iter__(self):
|
||||
for element in self.__elements:
|
||||
yield element
|
||||
while self._couldGrow():
|
||||
newElements = self._grow()
|
||||
for element in newElements:
|
||||
yield element
|
||||
|
||||
def _isBiggerThan(self, index):
|
||||
return len(self.__elements) > index or self._couldGrow()
|
||||
|
||||
def __fetchToIndex(self, index):
|
||||
while len(self.__elements) <= index and self._couldGrow():
|
||||
self._grow()
|
||||
|
||||
def _grow(self):
|
||||
newElements = self._fetchNextPage()
|
||||
self.__elements += newElements
|
||||
return newElements
|
||||
|
||||
class _Slice:
|
||||
def __init__(self, theList, theSlice):
|
||||
self.__list = theList
|
||||
self.__start = theSlice.start or 0
|
||||
self.__stop = theSlice.stop
|
||||
self.__step = theSlice.step or 1
|
||||
|
||||
def __iter__(self):
|
||||
index = self.__start
|
||||
while not self.__finished(index):
|
||||
if self.__list._isBiggerThan(index):
|
||||
yield self.__list[index]
|
||||
index += self.__step
|
||||
else:
|
||||
return
|
||||
|
||||
def __finished(self, index):
|
||||
return self.__stop is not None and index >= self.__stop
|
||||
|
||||
|
||||
class PaginatedList(PaginatedListBase):
|
||||
"""
|
||||
This class abstracts the `pagination of the API <http://developer.github.com/v3/#pagination>`_.
|
||||
|
||||
You can simply enumerate through instances of this class::
|
||||
|
||||
for repo in user.get_repos():
|
||||
print repo.name
|
||||
|
||||
You can also index them or take slices::
|
||||
|
||||
second_repo = user.get_repos()[1]
|
||||
first_repos = user.get_repos()[:10]
|
||||
|
||||
If you want to iterate in reversed order, just do::
|
||||
|
||||
for repo in user.get_repos().reversed:
|
||||
print repo.name
|
||||
|
||||
And if you really need it, you can explicitely access a specific page::
|
||||
|
||||
some_repos = user.get_repos().get_page(0)
|
||||
some_other_repos = user.get_repos().get_page(3)
|
||||
"""
|
||||
|
||||
def __init__(self, contentClass, requester, firstUrl, firstParams, headers=None):
|
||||
PaginatedListBase.__init__(self)
|
||||
self.__requester = requester
|
||||
self.__contentClass = contentClass
|
||||
self.__firstUrl = firstUrl
|
||||
self.__firstParams = firstParams or ()
|
||||
self.__nextUrl = firstUrl
|
||||
self.__nextParams = firstParams or {}
|
||||
self.__headers = headers
|
||||
if self.__requester.per_page != 30:
|
||||
self.__nextParams["per_page"] = self.__requester.per_page
|
||||
self._reversed = False
|
||||
self.__totalCount = None
|
||||
|
||||
@property
|
||||
def totalCount(self):
|
||||
if not self.__totalCount:
|
||||
self._grow()
|
||||
|
||||
return self.__totalCount
|
||||
|
||||
def _getLastPageUrl(self):
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.__firstUrl,
|
||||
parameters=self.__nextParams,
|
||||
headers=self.__headers
|
||||
)
|
||||
links = self.__parseLinkHeader(headers)
|
||||
lastUrl = links.get("last")
|
||||
return lastUrl
|
||||
|
||||
@property
|
||||
def reversed(self):
|
||||
r = PaginatedList(self.__contentClass, self.__requester, self.__firstUrl, self.__firstParams)
|
||||
r.__reverse()
|
||||
return r
|
||||
|
||||
def __reverse(self):
|
||||
self._reversed = True
|
||||
lastUrl = self._getLastPageUrl()
|
||||
if lastUrl:
|
||||
self.__nextUrl = lastUrl
|
||||
|
||||
def _couldGrow(self):
|
||||
return self.__nextUrl is not None
|
||||
|
||||
def _fetchNextPage(self):
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.__nextUrl,
|
||||
parameters=self.__nextParams,
|
||||
headers=self.__headers
|
||||
)
|
||||
data = data if data else []
|
||||
|
||||
self.__nextUrl = None
|
||||
if len(data) > 0:
|
||||
links = self.__parseLinkHeader(headers)
|
||||
if self._reversed:
|
||||
if "prev" in links:
|
||||
self.__nextUrl = links["prev"]
|
||||
elif "next" in links:
|
||||
self.__nextUrl = links["next"]
|
||||
self.__nextParams = None
|
||||
|
||||
if 'items' in data:
|
||||
self.__totalCount = data['total_count']
|
||||
data = data["items"]
|
||||
|
||||
content = [
|
||||
self.__contentClass(self.__requester, headers, element, completed=False)
|
||||
for element in data if element is not None
|
||||
]
|
||||
if self._reversed:
|
||||
return content[::-1]
|
||||
return content
|
||||
|
||||
def __parseLinkHeader(self, headers):
|
||||
links = {}
|
||||
if "link" in headers:
|
||||
linkHeaders = headers["link"].split(", ")
|
||||
for linkHeader in linkHeaders:
|
||||
(url, rel) = linkHeader.split("; ")
|
||||
url = url[1:-1]
|
||||
rel = rel[5:-1]
|
||||
links[rel] = url
|
||||
return links
|
||||
|
||||
def get_page(self, page):
|
||||
params = dict(self.__firstParams)
|
||||
if page != 0:
|
||||
params["page"] = page + 1
|
||||
if self.__requester.per_page != 30:
|
||||
params["per_page"] = self.__requester.per_page
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.__firstUrl,
|
||||
parameters=params,
|
||||
headers=self.__headers
|
||||
)
|
||||
|
||||
if 'items' in data:
|
||||
self.__totalCount = data['total_count']
|
||||
data = data["items"]
|
||||
|
||||
return [
|
||||
self.__contentClass(self.__requester, headers, element, completed=False)
|
||||
for element in data
|
||||
]
|
||||
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Permissions.py
vendored
Normal file
67
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Permissions.py
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Permissions(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Permissionss as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def admin(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
return self._admin.value
|
||||
|
||||
@property
|
||||
def pull(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
return self._pull.value
|
||||
|
||||
@property
|
||||
def push(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
return self._push.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._admin = github.GithubObject.NotSet
|
||||
self._pull = github.GithubObject.NotSet
|
||||
self._push = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "admin" in attributes: # pragma no branch
|
||||
self._admin = self._makeBoolAttribute(attributes["admin"])
|
||||
if "pull" in attributes: # pragma no branch
|
||||
self._pull = self._makeBoolAttribute(attributes["pull"])
|
||||
if "push" in attributes: # pragma no branch
|
||||
self._push = self._makeBoolAttribute(attributes["push"])
|
||||
77
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Plan.py
vendored
Normal file
77
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Plan.py
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Plan(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Plans as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def collaborators(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._collaborators.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def private_repos(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._private_repos.value
|
||||
|
||||
@property
|
||||
def space(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._space.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._private_repos = github.GithubObject.NotSet
|
||||
self._space = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "collaborators" in attributes: # pragma no branch
|
||||
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "private_repos" in attributes: # pragma no branch
|
||||
self._private_repos = self._makeIntAttribute(attributes["private_repos"])
|
||||
if "space" in attributes: # pragma no branch
|
||||
self._space = self._makeIntAttribute(attributes["space"])
|
||||
618
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequest.py
vendored
Normal file
618
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequest.py
vendored
Normal file
@@ -0,0 +1,618 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Michael Stead <michael.stead@gmail.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.PullRequestMergeStatus
|
||||
import github.NamedUser
|
||||
import github.PullRequestPart
|
||||
import github.PullRequestComment
|
||||
import github.File
|
||||
import github.IssueComment
|
||||
import github.Commit
|
||||
|
||||
|
||||
class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequests. The reference can be found here http://developer.github.com/v3/pulls/
|
||||
"""
|
||||
|
||||
@property
|
||||
def additions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._additions)
|
||||
return self._additions.value
|
||||
|
||||
@property
|
||||
def assignee(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._assignee)
|
||||
return self._assignee.value
|
||||
|
||||
@property
|
||||
def base(self):
|
||||
"""
|
||||
:type: :class:`github.PullRequestPart.PullRequestPart`
|
||||
"""
|
||||
self._completeIfNotSet(self._base)
|
||||
return self._base.value
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def changed_files(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._changed_files)
|
||||
return self._changed_files.value
|
||||
|
||||
@property
|
||||
def closed_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._closed_at)
|
||||
return self._closed_at.value
|
||||
|
||||
@property
|
||||
def comments(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._comments)
|
||||
return self._comments.value
|
||||
|
||||
@property
|
||||
def comments_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._comments_url)
|
||||
return self._comments_url.value
|
||||
|
||||
@property
|
||||
def commits(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._commits)
|
||||
return self._commits.value
|
||||
|
||||
@property
|
||||
def commits_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._commits_url)
|
||||
return self._commits_url.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def deletions(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._deletions)
|
||||
return self._deletions.value
|
||||
|
||||
@property
|
||||
def diff_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._diff_url)
|
||||
return self._diff_url.value
|
||||
|
||||
@property
|
||||
def head(self):
|
||||
"""
|
||||
:type: :class:`github.PullRequestPart.PullRequestPart`
|
||||
"""
|
||||
self._completeIfNotSet(self._head)
|
||||
return self._head.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def issue_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._issue_url)
|
||||
return self._issue_url.value
|
||||
|
||||
@property
|
||||
def merge_commit_sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._merge_commit_sha)
|
||||
return self._merge_commit_sha.value
|
||||
|
||||
@property
|
||||
def mergeable(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._mergeable)
|
||||
return self._mergeable.value
|
||||
|
||||
@property
|
||||
def mergeable_state(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._mergeable_state)
|
||||
return self._mergeable_state.value
|
||||
|
||||
@property
|
||||
def merged(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._merged)
|
||||
return self._merged.value
|
||||
|
||||
@property
|
||||
def merged_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._merged_at)
|
||||
return self._merged_at.value
|
||||
|
||||
@property
|
||||
def merged_by(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._merged_by)
|
||||
return self._merged_by.value
|
||||
|
||||
@property
|
||||
def milestone(self):
|
||||
"""
|
||||
:type: :class:`github.Milestone.Milestone`
|
||||
"""
|
||||
self._completeIfNotSet(self._milestone)
|
||||
return self._milestone.value
|
||||
|
||||
@property
|
||||
def number(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._number)
|
||||
return self._number.value
|
||||
|
||||
@property
|
||||
def patch_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._patch_url)
|
||||
return self._patch_url.value
|
||||
|
||||
@property
|
||||
def review_comment_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._review_comment_url)
|
||||
return self._review_comment_url.value
|
||||
|
||||
@property
|
||||
def review_comments(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._review_comments)
|
||||
return self._review_comments.value
|
||||
|
||||
@property
|
||||
def review_comments_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._review_comments_url)
|
||||
return self._review_comments_url.value
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._state)
|
||||
return self._state.value
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._title)
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def create_comment(self, body, commit_id, path, position):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/pulls/:number/comments <http://developer.github.com/v3/pulls/comments>`_
|
||||
:param body: string
|
||||
:param commit_id: :class:`github.Commit.Commit`
|
||||
:param path: string
|
||||
:param position: integer
|
||||
:rtype: :class:`github.PullRequestComment.PullRequestComment`
|
||||
"""
|
||||
return self.create_review_comment(body, commit_id, path, position)
|
||||
|
||||
def create_review_comment(self, body, commit_id, path, position):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/pulls/:number/comments <http://developer.github.com/v3/pulls/comments>`_
|
||||
:param body: string
|
||||
:param commit_id: :class:`github.Commit.Commit`
|
||||
:param path: string
|
||||
:param position: integer
|
||||
:rtype: :class:`github.PullRequestComment.PullRequestComment`
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
assert isinstance(commit_id, github.Commit.Commit), commit_id
|
||||
assert isinstance(path, (str, unicode)), path
|
||||
assert isinstance(position, (int, long)), position
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
"commit_id": commit_id._identity,
|
||||
"path": path,
|
||||
"position": position,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/comments",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_issue_comment(self, body):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/issues/:number/comments <http://developer.github.com/v3/issues/comments>`_
|
||||
:param body: string
|
||||
:rtype: :class:`github.IssueComment.IssueComment`
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/pulls/:number <http://developer.github.com/v3/pulls>`_
|
||||
:param title: string
|
||||
:param body: string
|
||||
:param state: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
post_parameters = dict()
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters["body"] = body
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_comment(self, id):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_
|
||||
:param id: integer
|
||||
:rtype: :class:`github.PullRequestComment.PullRequestComment`
|
||||
"""
|
||||
return self.get_review_comment(id)
|
||||
|
||||
def get_review_comment(self, id):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_
|
||||
:param id: integer
|
||||
:rtype: :class:`github.PullRequestComment.PullRequestComment`
|
||||
"""
|
||||
assert isinstance(id, (int, long)), id
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self._parentUrl(self.url) + "/comments/" + str(id)
|
||||
)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/:number/comments <http://developer.github.com/v3/pulls/comments>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment`
|
||||
"""
|
||||
return self.get_review_comments()
|
||||
|
||||
def get_review_comments(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/:number/comments <http://developer.github.com/v3/pulls/comments>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.PullRequestComment.PullRequestComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_commits(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/:number/commits <http://developer.github.com/v3/pulls>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Commit.Commit`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Commit.Commit,
|
||||
self._requester,
|
||||
self.url + "/commits",
|
||||
None
|
||||
)
|
||||
|
||||
def get_files(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/:number/files <http://developer.github.com/v3/pulls>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.File.File`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.File.File,
|
||||
self._requester,
|
||||
self.url + "/files",
|
||||
None
|
||||
)
|
||||
|
||||
def get_issue_comment(self, id):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/comments/:id <http://developer.github.com/v3/issues/comments>`_
|
||||
:param id: integer
|
||||
:rtype: :class:`github.IssueComment.IssueComment`
|
||||
"""
|
||||
assert isinstance(id, (int, long)), id
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/issues/comments/" + str(id)
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_issue_comments(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/:number/comments <http://developer.github.com/v3/issues/comments>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueComment.IssueComment,
|
||||
self._requester,
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def is_merged(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/:number/merge <http://developer.github.com/v3/pulls>`_
|
||||
:rtype: bool
|
||||
"""
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/merge"
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def merge(self, commit_message=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PUT /repos/:owner/:repo/pulls/:number/merge <http://developer.github.com/v3/pulls>`_
|
||||
:param commit_message: string
|
||||
:rtype: :class:`github.PullRequestMergeStatus.PullRequestMergeStatus`
|
||||
"""
|
||||
assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
|
||||
post_parameters = dict()
|
||||
if commit_message is not github.GithubObject.NotSet:
|
||||
post_parameters["commit_message"] = commit_message
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PUT",
|
||||
self.url + "/merge",
|
||||
input=post_parameters
|
||||
)
|
||||
return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, headers, data, completed=True)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._assignee = github.GithubObject.NotSet
|
||||
self._base = github.GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._changed_files = github.GithubObject.NotSet
|
||||
self._closed_at = github.GithubObject.NotSet
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._comments_url = github.GithubObject.NotSet
|
||||
self._commits = github.GithubObject.NotSet
|
||||
self._commits_url = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._head = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._issue_url = github.GithubObject.NotSet
|
||||
self._merge_commit_sha = github.GithubObject.NotSet
|
||||
self._mergeable = github.GithubObject.NotSet
|
||||
self._mergeable_state = github.GithubObject.NotSet
|
||||
self._merged = github.GithubObject.NotSet
|
||||
self._merged_at = github.GithubObject.NotSet
|
||||
self._merged_by = github.GithubObject.NotSet
|
||||
self._milestone = github.GithubObject.NotSet
|
||||
self._number = github.GithubObject.NotSet
|
||||
self._patch_url = github.GithubObject.NotSet
|
||||
self._review_comment_url = github.GithubObject.NotSet
|
||||
self._review_comments = github.GithubObject.NotSet
|
||||
self._review_comments_url = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
self._additions = self._makeIntAttribute(attributes["additions"])
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
|
||||
if "base" in attributes: # pragma no branch
|
||||
self._base = self._makeClassAttribute(github.PullRequestPart.PullRequestPart, attributes["base"])
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "changed_files" in attributes: # pragma no branch
|
||||
self._changed_files = self._makeIntAttribute(attributes["changed_files"])
|
||||
if "closed_at" in attributes: # pragma no branch
|
||||
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
||||
if "comments" in attributes: # pragma no branch
|
||||
self._comments = self._makeIntAttribute(attributes["comments"])
|
||||
if "comments_url" in attributes: # pragma no branch
|
||||
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
||||
if "commits" in attributes: # pragma no branch
|
||||
self._commits = self._makeIntAttribute(attributes["commits"])
|
||||
if "commits_url" in attributes: # pragma no branch
|
||||
self._commits_url = self._makeStringAttribute(attributes["commits_url"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "deletions" in attributes: # pragma no branch
|
||||
self._deletions = self._makeIntAttribute(attributes["deletions"])
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
||||
if "head" in attributes: # pragma no branch
|
||||
self._head = self._makeClassAttribute(github.PullRequestPart.PullRequestPart, attributes["head"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "issue_url" in attributes: # pragma no branch
|
||||
self._issue_url = self._makeStringAttribute(attributes["issue_url"])
|
||||
if "merge_commit_sha" in attributes: # pragma no branch
|
||||
self._merge_commit_sha = self._makeStringAttribute(attributes["merge_commit_sha"])
|
||||
if "mergeable" in attributes: # pragma no branch
|
||||
self._mergeable = self._makeBoolAttribute(attributes["mergeable"])
|
||||
if "mergeable_state" in attributes: # pragma no branch
|
||||
self._mergeable_state = self._makeStringAttribute(attributes["mergeable_state"])
|
||||
if "merged" in attributes: # pragma no branch
|
||||
self._merged = self._makeBoolAttribute(attributes["merged"])
|
||||
if "merged_at" in attributes: # pragma no branch
|
||||
self._merged_at = self._makeDatetimeAttribute(attributes["merged_at"])
|
||||
if "merged_by" in attributes: # pragma no branch
|
||||
self._merged_by = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["merged_by"])
|
||||
if "milestone" in attributes: # pragma no branch
|
||||
self._milestone = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
|
||||
if "number" in attributes: # pragma no branch
|
||||
self._number = self._makeIntAttribute(attributes["number"])
|
||||
if "patch_url" in attributes: # pragma no branch
|
||||
self._patch_url = self._makeStringAttribute(attributes["patch_url"])
|
||||
if "review_comment_url" in attributes: # pragma no branch
|
||||
self._review_comment_url = self._makeStringAttribute(attributes["review_comment_url"])
|
||||
if "review_comments" in attributes: # pragma no branch
|
||||
self._review_comments = self._makeIntAttribute(attributes["review_comments"])
|
||||
if "review_comments_url" in attributes: # pragma no branch
|
||||
self._review_comments_url = self._makeStringAttribute(attributes["review_comments_url"])
|
||||
if "state" in attributes: # pragma no branch
|
||||
self._state = self._makeStringAttribute(attributes["state"])
|
||||
if "title" in attributes: # pragma no branch
|
||||
self._title = self._makeStringAttribute(attributes["title"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
222
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequestComment.py
vendored
Normal file
222
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequestComment.py
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class PullRequestComment(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequestComments. The reference can be found here http://developer.github.com/v3/pulls/comments/
|
||||
"""
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._body)
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def commit_id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._commit_id)
|
||||
return self._commit_id.value
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._created_at)
|
||||
return self._created_at.value
|
||||
|
||||
@property
|
||||
def diff_hunk(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._diff_hunk)
|
||||
return self._diff_hunk.value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def original_commit_id(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._original_commit_id)
|
||||
return self._original_commit_id.value
|
||||
|
||||
@property
|
||||
def original_position(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._original_position)
|
||||
return self._original_position.value
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._path)
|
||||
return self._path.value
|
||||
|
||||
@property
|
||||
def position(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._position)
|
||||
return self._position.value
|
||||
|
||||
@property
|
||||
def pull_request_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._pull_request_url)
|
||||
return self._pull_request_url.value
|
||||
|
||||
@property
|
||||
def updated_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._updated_at)
|
||||
return self._updated_at.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def html_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._html_url)
|
||||
return self._html_url.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
self._completeIfNotSet(self._user)
|
||||
return self._user.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, body):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_
|
||||
:param body: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._diff_hunk = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._original_commit_id = github.GithubObject.NotSet
|
||||
self._original_position = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._position = github.GithubObject.NotSet
|
||||
self._pull_request_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "commit_id" in attributes: # pragma no branch
|
||||
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
||||
if "diff_hunk" in attributes: # pragma no branch
|
||||
self._diff_hunk = self._makeStringAttribute(attributes["diff_hunk"])
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "original_commit_id" in attributes: # pragma no branch
|
||||
self._original_commit_id = self._makeStringAttribute(attributes["original_commit_id"])
|
||||
if "original_position" in attributes: # pragma no branch
|
||||
self._original_position = self._makeIntAttribute(attributes["original_position"])
|
||||
if "path" in attributes: # pragma no branch
|
||||
self._path = self._makeStringAttribute(attributes["path"])
|
||||
if "position" in attributes: # pragma no branch
|
||||
self._position = self._makeIntAttribute(attributes["position"])
|
||||
if "pull_request_url" in attributes: # pragma no branch
|
||||
self._pull_request_url = self._makeStringAttribute(attributes["pull_request_url"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
68
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequestMergeStatus.py
vendored
Normal file
68
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequestMergeStatus.py
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class PullRequestMergeStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequestMergeStatuss. The reference can be found here http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
|
||||
"""
|
||||
|
||||
@property
|
||||
def merged(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
return self._merged.value
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._message.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._sha.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._merged = github.GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "merged" in attributes: # pragma no branch
|
||||
self._merged = self._makeBoolAttribute(attributes["merged"])
|
||||
if "message" in attributes: # pragma no branch
|
||||
self._message = self._makeStringAttribute(attributes["message"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
90
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequestPart.py
vendored
Normal file
90
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/PullRequestPart.py
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class PullRequestPart(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequestParts as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._label.value
|
||||
|
||||
@property
|
||||
def ref(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._ref.value
|
||||
|
||||
@property
|
||||
def repo(self):
|
||||
"""
|
||||
:type: :class:`github.Repository.Repository`
|
||||
"""
|
||||
return self._repo.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return self._user.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._label = github.GithubObject.NotSet
|
||||
self._ref = github.GithubObject.NotSet
|
||||
self._repo = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "label" in attributes: # pragma no branch
|
||||
self._label = self._makeStringAttribute(attributes["label"])
|
||||
if "ref" in attributes: # pragma no branch
|
||||
self._ref = self._makeStringAttribute(attributes["ref"])
|
||||
if "repo" in attributes: # pragma no branch
|
||||
self._repo = self._makeClassAttribute(github.Repository.Repository, attributes["repo"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
65
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Rate.py
vendored
Normal file
65
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Rate.py
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import datetime
|
||||
|
||||
|
||||
class Rate(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents rate limits as defined in http://developer.github.com/v3/rate_limit
|
||||
"""
|
||||
|
||||
@property
|
||||
def limit(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._limit.value
|
||||
|
||||
@property
|
||||
def remaining(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
return self._remaining.value
|
||||
|
||||
@property
|
||||
def reset(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._reset.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._limit = github.GithubObject.NotSet
|
||||
self._remaining = github.GithubObject.NotSet
|
||||
self._reset = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "limit" in attributes: # pragma no branch
|
||||
self._limit = self._makeIntAttribute(attributes["limit"])
|
||||
if "remaining" in attributes: # pragma no branch
|
||||
self._remaining = self._makeIntAttribute(attributes["remaining"])
|
||||
if "reset" in attributes: # pragma no branch
|
||||
self._reset = self._makeTimestampAttribute(attributes["reset"])
|
||||
45
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/RateLimit.py
vendored
Normal file
45
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/RateLimit.py
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.Rate
|
||||
|
||||
|
||||
class RateLimit(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents rate limits as defined in http://developer.github.com/v3/rate_limit
|
||||
"""
|
||||
|
||||
@property
|
||||
def rate(self):
|
||||
"""
|
||||
:type: class:`github.Rate.Rate`
|
||||
"""
|
||||
return self._rate.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._rate = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "rate" in attributes: # pragma no branch
|
||||
self._rate = self._makeClassAttribute(github.Rate.Rate, attributes["rate"])
|
||||
2268
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Repository.py
vendored
Normal file
2268
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Repository.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
133
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/RepositoryKey.py
vendored
Normal file
133
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/RepositoryKey.py
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Srijan Choudhary <srijan4@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class RepositoryKey(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents RepositoryKeys. The reference can be found here http://developer.github.com/v3/repos/keys/
|
||||
"""
|
||||
|
||||
def __init__(self, requester, headers, attributes, completed, repoUrl):
|
||||
github.GithubObject.CompletableGithubObject.__init__(self, requester, headers, attributes, completed)
|
||||
self.__repoUrl = repoUrl
|
||||
|
||||
@property
|
||||
def __customUrl(self):
|
||||
return self.__repoUrl + "/keys/" + str(self.id)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def key(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._key)
|
||||
return self._key.value
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._title)
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def verified(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._verified)
|
||||
return self._verified.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/keys/:id <http://developer.github.com/v3/repos/keys>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.__customUrl
|
||||
)
|
||||
|
||||
def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo/keys/:id <http://developer.github.com/v3/repos/keys>`_
|
||||
:param title: string
|
||||
:param key: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key
|
||||
post_parameters = dict()
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if key is not github.GithubObject.NotSet:
|
||||
post_parameters["key"] = key
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.__customUrl,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._key = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._verified = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "key" in attributes: # pragma no branch
|
||||
self._key = self._makeStringAttribute(attributes["key"])
|
||||
if "title" in attributes: # pragma no branch
|
||||
self._title = self._makeStringAttribute(attributes["title"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "verified" in attributes: # pragma no branch
|
||||
self._verified = self._makeBoolAttribute(attributes["verified"])
|
||||
353
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Requester.py
vendored
Normal file
353
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Requester.py
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Andrew Bettison <andrewb@zip.com.au> #
|
||||
# Copyright 2012 Dima Kukushkin <dima@kukushkin.me> #
|
||||
# Copyright 2012 Michael Woodworth <mwoodworth@upverter.com> #
|
||||
# Copyright 2012 Petteri Muilu <pmuilu@xena.(none)> #
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Ed Jackson <ed.jackson@gmail.com> #
|
||||
# Copyright 2013 Jonathan J Hunt <hunt@braincorporation.com> #
|
||||
# Copyright 2013 Mark Roddy <markroddy@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import logging
|
||||
import httplib
|
||||
import base64
|
||||
import urllib
|
||||
import urlparse
|
||||
import sys
|
||||
import Consts
|
||||
import re
|
||||
import os
|
||||
|
||||
atLeastPython26 = sys.hexversion >= 0x02060000
|
||||
atLeastPython3 = sys.hexversion >= 0x03000000
|
||||
|
||||
if atLeastPython26:
|
||||
import json
|
||||
else: # pragma no cover (Covered by all tests with Python 2.5)
|
||||
import simplejson as json # pragma no cover (Covered by all tests with Python 2.5)
|
||||
|
||||
import GithubException
|
||||
|
||||
|
||||
class Requester:
|
||||
__httpConnectionClass = httplib.HTTPConnection
|
||||
__httpsConnectionClass = httplib.HTTPSConnection
|
||||
|
||||
@classmethod
|
||||
def injectConnectionClasses(cls, httpConnectionClass, httpsConnectionClass):
|
||||
cls.__httpConnectionClass = httpConnectionClass
|
||||
cls.__httpsConnectionClass = httpsConnectionClass
|
||||
|
||||
@classmethod
|
||||
def resetConnectionClasses(cls):
|
||||
cls.__httpConnectionClass = httplib.HTTPConnection
|
||||
cls.__httpsConnectionClass = httplib.HTTPSConnection
|
||||
|
||||
#############################################################
|
||||
# For Debug
|
||||
@classmethod
|
||||
def setDebugFlag(cls, flag):
|
||||
cls.DEBUG_FLAG = flag
|
||||
|
||||
@classmethod
|
||||
def setOnCheckMe(cls, onCheckMe):
|
||||
cls.ON_CHECK_ME = onCheckMe
|
||||
|
||||
DEBUG_FLAG = False
|
||||
|
||||
DEBUG_FRAME_BUFFER_SIZE = 1024
|
||||
|
||||
DEBUG_HEADER_KEY = "DEBUG_FRAME"
|
||||
|
||||
ON_CHECK_ME = None
|
||||
|
||||
def NEW_DEBUG_FRAME(self, requestHeader):
|
||||
'''
|
||||
Initialize a debug frame with requestHeader
|
||||
Frame count is updated and will be attached to respond header
|
||||
The structure of a frame: [requestHeader, statusCode, responseHeader, raw_data]
|
||||
Some of them may be None
|
||||
'''
|
||||
if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests)
|
||||
new_frame = [requestHeader, None, None, None]
|
||||
if self._frameCount < self.DEBUG_FRAME_BUFFER_SIZE - 1: # pragma no branch (Should be covered)
|
||||
self._frameBuffer.append(new_frame)
|
||||
else:
|
||||
self._frameBuffer[0] = new_frame # pragma no cover (Should be covered)
|
||||
|
||||
self._frameCount = len(self._frameBuffer) - 1
|
||||
|
||||
def DEBUG_ON_RESPONSE(self, statusCode, responseHeader, data):
|
||||
'''
|
||||
Update current frame with response
|
||||
Current frame index will be attached to responseHeader
|
||||
'''
|
||||
if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests)
|
||||
self._frameBuffer[self._frameCount][1:4] = [statusCode, responseHeader, data]
|
||||
responseHeader[self.DEBUG_HEADER_KEY] = self._frameCount
|
||||
|
||||
def check_me(self, obj):
|
||||
if self.DEBUG_FLAG and self.ON_CHECK_ME is not None: # pragma no branch (Flag always set in tests)
|
||||
frame = None
|
||||
if self.DEBUG_HEADER_KEY in obj._headers:
|
||||
frame_index = obj._headers[self.DEBUG_HEADER_KEY]
|
||||
frame = self._frameBuffer[frame_index]
|
||||
self.ON_CHECK_ME(obj, frame)
|
||||
|
||||
def _initializeDebugFeature(self):
|
||||
self._frameCount = 0
|
||||
self._frameBuffer = []
|
||||
|
||||
#############################################################
|
||||
|
||||
def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page, api_preview):
|
||||
self._initializeDebugFeature()
|
||||
|
||||
if password is not None:
|
||||
login = login_or_token
|
||||
if atLeastPython3:
|
||||
self.__authorizationHeader = "Basic " + base64.b64encode((login + ":" + password).encode("utf-8")).decode("utf-8").replace('\n', '') # pragma no cover (Covered by Authentication.testAuthorizationHeaderWithXxx with Python 3)
|
||||
else:
|
||||
self.__authorizationHeader = "Basic " + base64.b64encode(login + ":" + password).replace('\n', '')
|
||||
elif login_or_token is not None:
|
||||
token = login_or_token
|
||||
self.__authorizationHeader = "token " + token
|
||||
else:
|
||||
self.__authorizationHeader = None
|
||||
|
||||
self.__base_url = base_url
|
||||
o = urlparse.urlparse(base_url)
|
||||
self.__hostname = o.hostname
|
||||
self.__port = o.port
|
||||
self.__prefix = o.path
|
||||
self.__timeout = timeout
|
||||
self.__scheme = o.scheme
|
||||
if o.scheme == "https":
|
||||
self.__connectionClass = self.__httpsConnectionClass
|
||||
elif o.scheme == "http":
|
||||
self.__connectionClass = self.__httpConnectionClass
|
||||
else:
|
||||
assert False, "Unknown URL scheme"
|
||||
self.rate_limiting = (-1, -1)
|
||||
self.rate_limiting_resettime = 0
|
||||
self.FIX_REPO_GET_GIT_REF = True
|
||||
self.per_page = per_page
|
||||
|
||||
self.oauth_scopes = None
|
||||
|
||||
self.__clientId = client_id
|
||||
self.__clientSecret = client_secret
|
||||
|
||||
assert user_agent is not None, 'github now requires a user-agent. ' \
|
||||
'See http://developer.github.com/v3/#user-agent-required'
|
||||
self.__userAgent = user_agent
|
||||
self.__apiPreview = api_preview
|
||||
|
||||
def requestJsonAndCheck(self, verb, url, parameters=None, headers=None, input=None, cnx=None):
|
||||
return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
|
||||
|
||||
def requestMultipartAndCheck(self, verb, url, parameters=None, headers=None, input=None):
|
||||
return self.__check(*self.requestMultipart(verb, url, parameters, headers, input))
|
||||
|
||||
def __check(self, status, responseHeaders, output):
|
||||
output = self.__structuredFromJson(output)
|
||||
if status >= 400:
|
||||
raise self.__createException(status, responseHeaders, output)
|
||||
return responseHeaders, output
|
||||
|
||||
def __createException(self, status, headers, output):
|
||||
if status == 401 and output.get("message") == "Bad credentials":
|
||||
cls = GithubException.BadCredentialsException
|
||||
elif status == 401 and 'x-github-otp' in headers and re.match(r'.*required.*', headers['x-github-otp']):
|
||||
cls = GithubException.TwoFactorException # pragma no cover (Should be covered)
|
||||
elif status == 403 and output.get("message").startswith("Missing or invalid User Agent string"):
|
||||
cls = GithubException.BadUserAgentException
|
||||
elif status == 403 and output.get("message").startswith("API Rate Limit Exceeded"):
|
||||
cls = GithubException.RateLimitExceededException
|
||||
elif status == 404 and output.get("message") == "Not Found":
|
||||
cls = GithubException.UnknownObjectException
|
||||
else:
|
||||
cls = GithubException.GithubException
|
||||
return cls(status, output)
|
||||
|
||||
def __structuredFromJson(self, data):
|
||||
if len(data) == 0:
|
||||
return None
|
||||
else:
|
||||
if atLeastPython3 and isinstance(data, bytes): # pragma no branch (Covered by Issue142.testDecodeJson with Python 3)
|
||||
data = data.decode("utf-8") # pragma no cover (Covered by Issue142.testDecodeJson with Python 3)
|
||||
try:
|
||||
return json.loads(data)
|
||||
except ValueError as e:
|
||||
return {'data': data}
|
||||
|
||||
def requestJson(self, verb, url, parameters=None, headers=None, input=None, cnx=None):
|
||||
def encode(input):
|
||||
return "application/json", json.dumps(input)
|
||||
|
||||
return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode)
|
||||
|
||||
def requestMultipart(self, verb, url, parameters=None, headers=None, input=None):
|
||||
def encode(input):
|
||||
boundary = "----------------------------3c3ba8b523b2"
|
||||
eol = "\r\n"
|
||||
|
||||
encoded_input = ""
|
||||
for name, value in input.iteritems():
|
||||
encoded_input += "--" + boundary + eol
|
||||
encoded_input += "Content-Disposition: form-data; name=\"" + name + "\"" + eol
|
||||
encoded_input += eol
|
||||
encoded_input += value + eol
|
||||
encoded_input += "--" + boundary + "--" + eol
|
||||
return "multipart/form-data; boundary=" + boundary, encoded_input
|
||||
|
||||
return self.__requestEncode(None, verb, url, parameters, headers, input, encode)
|
||||
|
||||
def __requestEncode(self, cnx, verb, url, parameters, requestHeaders, input, encode):
|
||||
assert verb in ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE"]
|
||||
if parameters is None:
|
||||
parameters = dict()
|
||||
if requestHeaders is None:
|
||||
requestHeaders = dict()
|
||||
|
||||
self.__authenticate(url, requestHeaders, parameters)
|
||||
requestHeaders["User-Agent"] = self.__userAgent
|
||||
if self.__apiPreview:
|
||||
requestHeaders["Accept"] = "application/vnd.github.moondragon+json"
|
||||
|
||||
url = self.__makeAbsoluteUrl(url)
|
||||
url = self.__addParametersToUrl(url, parameters)
|
||||
|
||||
encoded_input = "null"
|
||||
if input is not None:
|
||||
requestHeaders["Content-Type"], encoded_input = encode(input)
|
||||
|
||||
self.NEW_DEBUG_FRAME(requestHeaders)
|
||||
|
||||
status, responseHeaders, output = self.__requestRaw(cnx, verb, url, requestHeaders, encoded_input)
|
||||
|
||||
if "x-ratelimit-remaining" in responseHeaders and "x-ratelimit-limit" in responseHeaders:
|
||||
self.rate_limiting = (int(responseHeaders["x-ratelimit-remaining"]), int(responseHeaders["x-ratelimit-limit"]))
|
||||
if "x-ratelimit-reset" in responseHeaders:
|
||||
self.rate_limiting_resettime = int(responseHeaders["x-ratelimit-reset"])
|
||||
|
||||
if "x-oauth-scopes" in responseHeaders:
|
||||
self.oauth_scopes = responseHeaders["x-oauth-scopes"].split(", ")
|
||||
|
||||
self.DEBUG_ON_RESPONSE(status, responseHeaders, output)
|
||||
|
||||
return status, responseHeaders, output
|
||||
|
||||
def __requestRaw(self, cnx, verb, url, requestHeaders, input):
|
||||
if cnx is None:
|
||||
cnx = self.__createConnection()
|
||||
else:
|
||||
assert cnx == "status"
|
||||
cnx = self.__httpsConnectionClass("status.github.com", 443)
|
||||
cnx.request(
|
||||
verb,
|
||||
url,
|
||||
input,
|
||||
requestHeaders
|
||||
)
|
||||
response = cnx.getresponse()
|
||||
|
||||
status = response.status
|
||||
responseHeaders = dict((k.lower(), v) for k, v in response.getheaders())
|
||||
output = response.read()
|
||||
|
||||
cnx.close()
|
||||
|
||||
self.__log(verb, url, requestHeaders, input, status, responseHeaders, output)
|
||||
|
||||
return status, responseHeaders, output
|
||||
|
||||
def __authenticate(self, url, requestHeaders, parameters):
|
||||
if self.__clientId and self.__clientSecret and "client_id=" not in url:
|
||||
parameters["client_id"] = self.__clientId
|
||||
parameters["client_secret"] = self.__clientSecret
|
||||
if self.__authorizationHeader is not None:
|
||||
requestHeaders["Authorization"] = self.__authorizationHeader
|
||||
|
||||
def __makeAbsoluteUrl(self, url):
|
||||
# URLs generated locally will be relative to __base_url
|
||||
# URLs returned from the server will start with __base_url
|
||||
if url.startswith("/"):
|
||||
url = self.__prefix + url
|
||||
else:
|
||||
o = urlparse.urlparse(url)
|
||||
assert o.hostname == self.__hostname
|
||||
assert o.path.startswith(self.__prefix)
|
||||
assert o.port == self.__port
|
||||
url = o.path
|
||||
if o.query != "":
|
||||
url += "?" + o.query
|
||||
return url
|
||||
|
||||
def __addParametersToUrl(self, url, parameters):
|
||||
if len(parameters) == 0:
|
||||
return url
|
||||
else:
|
||||
return url + "?" + urllib.urlencode(parameters)
|
||||
|
||||
def __createConnection(self):
|
||||
kwds = {}
|
||||
if not atLeastPython3: # pragma no branch (Branch useful only with Python 3)
|
||||
kwds["strict"] = True # Useless in Python3, would generate a deprecation warning
|
||||
if atLeastPython26: # pragma no branch (Branch useful only with Python 2.5)
|
||||
kwds["timeout"] = self.__timeout # Did not exist before Python2.6
|
||||
|
||||
##
|
||||
## Connect through a proxy server with authentication, if http_proxy
|
||||
## set.
|
||||
## http_proxy: http://user:password@proxy_host:proxy_port
|
||||
##
|
||||
proxy_uri = os.getenv('http_proxy') or os.getenv('HTTP_PROXY')
|
||||
if proxy_uri is not None:
|
||||
url = urlparse.urlparse(proxy_uri)
|
||||
conn = self.__connectionClass(url.hostname, url.port, **kwds)
|
||||
headers = {}
|
||||
if url.username and url.password:
|
||||
auth = '%s:%s' % (url.username, url.password)
|
||||
headers['Proxy-Authorization'] = 'Basic ' + base64.b64encode(auth)
|
||||
conn.set_tunnel(self.__hostname, self.__port, headers)
|
||||
else:
|
||||
conn = self.__connectionClass(self.__hostname, self.__port, **kwds)
|
||||
|
||||
return conn
|
||||
|
||||
def __log(self, verb, url, requestHeaders, input, status, responseHeaders, output):
|
||||
logger = logging.getLogger(__name__)
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
if "Authorization" in requestHeaders:
|
||||
if requestHeaders["Authorization"].startswith("Basic"):
|
||||
requestHeaders["Authorization"] = "Basic (login and password removed)"
|
||||
elif requestHeaders["Authorization"].startswith("token"):
|
||||
requestHeaders["Authorization"] = "token (oauth token removed)"
|
||||
else: # pragma no cover (Cannot happen, but could if we add an authentication method => be prepared)
|
||||
requestHeaders["Authorization"] = "(unknown auth removed)" # pragma no cover (Cannot happen, but could if we add an authentication method => be prepared)
|
||||
logger.debug("%s %s://%s%s %s %s ==> %i %s %s", str(verb), self.__scheme, self.__hostname, str(url), str(requestHeaders), str(input), status, str(responseHeaders), str(output))
|
||||
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Stargazer.py
vendored
Normal file
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Stargazer.py
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Christopher Gilbert <christopher.john.gilbert@gmail.com> #
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Adrian Petrescu <adrian.petrescu@maluuba.com> #
|
||||
# Copyright 2013 Mark Roddy <markroddy@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# Copyright 2015 Dan Vanderkam <danvdk@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github
|
||||
|
||||
|
||||
class Stargazer(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Stargazers with the date of starring as returned by
|
||||
https://developer.github.com/v3/activity/starring/#alternative-response-with-star-creation-timestamps
|
||||
"""
|
||||
@property
|
||||
def starred_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._starred_at.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser`
|
||||
"""
|
||||
return self._user.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._starred_at = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if 'starred_at' in attributes:
|
||||
self._starred_at = self._makeDatetimeAttribute(attributes['starred_at'])
|
||||
if 'user' in attributes:
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes['user'])
|
||||
61
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsCodeFrequency.py
vendored
Normal file
61
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsCodeFrequency.py
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class StatsCodeFrequency(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents statistics of code frequency. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-the-number-of-additions-and-deletions-per-week
|
||||
"""
|
||||
|
||||
@property
|
||||
def week(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._week.value
|
||||
|
||||
@property
|
||||
def additions(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._additions.value
|
||||
|
||||
@property
|
||||
def deletions(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._deletions.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._week = github.GithubObject.NotSet
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
self._week = self._makeTimestampAttribute(attributes[0])
|
||||
self._additions = self._makeIntAttribute(attributes[1])
|
||||
self._deletions = self._makeIntAttribute(attributes[2])
|
||||
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsCommitActivity.py
vendored
Normal file
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsCommitActivity.py
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class StatsCommitActivity(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents statistics of commit activity. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-the-last-year-of-commit-activity-data
|
||||
"""
|
||||
|
||||
@property
|
||||
def week(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._week.value
|
||||
|
||||
@property
|
||||
def total(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._total.value
|
||||
|
||||
@property
|
||||
def days(self):
|
||||
"""
|
||||
:type: list of int
|
||||
"""
|
||||
return self._days.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._week = github.GithubObject.NotSet
|
||||
self._total = github.GithubObject.NotSet
|
||||
self._days = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "week" in attributes: # pragma no branch
|
||||
self._week = self._makeTimestampAttribute(attributes["week"])
|
||||
if "total" in attributes: # pragma no branch
|
||||
self._total = self._makeIntAttribute(attributes["total"])
|
||||
if "days" in attributes: # pragma no branch
|
||||
self._days = self._makeListOfIntsAttribute(attributes["days"])
|
||||
115
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsContributor.py
vendored
Normal file
115
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsContributor.py
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class StatsContributor(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents statistics of a contibutor. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts
|
||||
"""
|
||||
|
||||
class Week(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents weekly statistics of a contibutor.
|
||||
"""
|
||||
|
||||
@property
|
||||
def w(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._w.value
|
||||
|
||||
@property
|
||||
def a(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._a.value
|
||||
|
||||
@property
|
||||
def d(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._d.value
|
||||
|
||||
@property
|
||||
def c(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._c.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._w = github.GithubObject.NotSet
|
||||
self._a = github.GithubObject.NotSet
|
||||
self._d = github.GithubObject.NotSet
|
||||
self._c = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "w" in attributes: # pragma no branch
|
||||
self._w = self._makeTimestampAttribute(attributes["w"])
|
||||
if "a" in attributes: # pragma no branch
|
||||
self._a = self._makeIntAttribute(attributes["a"])
|
||||
if "d" in attributes: # pragma no branch
|
||||
self._d = self._makeIntAttribute(attributes["d"])
|
||||
if "c" in attributes: # pragma no branch
|
||||
self._c = self._makeIntAttribute(attributes["c"])
|
||||
|
||||
@property
|
||||
def author(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return self._author.value
|
||||
|
||||
@property
|
||||
def total(self):
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
return self._total.value
|
||||
|
||||
@property
|
||||
def weeks(self):
|
||||
"""
|
||||
:type: list of :class:`.Week`
|
||||
"""
|
||||
return self._weeks.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._author = github.GithubObject.NotSet
|
||||
self._total = github.GithubObject.NotSet
|
||||
self._weeks = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["author"])
|
||||
if "total" in attributes: # pragma no branch
|
||||
self._total = self._makeIntAttribute(attributes["total"])
|
||||
if "weeks" in attributes: # pragma no branch
|
||||
self._weeks = self._makeListOfClassesAttribute(self.Week, attributes["weeks"])
|
||||
56
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsParticipation.py
vendored
Normal file
56
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsParticipation.py
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class StatsParticipation(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents statistics of participation. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-count-for-the-repo-owner-and-everyone-else
|
||||
"""
|
||||
|
||||
@property
|
||||
def all(self):
|
||||
"""
|
||||
:type: list of int
|
||||
"""
|
||||
return self._all.value
|
||||
|
||||
@property
|
||||
def owner(self):
|
||||
"""
|
||||
:type: list of int
|
||||
"""
|
||||
return self._owner.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._all = github.GithubObject.NotSet
|
||||
self._owner = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "all" in attributes: # pragma no branch
|
||||
self._all = self._makeListOfIntsAttribute(attributes["all"])
|
||||
if "owner" in attributes: # pragma no branch
|
||||
self._owner = self._makeListOfIntsAttribute(attributes["owner"])
|
||||
48
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsPunchCard.py
vendored
Normal file
48
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatsPunchCard.py
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class StatsPunchCard(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents the punch card. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day
|
||||
"""
|
||||
|
||||
def get(self, day, hour):
|
||||
"""
|
||||
Get a specific element
|
||||
:param day: int
|
||||
:param hour: int
|
||||
:rtype: int
|
||||
"""
|
||||
return self._dict[(day, hour)]
|
||||
|
||||
def _initAttributes(self):
|
||||
self._dict = {}
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
for day, hour, commits in attributes:
|
||||
self._dict[(day, hour)] = commits
|
||||
54
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Status.py
vendored
Normal file
54
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Status.py
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Status(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents status as defined in https://status.github.com/api
|
||||
"""
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._status.value
|
||||
|
||||
@property
|
||||
def last_updated(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._last_updated.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._status = github.GithubObject.NotSet
|
||||
self._last_updated = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "status" in attributes: # pragma no branch
|
||||
self._status = self._makeStringAttribute(attributes["status"])
|
||||
if "last_updated" in attributes: # pragma no branch
|
||||
self._last_updated = self._makeDatetimeAttribute(attributes["last_updated"])
|
||||
63
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatusMessage.py
vendored
Normal file
63
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/StatusMessage.py
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class StatusMessage(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents status messages as defined in https://status.github.com/api
|
||||
"""
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._body.value
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._status.value
|
||||
|
||||
@property
|
||||
def created_on(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
return self._created_on.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._status = github.GithubObject.NotSet
|
||||
self._created_on = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
self._body = self._makeStringAttribute(attributes["body"])
|
||||
if "status" in attributes: # pragma no branch
|
||||
self._status = self._makeStringAttribute(attributes["status"])
|
||||
if "created_on" in attributes: # pragma no branch
|
||||
self._created_on = self._makeDatetimeAttribute(attributes["created_on"])
|
||||
80
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Tag.py
vendored
Normal file
80
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Tag.py
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import github.Commit
|
||||
|
||||
|
||||
class Tag(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Tags. The reference can be found here http://developer.github.com/v3/git/tags/
|
||||
"""
|
||||
|
||||
@property
|
||||
def commit(self):
|
||||
"""
|
||||
:type: :class:`github.Commit.Commit`
|
||||
"""
|
||||
return self._commit.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def tarball_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._tarball_url.value
|
||||
|
||||
@property
|
||||
def zipball_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._zipball_url.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._commit = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._tarball_url = github.GithubObject.NotSet
|
||||
self._zipball_url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "commit" in attributes: # pragma no branch
|
||||
self._commit = self._makeClassAttribute(github.Commit.Commit, attributes["commit"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "tarball_url" in attributes: # pragma no branch
|
||||
self._tarball_url = self._makeStringAttribute(attributes["tarball_url"])
|
||||
if "zipball_url" in attributes: # pragma no branch
|
||||
self._zipball_url = self._makeStringAttribute(attributes["zipball_url"])
|
||||
286
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Team.py
vendored
Normal file
286
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/Team.py
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class Team(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents Teams. The reference can be found here http://developer.github.com/v3/orgs/teams/
|
||||
"""
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def members_count(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._members_count)
|
||||
return self._members_count.value
|
||||
|
||||
@property
|
||||
def members_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._members_url)
|
||||
return self._members_url.value
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._name)
|
||||
return self._name.value
|
||||
|
||||
@property
|
||||
def permission(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._permission)
|
||||
return self._permission.value
|
||||
|
||||
@property
|
||||
def repos_count(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._repos_count)
|
||||
return self._repos_count.value
|
||||
|
||||
@property
|
||||
def repositories_url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._repositories_url)
|
||||
return self._repositories_url.value
|
||||
|
||||
@property
|
||||
def slug(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._slug)
|
||||
return self._slug.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
def add_to_members(self, member):
|
||||
"""
|
||||
:calls: `PUT /teams/:id/members/:user <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PUT",
|
||||
self.url + "/members/" + member._identity
|
||||
)
|
||||
|
||||
def add_membership(self, member):
|
||||
"""
|
||||
:calls: `PUT /teams/:id/memberships/:user <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param member: :class:`github.Nameduser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestjsonandcheck(
|
||||
"PUT",
|
||||
self.url + "/memberships/" + member._identity
|
||||
)
|
||||
|
||||
def add_to_repos(self, repo):
|
||||
"""
|
||||
:calls: `PUT /teams/:id/repos/:org/:repo <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param repo: :class:`github.Repository.Repository`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PUT",
|
||||
self.url + "/repos/" + repo._identity
|
||||
)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /teams/:id <http://developer.github.com/v3/orgs/teams>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, name, permission=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /teams/:id <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param name: string
|
||||
:param permission: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if permission is not github.GithubObject.NotSet:
|
||||
post_parameters["permission"] = permission
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_members(self):
|
||||
"""
|
||||
:calls: `GET /teams/:id/members <http://developer.github.com/v3/orgs/teams>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repos(self):
|
||||
"""
|
||||
:calls: `GET /teams/:id/repos <http://developer.github.com/v3/orgs/teams>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/repos",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_members(self, member):
|
||||
"""
|
||||
:calls: `GET /teams/:id/members/:user <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/members/" + member._identity
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def has_in_repos(self, repo):
|
||||
"""
|
||||
:calls: `GET /teams/:id/repos/:owner/:repo <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param repo: :class:`github.Repository.Repository`
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"GET",
|
||||
self.url + "/repos/" + repo._identity
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def remove_from_members(self, member):
|
||||
"""
|
||||
:calls: `DELETE /teams/:id/members/:user <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param member: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/members/" + member._identity
|
||||
)
|
||||
|
||||
def remove_from_repos(self, repo):
|
||||
"""
|
||||
:calls: `DELETE /teams/:id/repos/:owner/:repo <http://developer.github.com/v3/orgs/teams>`_
|
||||
:param repo: :class:`github.Repository.Repository`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/repos/" + repo._identity
|
||||
)
|
||||
|
||||
@property
|
||||
def _identity(self):
|
||||
return self.id
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._members_count = github.GithubObject.NotSet
|
||||
self._members_url = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._permission = github.GithubObject.NotSet
|
||||
self._repos_count = github.GithubObject.NotSet
|
||||
self._repositories_url = github.GithubObject.NotSet
|
||||
self._slug = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "members_count" in attributes: # pragma no branch
|
||||
self._members_count = self._makeIntAttribute(attributes["members_count"])
|
||||
if "members_url" in attributes: # pragma no branch
|
||||
self._members_url = self._makeStringAttribute(attributes["members_url"])
|
||||
if "name" in attributes: # pragma no branch
|
||||
self._name = self._makeStringAttribute(attributes["name"])
|
||||
if "permission" in attributes: # pragma no branch
|
||||
self._permission = self._makeStringAttribute(attributes["permission"])
|
||||
if "repos_count" in attributes: # pragma no branch
|
||||
self._repos_count = self._makeIntAttribute(attributes["repos_count"])
|
||||
if "repositories_url" in attributes: # pragma no branch
|
||||
self._repositories_url = self._makeStringAttribute(attributes["repositories_url"])
|
||||
if "slug" in attributes: # pragma no branch
|
||||
self._slug = self._makeStringAttribute(attributes["slug"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
124
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/UserKey.py
vendored
Normal file
124
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/UserKey.py
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class UserKey(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents UserKeys. The reference can be found here http://developer.github.com/v3/users/keys/
|
||||
"""
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""
|
||||
:type: integer
|
||||
"""
|
||||
self._completeIfNotSet(self._id)
|
||||
return self._id.value
|
||||
|
||||
@property
|
||||
def key(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._key)
|
||||
return self._key.value
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._title)
|
||||
return self._title.value
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._url.value
|
||||
|
||||
@property
|
||||
def verified(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._verified)
|
||||
return self._verified.value
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /user/keys/:id <http://developer.github.com/v3/users/keys>`_
|
||||
:rtype: None
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /user/keys/:id <http://developer.github.com/v3/users/keys>`_
|
||||
:param title: string
|
||||
:param key: string
|
||||
:rtype: None
|
||||
"""
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key
|
||||
post_parameters = dict()
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if key is not github.GithubObject.NotSet:
|
||||
post_parameters["key"] = key
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"PATCH",
|
||||
self.url,
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._key = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._verified = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "key" in attributes: # pragma no branch
|
||||
self._key = self._makeStringAttribute(attributes["key"])
|
||||
if "title" in attributes: # pragma no branch
|
||||
self._title = self._makeStringAttribute(attributes["title"])
|
||||
if "url" in attributes: # pragma no branch
|
||||
self._url = self._makeStringAttribute(attributes["url"])
|
||||
if "verified" in attributes: # pragma no branch
|
||||
self._verified = self._makeBoolAttribute(attributes["verified"])
|
||||
50
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/__init__.py
vendored
Normal file
50
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/__init__.py
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
"""
|
||||
The primary class you will instanciate is :class:`github.MainClass.Github`.
|
||||
From its ``get_``, ``create_`` methods, you will obtain instances of all Github objects
|
||||
like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`.
|
||||
|
||||
All classes inherit from :class:`github.GithubObject.GithubObject`.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from MainClass import Github
|
||||
from GithubException import GithubException, BadCredentialsException, UnknownObjectException, BadUserAgentException, RateLimitExceededException, BadAttributeException
|
||||
from InputFileContent import InputFileContent
|
||||
from InputGitAuthor import InputGitAuthor
|
||||
from InputGitTreeElement import InputGitTreeElement
|
||||
|
||||
|
||||
def enable_console_debug_logging(): # pragma no cover (Function useful only outside test environment)
|
||||
"""
|
||||
This function sets up a very simple logging configuration (log everything on standard output) that is useful for troubleshooting.
|
||||
"""
|
||||
|
||||
logger = logging.getLogger("github")
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.addHandler(logging.StreamHandler())
|
||||
93
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/AllTests.py
vendored
Normal file
93
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/AllTests.py
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
from AuthenticatedUser import *
|
||||
from Authentication import *
|
||||
from Authorization import *
|
||||
from Branch import *
|
||||
from Commit import *
|
||||
from CommitComment import *
|
||||
from CommitStatus import *
|
||||
from ContentFile import *
|
||||
from Download import *
|
||||
from Event import *
|
||||
from Gist import *
|
||||
from GistComment import *
|
||||
from GitBlob import *
|
||||
from GitCommit import *
|
||||
from Github_ import *
|
||||
from GitRef import *
|
||||
from GitRelease import *
|
||||
from GitTag import *
|
||||
from GitTree import *
|
||||
from Hook import *
|
||||
from Issue import *
|
||||
from IssueComment import *
|
||||
from IssueEvent import *
|
||||
from Label import *
|
||||
from Milestone import *
|
||||
from NamedUser import *
|
||||
from Markdown import *
|
||||
from Organization import *
|
||||
from PullRequest import *
|
||||
from PullRequestComment import *
|
||||
from PullRequestFile import *
|
||||
from RateLimiting import *
|
||||
from Repository import *
|
||||
from RepositoryKey import *
|
||||
from Status import *
|
||||
from Tag import *
|
||||
from Team import *
|
||||
from UserKey import *
|
||||
|
||||
from PaginatedList import *
|
||||
from Exceptions import *
|
||||
from Enterprise import *
|
||||
from Logging_ import *
|
||||
from RawData import *
|
||||
from ConditionalRequestUpdate import *
|
||||
from Persistence import *
|
||||
from ExposeAllAttributes import *
|
||||
from BadAttributes import *
|
||||
from Equality import *
|
||||
from Search import *
|
||||
|
||||
from Issue33 import *
|
||||
from Issue50 import *
|
||||
from Issue54 import *
|
||||
from Issue80 import *
|
||||
from Issue87 import *
|
||||
from Issue131 import *
|
||||
from Issue133 import *
|
||||
from Issue134 import *
|
||||
from Issue139 import *
|
||||
from Issue140 import *
|
||||
from Issue142 import *
|
||||
from Issue158 import *
|
||||
from Issue174 import *
|
||||
from Issue214 import *
|
||||
from Issue216 import *
|
||||
from Issue278 import *
|
||||
232
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/AuthenticatedUser.py
vendored
Normal file
232
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/AuthenticatedUser.py
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
class AuthenticatedUser(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.user = self.g.get_user()
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png")
|
||||
self.assertEqual(self.user.bio, "")
|
||||
self.assertEqual(self.user.blog, "http://vincent-jacques.net")
|
||||
self.assertEqual(self.user.collaborators, 0)
|
||||
self.assertEqual(self.user.company, "Criteo")
|
||||
self.assertEqual(self.user.created_at, datetime.datetime(2010, 7, 9, 6, 10, 6))
|
||||
self.assertEqual(self.user.disk_usage, 16692)
|
||||
self.assertEqual(self.user.email, "vincent@vincent-jacques.net")
|
||||
self.assertEqual(self.user.followers, 13)
|
||||
self.assertEqual(self.user.following, 24)
|
||||
self.assertEqual(self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225")
|
||||
self.assertFalse(self.user.hireable)
|
||||
self.assertEqual(self.user.html_url, "https://github.com/jacquev6")
|
||||
self.assertEqual(self.user.id, 327146)
|
||||
self.assertEqual(self.user.location, "Paris, France")
|
||||
self.assertEqual(self.user.login, "jacquev6")
|
||||
self.assertEqual(self.user.name, "Vincent Jacques")
|
||||
self.assertEqual(self.user.owned_private_repos, 5)
|
||||
self.assertEqual(self.user.plan.name, "micro")
|
||||
self.assertEqual(self.user.plan.collaborators, 1)
|
||||
self.assertEqual(self.user.plan.space, 614400)
|
||||
self.assertEqual(self.user.plan.private_repos, 5)
|
||||
self.assertEqual(self.user.private_gists, 5)
|
||||
self.assertEqual(self.user.public_gists, 1)
|
||||
self.assertEqual(self.user.public_repos, 10)
|
||||
self.assertEqual(self.user.total_private_repos, 5)
|
||||
self.assertEqual(self.user.type, "User")
|
||||
self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6")
|
||||
|
||||
def testEditWithoutArguments(self):
|
||||
self.user.edit()
|
||||
|
||||
def testEditWithAllArguments(self):
|
||||
self.user.edit("Name edited by PyGithub", "Email edited by PyGithub", "Blog edited by PyGithub", "Company edited by PyGithub", "Location edited by PyGithub", True, "Bio edited by PyGithub")
|
||||
self.assertEqual(self.user.name, "Name edited by PyGithub")
|
||||
self.assertEqual(self.user.email, "Email edited by PyGithub")
|
||||
self.assertEqual(self.user.blog, "Blog edited by PyGithub")
|
||||
self.assertEqual(self.user.company, "Company edited by PyGithub")
|
||||
self.assertEqual(self.user.location, "Location edited by PyGithub")
|
||||
self.assertTrue(self.user.hireable)
|
||||
self.assertEqual(self.user.bio, "Bio edited by PyGithub")
|
||||
|
||||
def testEmails(self):
|
||||
self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "github.com@vincent-jacques.net"])
|
||||
self.user.add_to_emails("1@foobar.com", "2@foobar.com")
|
||||
self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "1@foobar.com", "2@foobar.com", "github.com@vincent-jacques.net"])
|
||||
self.user.remove_from_emails("1@foobar.com", "2@foobar.com")
|
||||
self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "github.com@vincent-jacques.net"])
|
||||
|
||||
def testFollowing(self):
|
||||
nvie = self.g.get_user("nvie")
|
||||
self.assertListKeyEqual(self.user.get_following(), lambda u: u.login, ["schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa", "nvie"])
|
||||
self.assertTrue(self.user.has_in_following(nvie))
|
||||
self.user.remove_from_following(nvie)
|
||||
self.assertFalse(self.user.has_in_following(nvie))
|
||||
self.user.add_to_following(nvie)
|
||||
self.assertTrue(self.user.has_in_following(nvie))
|
||||
self.assertListKeyEqual(self.user.get_followers(), lambda u: u.login, ["jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y"])
|
||||
|
||||
def testWatching(self):
|
||||
gitflow = self.g.get_user("nvie").get_repo("gitflow")
|
||||
self.assertListKeyEqual(self.user.get_watched(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub"])
|
||||
self.assertTrue(self.user.has_in_watched(gitflow))
|
||||
self.user.remove_from_watched(gitflow)
|
||||
self.assertFalse(self.user.has_in_watched(gitflow))
|
||||
self.user.add_to_watched(gitflow)
|
||||
self.assertTrue(self.user.has_in_watched(gitflow))
|
||||
|
||||
def testStarring(self):
|
||||
gitflow = self.g.get_user("nvie").get_repo("gitflow")
|
||||
self.assertListKeyEqual(self.user.get_starred(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly"])
|
||||
self.assertTrue(self.user.has_in_starred(gitflow))
|
||||
self.user.remove_from_starred(gitflow)
|
||||
self.assertFalse(self.user.has_in_starred(gitflow))
|
||||
self.user.add_to_starred(gitflow)
|
||||
self.assertTrue(self.user.has_in_starred(gitflow))
|
||||
|
||||
def testSubscriptions(self):
|
||||
gitflow = self.g.get_user("nvie").get_repo("gitflow")
|
||||
self.assertListKeyEqual(self.user.get_subscriptions(), lambda r: r.name, ["gitflow", "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub"])
|
||||
self.assertTrue(self.user.has_in_subscriptions(gitflow))
|
||||
self.user.remove_from_subscriptions(gitflow)
|
||||
self.assertFalse(self.user.has_in_subscriptions(gitflow))
|
||||
self.user.add_to_subscriptions(gitflow)
|
||||
self.assertTrue(self.user.has_in_subscriptions(gitflow))
|
||||
|
||||
def testGetAuthorizations(self):
|
||||
self.assertListKeyEqual(self.user.get_authorizations(), lambda a: a.id, [372294])
|
||||
|
||||
def testCreateRepository(self):
|
||||
repo = self.user.create_repo("TestPyGithub")
|
||||
self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
|
||||
|
||||
def testCreateRepositoryWithAllArguments(self):
|
||||
repo = self.user.create_repo("TestPyGithub", "Repo created by PyGithub", "http://foobar.com", private=False, has_issues=False, has_wiki=False, has_downloads=False)
|
||||
self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
|
||||
|
||||
def testCreateRepositoryWithAutoInit(self):
|
||||
repo = self.user.create_repo("TestPyGithub", auto_init=True, gitignore_template="Python")
|
||||
self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
|
||||
|
||||
def testCreateAuthorizationWithoutArguments(self):
|
||||
authorization = self.user.create_authorization()
|
||||
self.assertEqual(authorization.id, 372259)
|
||||
|
||||
def testCreateAuthorizationWithAllArguments(self):
|
||||
authorization = self.user.create_authorization(["repo"], "Note created by PyGithub", "http://vincent-jacques.net/PyGithub")
|
||||
self.assertEqual(authorization.id, 372294)
|
||||
|
||||
def testCreateAuthorizationWithClientIdAndSecret(self):
|
||||
# I don't have a client_id and client_secret so the ReplayData for this test is forged
|
||||
authorization = self.user.create_authorization(client_id="01234567890123456789", client_secret="0123456789012345678901234567890123456789")
|
||||
self.assertEqual(authorization.id, 372294)
|
||||
|
||||
def testCreateGist(self):
|
||||
gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}, "Gist created by PyGithub")
|
||||
self.assertEqual(gist.description, "Gist created by PyGithub")
|
||||
self.assertEqual(gist.files.keys(), ["foobar.txt"])
|
||||
self.assertEqual(gist.files["foobar.txt"].content, "File created by PyGithub")
|
||||
|
||||
def testCreateGistWithoutDescription(self):
|
||||
gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")})
|
||||
self.assertEqual(gist.description, None)
|
||||
self.assertEqual(gist.files.keys(), ["foobar.txt"])
|
||||
self.assertEqual(gist.files["foobar.txt"].content, "File created by PyGithub")
|
||||
|
||||
def testCreateKey(self):
|
||||
key = self.user.create_key("Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE")
|
||||
self.assertEqual(key.id, 2626650)
|
||||
|
||||
def testGetEvents(self):
|
||||
self.assertListKeyBegin(self.user.get_events(), lambda e: e.type, ["PushEvent", "IssuesEvent", "IssueCommentEvent", "PushEvent"])
|
||||
|
||||
def testGetOrganizationEvents(self):
|
||||
self.assertListKeyBegin(self.user.get_organization_events(self.g.get_organization("BeaverSoftware")), lambda e: e.type, ["CreateEvent", "CreateEvent", "PushEvent", "PushEvent"])
|
||||
|
||||
def testGetGists(self):
|
||||
self.assertListKeyEqual(self.user.get_gists(), lambda g: g.id, ["2793505", "2793179", "11cb445f8197e17d303d", "1942384", "dcb7de17e8a52b74541d"])
|
||||
|
||||
def testGetStarredGists(self):
|
||||
self.assertListKeyEqual(self.user.get_starred_gists(), lambda g: g.id, ["1942384", "dcb7de17e8a52b74541d"])
|
||||
|
||||
def testGetIssues(self):
|
||||
self.assertListKeyEqual(self.user.get_issues(), lambda i: (i.id, i.repository.name), [(4639931, "PyGithub"), (4452000, "PyGithub"), (4356743, "PyGithub"), (3716033, "PyGithub"), (3715946, "PyGithub"), (3643837, "PyGithub"), (3628022, "PyGithub"), (3624595, "PyGithub"), (3624570, "PyGithub"), (3624561, "PyGithub"), (3624556, "PyGithub"), (3619973, "PyGithub"), (3527266, "PyGithub"), (3527245, "PyGithub"), (3527231, "PyGithub")])
|
||||
|
||||
def testGetIssuesWithAllArguments(self):
|
||||
requestedByUser = self.user.get_repo("PyGithub").get_label("Requested by user")
|
||||
issues = self.user.get_issues("assigned", "closed", [requestedByUser], "comments", "asc", datetime.datetime(2012, 5, 28, 23, 0, 0))
|
||||
self.assertListKeyEqual(issues, lambda i: i.id, [6816576, 8495415, 6889934, 8339699, 8075253, 8033963, 9089893, 9489725, 11746141, 5152384, 5177381, 5783131, 6454054, 6641076, 6653907, 7331214, 9489813, 9776615, 10360280, 4356743, 6583381, 6751469, 8189836, 10758585, 12097154, 12867103, 5191621, 5256315, 6363719, 9209408, 6912733, 9948505, 11503771, 10922412, 11844658, 12566144, 6353712, 9323084, 10379143, 5387373, 12179668, 6911794, 11731917, 6807542, 6780606])
|
||||
|
||||
def testGetUserIssues(self):
|
||||
self.assertListKeyEqual(self.user.get_user_issues(), lambda i: i.id, [14447880, 13505356, 12541184, 10586808, 6741461, 6741457, 6727331, 5641572])
|
||||
|
||||
def testGetUserIssuesWithAllArguments(self):
|
||||
requestedByUser = self.user.get_repo("PyGithub").get_label("Requested by user")
|
||||
issues = self.user.get_user_issues("assigned", "closed", [requestedByUser], "comments", "asc", datetime.datetime(2012, 5, 28, 23, 0, 0))
|
||||
self.assertListKeyEqual(issues, lambda i: i.id, [6816576, 8495415, 6889934, 8339699, 8075253, 8033963, 9089893, 9489725, 11746141, 5152384, 5177381, 5783131, 6454054, 6641076, 6653907, 7331214, 9489813, 9776615, 10360280, 4356743, 6583381, 6751469, 8189836, 10758585, 12097154, 12867103, 5191621, 5256315, 6363719, 9209408, 6912733, 9948505, 11503771, 10922412, 11844658, 12566144, 6353712, 9323084, 10379143, 5387373, 12179668, 6911794, 11731917, 6807542, 6780606])
|
||||
|
||||
def testGetKeys(self):
|
||||
self.assertListKeyEqual(self.user.get_keys(), lambda k: k.title, ["vincent@home", "vincent@gandi", "vincent@aws", "vincent@macbook"])
|
||||
|
||||
def testGetOrgs(self):
|
||||
self.assertListKeyEqual(self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"])
|
||||
|
||||
def testGetRepos(self):
|
||||
self.assertListKeyEqual(self.user.get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
|
||||
|
||||
def testGetReposWithArguments(self):
|
||||
self.assertListKeyEqual(self.user.get_repos("public", "full_name", "desc"), lambda r: r.name, ["ViDE", "QuadProgMm", "PyGithub", "DrawTurksHead", "DrawSyntax", "django", "developer.github.com", "C4Planner", "Boost.HierarchicalEnum", "acme-public-website"])
|
||||
|
||||
def testCreateFork(self):
|
||||
repo = self.user.create_fork(self.g.get_user("nvie").get_repo("gitflow"))
|
||||
self.assertEqual(repo.source.full_name, "nvie/gitflow")
|
||||
|
||||
def testGetNotification(self):
|
||||
notification = self.user.get_notification("8406712")
|
||||
self.assertEqual(notification.id, "8406712")
|
||||
self.assertEqual(notification.unread, False)
|
||||
self.assertEqual(notification.reason, "author")
|
||||
self.assertEqual(notification.subject.title, "Feature/coveralls")
|
||||
self.assertEqual(notification.subject.type, "PullRequest")
|
||||
self.assertEqual(notification.repository.id, 8432784)
|
||||
self.assertEqual(notification.updated_at, datetime.datetime(2013, 3, 15, 5, 43, 11))
|
||||
self.assertEqual(notification.url, None)
|
||||
self.assertEqual(notification.subject.url, None)
|
||||
self.assertEqual(notification.subject.latest_comment_url, None)
|
||||
|
||||
def testGetNotifications(self):
|
||||
self.assertListKeyEqual(self.user.get_notifications(participating=True), lambda n: n.id, ["8406712"])
|
||||
|
||||
def testGetNotificationsWithOtherArguments(self):
|
||||
self.assertListKeyEqual(self.user.get_notifications(all=True), lambda n: n.id, [])
|
||||
|
||||
def testGetTeams(self):
|
||||
self.assertListKeyEqual(self.user.get_teams(), lambda t: t.name, ["Owners", "Honoraries", "Honoraries", "Honoraries", "Honoraries", "Honoraries", "Honoraries", "Honoraries", "Honoraries", "Honoraries"])
|
||||
66
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Authentication.py
vendored
Normal file
66
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Authentication.py
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
class Authentication(Framework.BasicTestCase):
|
||||
def testNoAuthentication(self):
|
||||
g = github.Github()
|
||||
self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
|
||||
|
||||
def testBasicAuthentication(self):
|
||||
g = github.Github(self.login, self.password)
|
||||
self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
|
||||
|
||||
def testOAuthAuthentication(self):
|
||||
g = github.Github(self.oauth_token)
|
||||
self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
|
||||
|
||||
# Warning: I don't have a scret key, so the requests for this test are forged
|
||||
def testSecretKeyAuthentication(self):
|
||||
g = github.Github(client_id=self.client_id, client_secret=self.client_secret)
|
||||
self.assertListKeyEqual(g.get_organization("BeaverSoftware").get_repos("public"), lambda r: r.name, ["FatherBeaver", "PyGithub"])
|
||||
|
||||
def testUserAgent(self):
|
||||
g = github.Github(user_agent="PyGithubTester")
|
||||
self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
|
||||
|
||||
def testAuthorizationHeaderWithLogin(self):
|
||||
# See special case in Framework.fixAuthorizationHeader
|
||||
g = github.Github("fake_login", "fake_password")
|
||||
try:
|
||||
g.get_user().name
|
||||
except github.GithubException:
|
||||
pass
|
||||
|
||||
def testAuthorizationHeaderWithToken(self):
|
||||
# See special case in Framework.fixAuthorizationHeader
|
||||
g = github.Github("ZmFrZV9sb2dpbjpmYWtlX3Bhc3N3b3Jk")
|
||||
try:
|
||||
g.get_user().name
|
||||
except github.GithubException:
|
||||
pass
|
||||
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Authorization.py
vendored
Normal file
64
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Authorization.py
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class Authorization(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.authorization = self.g.get_user().get_authorization(372259)
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.authorization.app.url, "http://developer.github.com/v3/oauth/#oauth-authorizations-api")
|
||||
self.assertEqual(self.authorization.app.name, "GitHub API")
|
||||
self.assertEqual(self.authorization.created_at, datetime.datetime(2012, 5, 22, 18, 3, 17))
|
||||
self.assertEqual(self.authorization.id, 372259)
|
||||
self.assertEqual(self.authorization.note, None)
|
||||
self.assertEqual(self.authorization.note_url, None)
|
||||
self.assertEqual(self.authorization.scopes, [])
|
||||
self.assertEqual(self.authorization.token, "82459c4500086f8f0cc67d2936c17d1e27ad1c33")
|
||||
self.assertEqual(self.authorization.updated_at, datetime.datetime(2012, 5, 22, 18, 3, 17))
|
||||
self.assertEqual(self.authorization.url, "https://api.github.com/authorizations/372259")
|
||||
|
||||
def testEdit(self):
|
||||
self.authorization.edit()
|
||||
self.assertEqual(self.authorization.scopes, [])
|
||||
self.authorization.edit(scopes=["user"])
|
||||
self.assertEqual(self.authorization.scopes, ["user"])
|
||||
self.authorization.edit(add_scopes=["repo"])
|
||||
self.assertEqual(self.authorization.scopes, ["user", "repo"])
|
||||
self.authorization.edit(remove_scopes=["repo"])
|
||||
self.assertEqual(self.authorization.scopes, ["user"])
|
||||
self.assertEqual(self.authorization.note, None)
|
||||
self.assertEqual(self.authorization.note_url, None)
|
||||
self.authorization.edit(note="Note created by PyGithub", note_url="http://vincent-jacques.net/PyGithub")
|
||||
self.assertEqual(self.authorization.note, "Note created by PyGithub")
|
||||
self.assertEqual(self.authorization.note_url, "http://vincent-jacques.net/PyGithub")
|
||||
|
||||
def testDelete(self):
|
||||
self.authorization.delete()
|
||||
149
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/BadAttributes.py
vendored
Normal file
149
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/BadAttributes.py
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
# Replay data is forged to simulate bad things returned by Github
|
||||
class BadAttributes(Framework.TestCase):
|
||||
def testBadSimpleAttribute(self):
|
||||
user = self.g.get_user("klmitch")
|
||||
self.assertEqual(user.created_at, datetime.datetime(2011, 3, 23, 15, 42, 9))
|
||||
|
||||
raised = False
|
||||
try:
|
||||
user.name
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, 42)
|
||||
self.assertEqual(e.expected_type, (str, unicode))
|
||||
self.assertEqual(e.transformation_exception, None)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadAttributeTransformation(self):
|
||||
user = self.g.get_user("klmitch")
|
||||
self.assertEqual(user.name, "Kevin L. Mitchell")
|
||||
|
||||
raised = False
|
||||
try:
|
||||
user.created_at
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, "foobar")
|
||||
self.assertEqual(e.expected_type, (str, unicode))
|
||||
self.assertEqual(e.transformation_exception.__class__, ValueError)
|
||||
if Framework.atLeastPython26:
|
||||
self.assertEqual(e.transformation_exception.args, ("time data 'foobar' does not match format '%Y-%m-%dT%H:%M:%SZ'",))
|
||||
else:
|
||||
self.assertEqual(e.transformation_exception.args, ('time data did not match format: data=foobar fmt=%Y-%m-%dT%H:%M:%SZ',))
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadTransformedAttribute(self):
|
||||
user = self.g.get_user("klmitch")
|
||||
self.assertEqual(user.name, "Kevin L. Mitchell")
|
||||
|
||||
raised = False
|
||||
try:
|
||||
user.updated_at
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, 42)
|
||||
self.assertEqual(e.expected_type, (str, unicode))
|
||||
self.assertEqual(e.transformation_exception, None)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadSimpleAttributeInList(self):
|
||||
hook = self.g.get_hook("activecollab")
|
||||
self.assertEqual(hook.name, "activecollab")
|
||||
|
||||
raised = False
|
||||
try:
|
||||
hook.events
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, ["push", 42])
|
||||
self.assertEqual(e.expected_type, [(str, unicode)])
|
||||
self.assertEqual(e.transformation_exception, None)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadAttributeInClassAttribute(self):
|
||||
repo = self.g.get_repo("klmitch/turnstile")
|
||||
owner = repo.owner
|
||||
self.assertEqual(owner.id, 686398)
|
||||
|
||||
raised = False
|
||||
try:
|
||||
owner.avatar_url
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, 42)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadTransformedAttributeInList(self):
|
||||
commit = self.g.get_repo("klmitch/turnstile").get_commit("38d9082a898d0822b5ccdfd78f3a536e2efa6c26")
|
||||
|
||||
raised = False
|
||||
try:
|
||||
commit.files
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, [42])
|
||||
self.assertEqual(e.expected_type, [dict])
|
||||
self.assertEqual(e.transformation_exception, None)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadTransformedAttributeInDict(self):
|
||||
gist = self.g.get_gist("6437766")
|
||||
|
||||
raised = False
|
||||
try:
|
||||
gist.files
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, {"test.py": 42})
|
||||
self.assertEqual(e.expected_type, {(str, unicode): dict})
|
||||
self.assertEqual(e.transformation_exception, None)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testIssue195(self):
|
||||
hooks = self.g.get_hooks()
|
||||
# We can loop on all hooks as long as we don't access circleci's events attribute
|
||||
self.assertListKeyEqual(hooks, lambda h: h.name, [u'activecollab', u'acunote', u'agilebench', u'agilezen', u'amazonsns', u'apiary', u'apoio', u'appharbor', u'apropos', u'asana', u'backlog', u'bamboo', u'basecamp', u'bcx', u'blimp', u'boxcar', u'buddycloud', u'bugherd', u'bugly', u'bugzilla', u'campfire', u'cia', u'circleci', u'codeclimate', u'codeportingcsharp2java', u'codeship', u'coffeedocinfo', u'conductor', u'coop', u'copperegg', u'cube', u'depending', u'deployhq', u'devaria', u'docker', u'ducksboard', u'email', u'firebase', u'fisheye', u'flowdock', u'fogbugz', u'freckle', u'friendfeed', u'gemini', u'gemnasium', u'geocommit', u'getlocalization', u'gitlive', u'grmble', u'grouptalent', u'grove', u'habitualist', u'hakiri', u'hall', u'harvest', u'hipchat', u'hostedgraphite', u'hubcap', u'hubci', u'humbug', u'icescrum', u'irc', u'irker', u'ironmq', u'ironworker', u'jabber', u'jaconda', u'jeapie', u'jenkins', u'jenkinsgit', u'jira', u'jqueryplugins', u'kanbanery', u'kickoff', u'leanto', u'lechat', u'lighthouse', u'lingohub', u'loggly', u'mantisbt', u'masterbranch', u'mqttpub', u'nma', u'nodejitsu', u'notifo', u'ontime', u'pachube', u'packagist', u'phraseapp', u'pivotaltracker', u'planbox', u'planio', u'prowl', u'puppetlinter', u'pushalot', u'pushover', u'pythonpackages', u'railsbp', u'railsbrakeman', u'rally', u'rapidpush', u'rationaljazzhub', u'rationalteamconcert', u'rdocinfo', u'readthedocs', u'redmine', u'rubyforge', u'scrumdo', u'shiningpanda', u'sifter', u'simperium', u'slatebox', u'snowyevening', u'socialcast', u'softlayermessaging', u'sourcemint', u'splendidbacon', u'sprintly', u'sqsqueue', u'stackmob', u'statusnet', u'talker', u'targetprocess', u'tddium', u'teamcity', u'tender', u'tenxer', u'testpilot', u'toggl', u'trac', u'trajectory', u'travis', u'trello', u'twilio', u'twitter', u'unfuddle', u'web', u'weblate', u'webtranslateit', u'yammer', u'youtrack', u'zendesk', u'zohoprojects'])
|
||||
for hook in hooks:
|
||||
if hook.name != "circleci":
|
||||
hook.events
|
||||
|
||||
raised = False
|
||||
for hook in hooks:
|
||||
if hook.name == "circleci":
|
||||
try:
|
||||
hook.events
|
||||
except github.BadAttributeException, e:
|
||||
raised = True
|
||||
self.assertEqual(e.actual_value, [["commit_comment", "create", "delete", "download", "follow", "fork", "fork_apply", "gist", "gollum", "issue_comment", "issues", "member", "public", "pull_request", "pull_request_review_comment", "push", "status", "team_add", "watch"]])
|
||||
self.assertEqual(e.expected_type, [(str, unicode)])
|
||||
self.assertEqual(e.transformation_exception, None)
|
||||
self.assertTrue(raised)
|
||||
36
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Branch.py
vendored
Normal file
36
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Branch.py
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class Branch(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.branch = self.g.get_user().get_repo("PyGithub").get_branches()[0]
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.branch.name, "topic/RewriteWithGeneratedCode")
|
||||
self.assertEqual(self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
93
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Commit.py
vendored
Normal file
93
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Commit.py
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class Commit(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.commit = self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
self.commit.author.login # to force lazy completion
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.commit.author.login, "jacquev6")
|
||||
self.assertEqual(self.commit.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
self.assertEqual(self.commit.committer.login, "jacquev6")
|
||||
self.assertEqual(len(self.commit.files), 1)
|
||||
self.assertEqual(self.commit.files[0].additions, 0)
|
||||
self.assertEqual(self.commit.files[0].blob_url, "https://github.com/jacquev6/PyGithub/blob/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py")
|
||||
self.assertEqual(self.commit.files[0].changes, 20)
|
||||
self.assertEqual(self.commit.files[0].deletions, 20)
|
||||
self.assertEqual(self.commit.files[0].filename, "github/GithubObjects/GitAuthor.py")
|
||||
self.assertTrue(isinstance(self.commit.files[0].patch, (str, unicode)))
|
||||
self.assertEqual(self.commit.files[0].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py")
|
||||
self.assertEqual(self.commit.files[0].sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
self.assertEqual(self.commit.files[0].status, "modified")
|
||||
self.assertEqual(len(self.commit.parents), 1)
|
||||
self.assertEqual(self.commit.parents[0].sha, "b46ed0dfde5ad02d3b91eb54a41c5ed960710eae")
|
||||
self.assertEqual(self.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
self.assertEqual(self.commit.stats.deletions, 20)
|
||||
self.assertEqual(self.commit.stats.additions, 0)
|
||||
self.assertEqual(self.commit.stats.total, 20)
|
||||
self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
|
||||
def testGetComments(self):
|
||||
self.assertListKeyEqual(self.commit.get_comments(), lambda c: c.id, [1347033, 1347083, 1347397, 1349654])
|
||||
|
||||
def testCreateComment(self):
|
||||
comment = self.commit.create_comment("Comment created by PyGithub")
|
||||
self.assertEqual(comment.id, 1361949)
|
||||
self.assertEqual(comment.line, None)
|
||||
self.assertEqual(comment.path, None)
|
||||
self.assertEqual(comment.position, None)
|
||||
|
||||
def testCreateCommentOnFileLine(self):
|
||||
comment = self.commit.create_comment("Comment created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", line=26)
|
||||
self.assertEqual(comment.id, 1362000)
|
||||
self.assertEqual(comment.line, 26)
|
||||
self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py")
|
||||
self.assertEqual(comment.position, None)
|
||||
|
||||
def testCreateCommentOnFilePosition(self):
|
||||
comment = self.commit.create_comment("Comment also created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", position=3)
|
||||
self.assertEqual(comment.id, 1362001)
|
||||
self.assertEqual(comment.line, None)
|
||||
self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py")
|
||||
self.assertEqual(comment.position, 3)
|
||||
|
||||
def testCreateStatusWithoutOptionalParameters(self):
|
||||
status = self.commit.create_status("pending")
|
||||
self.assertEqual(status.id, 277031)
|
||||
self.assertEqual(status.state, "pending")
|
||||
self.assertEqual(status.target_url, None)
|
||||
self.assertEqual(status.description, None)
|
||||
|
||||
def testCreateStatusWithAllParameters(self):
|
||||
status = self.commit.create_status("success", "https://github.com/jacquev6/PyGithub/issues/67", "Status successfuly created by PyGithub")
|
||||
self.assertEqual(status.id, 277040)
|
||||
self.assertEqual(status.state, "success")
|
||||
self.assertEqual(status.target_url, "https://github.com/jacquev6/PyGithub/issues/67")
|
||||
self.assertEqual(status.description, "Status successfuly created by PyGithub")
|
||||
53
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/CommitComment.py
vendored
Normal file
53
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/CommitComment.py
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class CommitComment(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.comment = self.g.get_user().get_repo("PyGithub").get_comment(1361949)
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.comment.body, "Comment created by PyGithub")
|
||||
self.assertEqual(self.comment.commit_id, "6945921c529be14c3a8f566dd1e483674516d46d")
|
||||
self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 22, 18, 40, 18))
|
||||
self.assertEqual(self.comment.html_url, "https://github.com/jacquev6/PyGithub/commit/6945921c529be14c3a8f566dd1e483674516d46d#commitcomment-1361949")
|
||||
self.assertEqual(self.comment.id, 1361949)
|
||||
self.assertEqual(self.comment.line, None)
|
||||
self.assertEqual(self.comment.path, None)
|
||||
self.assertEqual(self.comment.position, None)
|
||||
self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 22, 18, 40, 18))
|
||||
self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1361949")
|
||||
self.assertEqual(self.comment.user.login, "jacquev6")
|
||||
|
||||
def testEdit(self):
|
||||
self.comment.edit("Comment edited by PyGithub")
|
||||
|
||||
def testDelete(self):
|
||||
self.comment.delete()
|
||||
47
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/CommitStatus.py
vendored
Normal file
47
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/CommitStatus.py
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
class CommitStatus(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.statuses = list(self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a").get_statuses())
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.statuses[0].created_at, datetime.datetime(2012, 9, 8, 11, 30, 56))
|
||||
self.assertEqual(self.statuses[0].updated_at, datetime.datetime(2012, 9, 8, 11, 30, 56))
|
||||
self.assertEqual(self.statuses[0].creator.login, "jacquev6")
|
||||
self.assertEqual(self.statuses[0].description, "Status successfuly created by PyGithub")
|
||||
self.assertEqual(self.statuses[1].description, None)
|
||||
self.assertEqual(self.statuses[0].id, 277040)
|
||||
self.assertEqual(self.statuses[0].state, "success")
|
||||
self.assertEqual(self.statuses[1].state, "pending")
|
||||
self.assertEqual(self.statuses[0].target_url, "https://github.com/jacquev6/PyGithub/issues/67")
|
||||
self.assertEqual(self.statuses[1].target_url, None)
|
||||
44
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/ConditionalRequestUpdate.py
vendored
Normal file
44
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/ConditionalRequestUpdate.py
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
# #193: Line endings should be linux style
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
class ConditionalRequestUpdate(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.repo = self.g.get_repo("akfish/PyGithub", lazy=False)
|
||||
|
||||
def testDidNotUpdate(self):
|
||||
self.assertFalse(self.repo.update(), msg="The repo is not changed. But update() != False")
|
||||
|
||||
def testDidUpdate(self):
|
||||
self.assertTrue(self.repo.update(), msg="The repo should be changed by now. But update() != True")
|
||||
|
||||
def testUpdateObjectWithoutEtag(self):
|
||||
r = self.g.get_repo("jacquev6/PyGithub", lazy=False)
|
||||
self.assertTrue(r.update())
|
||||
45
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/ContentFile.py
vendored
Normal file
45
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/ContentFile.py
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
class ContentFile(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.file = self.g.get_user().get_repo("PyGithub").get_readme()
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.file.type, "file")
|
||||
self.assertEqual(self.file.encoding, "base64")
|
||||
self.assertEqual(self.file.size, 7531)
|
||||
self.assertEqual(self.file.name, "ReadMe.md")
|
||||
self.assertEqual(self.file.path, "ReadMe.md")
|
||||
self.assertEqual(len(self.file.content), 10212)
|
||||
self.assertEqual(len(self.file.decoded_content), 7531)
|
||||
self.assertEqual(self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0")
|
||||
59
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Download.py
vendored
Normal file
59
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Download.py
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class Download(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.download = self.g.get_user().get_repo("PyGithub").get_download(242550)
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.download.accesskeyid, None)
|
||||
self.assertEqual(self.download.acl, None)
|
||||
self.assertEqual(self.download.bucket, None)
|
||||
self.assertEqual(self.download.content_type, "text/plain")
|
||||
self.assertEqual(self.download.created_at, datetime.datetime(2012, 5, 22, 18, 58, 32))
|
||||
self.assertEqual(self.download.description, None)
|
||||
self.assertEqual(self.download.download_count, 0)
|
||||
self.assertEqual(self.download.expirationdate, None)
|
||||
self.assertEqual(self.download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt")
|
||||
self.assertEqual(self.download.id, 242550)
|
||||
self.assertEqual(self.download.mime_type, None)
|
||||
self.assertEqual(self.download.name, "Foobar.txt")
|
||||
self.assertEqual(self.download.path, None)
|
||||
self.assertEqual(self.download.policy, None)
|
||||
self.assertEqual(self.download.prefix, None)
|
||||
self.assertEqual(self.download.redirect, None)
|
||||
self.assertEqual(self.download.s3_url, None)
|
||||
self.assertEqual(self.download.signature, None)
|
||||
self.assertEqual(self.download.size, 1024)
|
||||
self.assertEqual(self.download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550")
|
||||
|
||||
def testDelete(self):
|
||||
self.download.delete()
|
||||
57
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Enterprise.py
vendored
Normal file
57
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Enterprise.py
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
# Replay data for this test case is forged, because I don't have access to a real Github Enterprise install
|
||||
class Enterprise(Framework.BasicTestCase):
|
||||
def testHttps(self):
|
||||
g = github.Github(self.login, self.password, base_url="https://my.enterprise.com")
|
||||
self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
|
||||
|
||||
def testHttp(self):
|
||||
g = github.Github(self.login, self.password, base_url="http://my.enterprise.com")
|
||||
self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
|
||||
|
||||
def testUnknownUrlScheme(self): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
|
||||
try:
|
||||
github.Github(self.login, self.password, base_url="foobar://my.enterprise.com")
|
||||
except AssertionError as exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.args[0], "Unknown URL scheme")
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testLongUrl(self):
|
||||
g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/path/to/github")
|
||||
repos = g.get_user().get_repos()
|
||||
self.assertListKeyEqual(repos, lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
|
||||
self.assertEqual(repos[0].owner.name, "Vincent Jacques")
|
||||
|
||||
def testSpecificPort(self):
|
||||
g = github.Github(self.login, self.password, base_url="http://my.enterprise.com:8080")
|
||||
self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
|
||||
49
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Equality.py
vendored
Normal file
49
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Equality.py
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class Equality(Framework.TestCase):
|
||||
def testUserEquality(self):
|
||||
u1 = self.g.get_user("jacquev6")
|
||||
u2 = self.g.get_user("jacquev6")
|
||||
self.assertTrue(u1 == u2)
|
||||
self.assertFalse(u1 != u2)
|
||||
self.assertEqual(u1, u2)
|
||||
|
||||
def testUserDifference(self):
|
||||
u1 = self.g.get_user("jacquev6")
|
||||
u2 = self.g.get_user("OddBloke")
|
||||
self.assertFalse(u1 == u2)
|
||||
self.assertTrue(u1 != u2)
|
||||
self.assertNotEqual(u1, u2)
|
||||
|
||||
def testBranchEquality(self):
|
||||
# Erf, equality of NonCompletableGithubObjects will be difficult to implement
|
||||
# because even their _rawData can differ. (Here, the avatar_url is not equal)
|
||||
# (CompletableGithubObjects are compared by their API url, which is a good key)
|
||||
r = self.g.get_user().get_repo("PyGithub")
|
||||
b1 = r.get_branch("develop")
|
||||
b2 = r.get_branch("develop")
|
||||
self.assertNotEqual(b1._rawData, b2._rawData)
|
||||
44
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Event.py
vendored
Normal file
44
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Event.py
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class Event(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.event = self.g.get_user("jacquev6").get_events()[0]
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.event.actor.login, "jacquev6")
|
||||
self.assertEqual(self.event.created_at, datetime.datetime(2012, 5, 26, 10, 1, 39))
|
||||
self.assertEqual(self.event.id, "1556114751")
|
||||
self.assertEqual(self.event.org, None)
|
||||
self.assertEqual(self.event.payload, {'commits': [{'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/5bb654d26dd014d36794acd1e6ecf3736f12aad7', 'sha': '5bb654d26dd014d36794acd1e6ecf3736f12aad7', 'message': 'Implement the three authentication schemes', 'distinct': False, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/cb0313157bf904f2d364377d35d9397b269547a5', 'sha': 'cb0313157bf904f2d364377d35d9397b269547a5', 'message': "Merge branch 'topic/Authentication' into develop", 'distinct': False, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/0cec0d25e606c023a62a4fc7cdc815309ebf6d16', 'sha': '0cec0d25e606c023a62a4fc7cdc815309ebf6d16', 'message': 'Publish version 0.7', 'distinct': False, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', 'sha': 'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', 'message': "Merge branch 'develop'", 'distinct': False, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/3a3bf4763192ee1234eb0557628133e06f3dfc76', 'sha': '3a3bf4763192ee1234eb0557628133e06f3dfc76', 'message': "Merge branch 'master' into topic/RewriteWithGeneratedCode\n\nConflicts:\n\tgithub/Github.py\n\tgithub/Requester.py", 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/608f17794664f61693a3dc05e6056fea8fbef0ff', 'sha': '608f17794664f61693a3dc05e6056fea8fbef0ff', 'message': 'Restore some form of Authorization header in replay data', 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/2c04b8adbd91d38eef4f0767337ab7a12b2f684b', 'sha': '2c04b8adbd91d38eef4f0767337ab7a12b2f684b', 'message': 'Allow test without pre-set-up Github', 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/5b97389988b6fe43e15a079702f6f1671257fb28', 'sha': '5b97389988b6fe43e15a079702f6f1671257fb28', 'message': 'Test three authentication schemes', 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/12747613c5ec00deccf296b8619ad507f7050475', 'sha': '12747613c5ec00deccf296b8619ad507f7050475', 'message': 'Test Issue.getComments', 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/2982fa96c5ca75abe717d974d83f9135d664232e', 'sha': '2982fa96c5ca75abe717d974d83f9135d664232e', 'message': 'Test the new Repository.full_name attribute', 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}, {'url': 'https://api.github.com/repos/jacquev6/PyGithub/commits/619eae8d51c5988f0d2889fc767fa677438ba95d', 'sha': '619eae8d51c5988f0d2889fc767fa677438ba95d', 'message': 'Improve coverage of AuthenticatedUser', 'distinct': True, 'author': {'name': 'Vincent Jacques', 'email': 'vincent@vincent-jacques.net'}}], 'head': '619eae8d51c5988f0d2889fc767fa677438ba95d', 'push_id': 80673538, 'ref': 'refs/heads/topic/RewriteWithGeneratedCode', 'size': 11})
|
||||
self.assertTrue(self.event.public)
|
||||
self.assertEqual(self.event.repo.name, "jacquev6/PyGithub")
|
||||
self.assertEqual(self.event.type, "PushEvent")
|
||||
135
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Exceptions.py
vendored
Normal file
135
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Exceptions.py
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import github
|
||||
import sys
|
||||
|
||||
import Framework
|
||||
|
||||
atLeastPython26 = sys.hexversion >= 0x02060000
|
||||
atMostPython2 = sys.hexversion < 0x03000000
|
||||
|
||||
|
||||
class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
|
||||
def testInvalidInput(self):
|
||||
raised = False
|
||||
try:
|
||||
self.g.get_user().create_key("Bad key", "xxx")
|
||||
except github.GithubException, exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 422)
|
||||
self.assertEqual(
|
||||
exception.data,
|
||||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": "custom",
|
||||
"field": "key",
|
||||
"message": "key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key",
|
||||
"resource": "PublicKey"
|
||||
}
|
||||
],
|
||||
"message": "Validation Failed"
|
||||
}
|
||||
)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testNonJsonDataReturnedByGithub(self):
|
||||
# Replay data was forged according to https://github.com/jacquev6/PyGithub/pull/182
|
||||
raised = False
|
||||
try:
|
||||
self.g.get_user("jacquev6")
|
||||
except github.GithubException, exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 503)
|
||||
self.assertEqual(
|
||||
exception.data,
|
||||
{
|
||||
"data": "<html><body><h1>503 Service Unavailable</h1>No server is available to handle this request.</body></html>",
|
||||
}
|
||||
)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testUnknownObject(self):
|
||||
raised = False
|
||||
try:
|
||||
self.g.get_user().get_repo("Xxx")
|
||||
except github.GithubException, exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 404)
|
||||
self.assertEqual(exception.data, {"message": "Not Found"})
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover (Covered with Python 3)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testUnknownUser(self):
|
||||
raised = False
|
||||
try:
|
||||
self.g.get_user("ThisUserShouldReallyNotExist")
|
||||
except github.GithubException, exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 404)
|
||||
self.assertEqual(exception.data, {"message": "Not Found"})
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover (Covered with Python 3)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testBadAuthentication(self):
|
||||
raised = False
|
||||
try:
|
||||
github.Github("BadUser", "BadPassword").get_user().login
|
||||
except github.GithubException, exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 401)
|
||||
self.assertEqual(exception.data, {"message": "Bad credentials"})
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "401 {u'message': u'Bad credentials'}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "401 {'message': 'Bad credentials'}") # pragma no cover (Covered with Python 3)
|
||||
self.assertTrue(raised)
|
||||
|
||||
|
||||
class SpecificExceptions(Framework.TestCase):
|
||||
def testBadCredentials(self):
|
||||
self.assertRaises(github.BadCredentialsException, lambda: github.Github("BadUser", "BadPassword").get_user().login)
|
||||
|
||||
def testUnknownObject(self):
|
||||
self.assertRaises(github.UnknownObjectException, lambda: self.g.get_user().get_repo("Xxx"))
|
||||
|
||||
def testBadUserAgent(self):
|
||||
self.assertRaises(github.BadUserAgentException, lambda: github.Github(self.login, self.password, user_agent="").get_user().name)
|
||||
|
||||
def testRateLimitExceeded(self):
|
||||
g = github.Github()
|
||||
|
||||
def exceed():
|
||||
for i in range(100):
|
||||
g.get_user("jacquev6")
|
||||
|
||||
self.assertRaises(github.RateLimitExceededException, exceed)
|
||||
160
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/ExposeAllAttributes.py
vendored
Normal file
160
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/ExposeAllAttributes.py
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class ExposeAllAttributes(Framework.TestCase):
|
||||
def testAllClasses(self):
|
||||
authenticatedUser = self.g.get_user()
|
||||
namedUser = self.g.get_user("nvie")
|
||||
repository = authenticatedUser.get_repo("PyGithub")
|
||||
organization = self.g.get_organization("BeaverSoftware")
|
||||
plan = authenticatedUser.plan
|
||||
branch = repository.get_branch("master")
|
||||
commit = repository.get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
commitStats = commit.stats
|
||||
commitStatus = commit.get_statuses()[0]
|
||||
milestone = repository.get_milestone(17)
|
||||
gist = self.g.get_gist("149016")
|
||||
gistComment = gist.get_comment(4565)
|
||||
gistFile = gist.files[".gitignore"]
|
||||
gistHistoryState = gist.history[0]
|
||||
gitCommit = repository.get_git_commit("be37b8a7f3a68631c32672dcd84d9eba27438ee6")
|
||||
gitAuthor = gitCommit.author
|
||||
gitTree = repository.get_git_tree("6f7c2d8c66d78863f7b91792deaead619799a1ce")
|
||||
gitTreeElement = gitTree.tree[0]
|
||||
gitBlob = repository.get_git_blob("681fb61f1761743a02f5c790f1c762cbfe8cfad1")
|
||||
gitRef = repository.get_git_ref("tags/v1.17.0")
|
||||
gitObject = gitRef.object
|
||||
issue = repository.get_issue(188)
|
||||
issueComment = issue.get_comment(22686536)
|
||||
issueEvent = issue.get_events()[0]
|
||||
issuePullRequest = issue.pull_request
|
||||
gitignoreTemplate = self.g.get_gitignore_template("Python")
|
||||
team = organization.get_team(141487)
|
||||
label = repository.get_label("Bug")
|
||||
pullRequest = repository.get_pull(31)
|
||||
pullRequestComment = pullRequest.get_review_comment(1580134)
|
||||
pullRequestPart = pullRequest.base
|
||||
file = pullRequest.get_files()[0]
|
||||
commitComment = repository.get_comment(3630301)
|
||||
status = self.g.get_api_status()
|
||||
statusMessage = self.g.get_last_api_status_message()
|
||||
rateLimit = self.g.get_rate_limit()
|
||||
rate = rateLimit.rate
|
||||
hook = repository.get_hooks()[0]
|
||||
hookResponse = hook.last_response
|
||||
hookDescription = self.g.get_hooks()[0]
|
||||
comparison = repository.compare("master", "develop")
|
||||
contentFile = repository.get_file_contents("README.rst")
|
||||
permissions = repository.permissions
|
||||
event = repository.get_events()[0]
|
||||
notification = authenticatedUser.get_notification("8406712")
|
||||
notificationSubject = notification.subject
|
||||
|
||||
missingAttributes = self.gatherMissingAttributes([
|
||||
authenticatedUser,
|
||||
# authorization, # Security issue if put as-is in ReplayData
|
||||
# authorizationApplication, # Security issue if put as-is in ReplayData
|
||||
branch,
|
||||
commit,
|
||||
commitComment,
|
||||
commitStats,
|
||||
commitStatus,
|
||||
comparison,
|
||||
contentFile,
|
||||
# download, # Deprecated: https://github.com/blog/1302-goodbye-uploads
|
||||
event,
|
||||
file,
|
||||
gist,
|
||||
gistComment,
|
||||
gistFile,
|
||||
gistHistoryState,
|
||||
gitAuthor,
|
||||
gitBlob,
|
||||
gitCommit,
|
||||
gitignoreTemplate,
|
||||
gitObject,
|
||||
gitRef,
|
||||
# gitTag,
|
||||
gitTree,
|
||||
gitTreeElement,
|
||||
hook,
|
||||
hookDescription,
|
||||
hookResponse,
|
||||
issue,
|
||||
issueComment,
|
||||
issueEvent,
|
||||
issuePullRequest,
|
||||
label,
|
||||
milestone,
|
||||
namedUser,
|
||||
notification,
|
||||
notificationSubject,
|
||||
organization,
|
||||
permissions,
|
||||
plan,
|
||||
pullRequest,
|
||||
pullRequestComment,
|
||||
# pullRequestMergeStatus, # Only obtained when merging a pull request through the API
|
||||
pullRequestPart,
|
||||
rate,
|
||||
rateLimit,
|
||||
repository,
|
||||
# repositoryKey, # Security issue if put as-is in ReplayData
|
||||
status,
|
||||
statusMessage,
|
||||
# tag,
|
||||
team,
|
||||
# userKey, # Security issue if put as-is in ReplayData
|
||||
])
|
||||
|
||||
for className, attributesMissingInClass in sorted(missingAttributes.iteritems()):
|
||||
for attrName, value in sorted(attributesMissingInClass.iteritems()):
|
||||
print className, attrName, "->", repr(value)
|
||||
|
||||
self.assertEqual(sum(len(attrs) for attrs in missingAttributes.values()), 0)
|
||||
|
||||
def findMissingAttributes(self, obj):
|
||||
if hasattr(obj, "update"):
|
||||
obj.update()
|
||||
className = obj.__class__.__name__
|
||||
missingAttributes = {}
|
||||
for attribute in obj.raw_data:
|
||||
if attribute != "_links":
|
||||
if not hasattr(obj, attribute):
|
||||
missingAttributes[attribute] = obj.raw_data[attribute]
|
||||
return (className, missingAttributes)
|
||||
|
||||
def gatherMissingAttributes(self, objs):
|
||||
allMissingAttributes = dict()
|
||||
|
||||
for obj in objs:
|
||||
className, attributesMissingInClass = self.findMissingAttributes(obj)
|
||||
if len(attributesMissingInClass) > 0:
|
||||
if className not in allMissingAttributes:
|
||||
allMissingAttributes[className] = dict()
|
||||
allMissingAttributes[className].update(attributesMissingInClass)
|
||||
|
||||
return allMissingAttributes
|
||||
278
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Framework.py
vendored
Normal file
278
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Framework.py
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import httplib
|
||||
import traceback
|
||||
|
||||
import github
|
||||
|
||||
atLeastPython26 = sys.hexversion >= 0x02060000
|
||||
atLeastPython3 = sys.hexversion >= 0x03000000
|
||||
atMostPython32 = sys.hexversion < 0x03030000
|
||||
|
||||
if atLeastPython26:
|
||||
import json
|
||||
else: # pragma no cover (Covered by all tests with Python 2.5)
|
||||
import simplejson as json # pragma no cover (Covered by all tests with Python 2.5)
|
||||
|
||||
|
||||
def readLine(file):
|
||||
if atLeastPython3:
|
||||
return file.readline().decode("utf-8").strip()
|
||||
else:
|
||||
return file.readline().strip()
|
||||
|
||||
|
||||
class FakeHttpResponse:
|
||||
def __init__(self, status, headers, output):
|
||||
self.status = status
|
||||
self.__headers = headers
|
||||
self.__output = output
|
||||
|
||||
def getheaders(self):
|
||||
return self.__headers
|
||||
|
||||
def read(self):
|
||||
return self.__output
|
||||
|
||||
|
||||
def fixAuthorizationHeader(headers):
|
||||
if "Authorization" in headers:
|
||||
if headers["Authorization"].endswith("ZmFrZV9sb2dpbjpmYWtlX3Bhc3N3b3Jk"):
|
||||
# This special case is here to test the real Authorization header
|
||||
# sent by PyGithub. It would have avoided issue https://github.com/jacquev6/PyGithub/issues/153
|
||||
# because we would have seen that Python 3 was not generating the same
|
||||
# header as Python 2
|
||||
pass
|
||||
elif headers["Authorization"].startswith("token "):
|
||||
headers["Authorization"] = "token private_token_removed"
|
||||
elif headers["Authorization"].startswith("Basic "):
|
||||
headers["Authorization"] = "Basic login_and_password_removed"
|
||||
|
||||
|
||||
class RecordingConnection: # pragma no cover (Class useful only when recording new tests, not used during automated tests)
|
||||
def __init__(self, file, protocol, host, port, *args, **kwds):
|
||||
self.__file = file
|
||||
self.__protocol = protocol
|
||||
self.__host = host
|
||||
self.__port = str(port)
|
||||
self.__cnx = self._realConnection(host, port, *args, **kwds)
|
||||
|
||||
def request(self, verb, url, input, headers):
|
||||
print verb, url, input, headers,
|
||||
self.__cnx.request(verb, url, input, headers)
|
||||
fixAuthorizationHeader(headers)
|
||||
self.__writeLine(self.__protocol)
|
||||
self.__writeLine(verb)
|
||||
self.__writeLine(self.__host)
|
||||
self.__writeLine(self.__port)
|
||||
self.__writeLine(url)
|
||||
self.__writeLine(str(headers))
|
||||
self.__writeLine(input.replace('\n', '').replace('\r', ''))
|
||||
|
||||
def getresponse(self):
|
||||
res = self.__cnx.getresponse()
|
||||
|
||||
status = res.status
|
||||
print "=>", status
|
||||
headers = res.getheaders()
|
||||
output = res.read()
|
||||
|
||||
self.__writeLine(str(status))
|
||||
self.__writeLine(str(headers))
|
||||
self.__writeLine(str(output))
|
||||
|
||||
return FakeHttpResponse(status, headers, output)
|
||||
|
||||
def close(self):
|
||||
self.__writeLine("")
|
||||
return self.__cnx.close()
|
||||
|
||||
def __writeLine(self, line):
|
||||
self.__file.write(line + "\n")
|
||||
|
||||
|
||||
class RecordingHttpConnection(RecordingConnection): # pragma no cover (Class useful only when recording new tests, not used during automated tests)
|
||||
_realConnection = httplib.HTTPConnection
|
||||
|
||||
def __init__(self, file, *args, **kwds):
|
||||
RecordingConnection.__init__(self, file, "http", *args, **kwds)
|
||||
|
||||
|
||||
class RecordingHttpsConnection(RecordingConnection): # pragma no cover (Class useful only when recording new tests, not used during automated tests)
|
||||
_realConnection = httplib.HTTPSConnection
|
||||
|
||||
def __init__(self, file, *args, **kwds):
|
||||
RecordingConnection.__init__(self, file, "https", *args, **kwds)
|
||||
|
||||
|
||||
class ReplayingConnection:
|
||||
def __init__(self, testCase, file, protocol, host, port, *args, **kwds):
|
||||
self.__testCase = testCase
|
||||
self.__file = file
|
||||
self.__protocol = protocol
|
||||
self.__host = host
|
||||
self.__port = str(port)
|
||||
|
||||
def request(self, verb, url, input, headers):
|
||||
fixAuthorizationHeader(headers)
|
||||
self.__testCase.assertEqual(self.__protocol, readLine(self.__file))
|
||||
self.__testCase.assertEqual(verb, readLine(self.__file))
|
||||
self.__testCase.assertEqual(self.__host, readLine(self.__file))
|
||||
self.__testCase.assertEqual(self.__port, readLine(self.__file))
|
||||
self.__testCase.assertEqual(self.__splitUrl(url), self.__splitUrl(readLine(self.__file)))
|
||||
self.__testCase.assertEqual(headers, eval(readLine(self.__file)))
|
||||
expectedInput = readLine(self.__file)
|
||||
if input.startswith("{"):
|
||||
self.__testCase.assertEqual(json.loads(input.replace('\n', '').replace('\r', '')), json.loads(expectedInput))
|
||||
elif atMostPython32: # @todo Test in all cases, including Python 3.3
|
||||
# In Python 3.3, dicts are not output in the same order as in Python 2.5 -> 3.2.
|
||||
# So, form-data encoding is not deterministic and is difficult to test.
|
||||
self.__testCase.assertEqual(input.replace('\n', '').replace('\r', ''), expectedInput)
|
||||
|
||||
def __splitUrl(self, url):
|
||||
splitedUrl = url.split("?")
|
||||
if len(splitedUrl) == 1:
|
||||
return splitedUrl
|
||||
self.__testCase.assertEqual(len(splitedUrl), 2)
|
||||
base, qs = splitedUrl
|
||||
return (base, sorted(qs.split("&")))
|
||||
|
||||
def getresponse(self):
|
||||
status = int(readLine(self.__file))
|
||||
headers = eval(readLine(self.__file))
|
||||
output = readLine(self.__file)
|
||||
|
||||
return FakeHttpResponse(status, headers, output)
|
||||
|
||||
def close(self):
|
||||
readLine(self.__file)
|
||||
|
||||
|
||||
def ReplayingHttpConnection(testCase, file, *args, **kwds):
|
||||
return ReplayingConnection(testCase, file, "http", *args, **kwds)
|
||||
|
||||
|
||||
def ReplayingHttpsConnection(testCase, file, *args, **kwds):
|
||||
return ReplayingConnection(testCase, file, "https", *args, **kwds)
|
||||
|
||||
|
||||
class BasicTestCase(unittest.TestCase):
|
||||
recordMode = False
|
||||
tokenAuthMode = False
|
||||
|
||||
def setUp(self):
|
||||
unittest.TestCase.setUp(self)
|
||||
self.__fileName = ""
|
||||
self.__file = None
|
||||
if self.recordMode: # pragma no cover (Branch useful only when recording new tests, not used during automated tests)
|
||||
github.Requester.Requester.injectConnectionClasses(
|
||||
lambda ignored, *args, **kwds: RecordingHttpConnection(self.__openFile("wb"), *args, **kwds),
|
||||
lambda ignored, *args, **kwds: RecordingHttpsConnection(self.__openFile("wb"), *args, **kwds)
|
||||
)
|
||||
import GithubCredentials
|
||||
self.login = GithubCredentials.login
|
||||
self.password = GithubCredentials.password
|
||||
self.oauth_token = GithubCredentials.oauth_token
|
||||
# @todo Remove client_id and client_secret from ReplayData (as we already remove login, password and oauth_token)
|
||||
# self.client_id = GithubCredentials.client_id
|
||||
# self.client_secret = GithubCredentials.client_secret
|
||||
else:
|
||||
github.Requester.Requester.injectConnectionClasses(
|
||||
lambda ignored, *args, **kwds: ReplayingHttpConnection(self, self.__openFile("rb"), *args, **kwds),
|
||||
lambda ignored, *args, **kwds: ReplayingHttpsConnection(self, self.__openFile("rb"), *args, **kwds)
|
||||
)
|
||||
self.login = "login"
|
||||
self.password = "password"
|
||||
self.oauth_token = "oauth_token"
|
||||
self.client_id = "client_id"
|
||||
self.client_secret = "client_secret"
|
||||
|
||||
def tearDown(self):
|
||||
unittest.TestCase.tearDown(self)
|
||||
self.__closeReplayFileIfNeeded()
|
||||
github.Requester.Requester.resetConnectionClasses()
|
||||
|
||||
def __openFile(self, mode):
|
||||
for (_, _, functionName, _) in traceback.extract_stack():
|
||||
if functionName.startswith("test") or functionName == "setUp" or functionName == "tearDown":
|
||||
if functionName != "test": # because in class Hook(Framework.TestCase), method testTest calls Hook.test
|
||||
fileName = os.path.join(os.path.dirname(__file__), "ReplayData", self.__class__.__name__ + "." + functionName + ".txt")
|
||||
if fileName != self.__fileName:
|
||||
self.__closeReplayFileIfNeeded()
|
||||
self.__fileName = fileName
|
||||
self.__file = open(self.__fileName, mode)
|
||||
return self.__file
|
||||
|
||||
def __closeReplayFileIfNeeded(self):
|
||||
if self.__file is not None:
|
||||
if not self.recordMode: # pragma no branch (Branch useful only when recording new tests, not used during automated tests)
|
||||
self.assertEqual(readLine(self.__file), "")
|
||||
self.__file.close()
|
||||
|
||||
def assertListKeyEqual(self, elements, key, expectedKeys):
|
||||
realKeys = [key(element) for element in elements]
|
||||
self.assertEqual(realKeys, expectedKeys)
|
||||
|
||||
def assertListKeyBegin(self, elements, key, expectedKeys):
|
||||
realKeys = [key(element) for element in elements[: len(expectedKeys)]]
|
||||
self.assertEqual(realKeys, expectedKeys)
|
||||
|
||||
|
||||
class TestCase(BasicTestCase):
|
||||
def doCheckFrame(self, obj, frame):
|
||||
if obj._headers == {} and frame is None:
|
||||
return
|
||||
if obj._headers is None and frame == {}:
|
||||
return
|
||||
self.assertEqual(obj._headers, frame[2])
|
||||
|
||||
def getFrameChecker(self):
|
||||
return lambda requester, obj, frame: self.doCheckFrame(obj, frame)
|
||||
|
||||
def setUp(self):
|
||||
BasicTestCase.setUp(self)
|
||||
|
||||
# Set up frame debugging
|
||||
github.GithubObject.GithubObject.setCheckAfterInitFlag(True)
|
||||
github.Requester.Requester.setDebugFlag(True)
|
||||
github.Requester.Requester.setOnCheckMe(self.getFrameChecker())
|
||||
|
||||
if self.tokenAuthMode:
|
||||
self.g = github.Github(self.oauth_token)
|
||||
else:
|
||||
self.g = github.Github(self.login, self.password)
|
||||
|
||||
|
||||
def activateRecordMode(): # pragma no cover (Function useful only when recording new tests, not used during automated tests)
|
||||
BasicTestCase.recordMode = True
|
||||
|
||||
|
||||
def activateTokenAuthMode(): # pragma no cover (Function useful only when recording new tests, not used during automated tests)
|
||||
BasicTestCase.tokenAuthMode = True
|
||||
120
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Gist.py
vendored
Normal file
120
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/Gist.py
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
class Gist(Framework.TestCase):
|
||||
def testAttributes(self):
|
||||
gist = self.g.get_gist("6296732")
|
||||
self.assertEqual(gist.comments, 0)
|
||||
self.assertEqual(gist.created_at, datetime.datetime(2013, 8, 21, 16, 28, 24))
|
||||
self.assertEqual(gist.description, "Github API")
|
||||
self.assertEqual(gist.files.keys(), ["GithubAPI.lua"])
|
||||
self.assertEqual(gist.files["GithubAPI.lua"].size, 21229)
|
||||
self.assertEqual(gist.files["GithubAPI.lua"].filename, "GithubAPI.lua")
|
||||
self.assertEqual(gist.files["GithubAPI.lua"].language, "Lua")
|
||||
self.assertEqual(gist.files["GithubAPI.lua"].content[:10], "-- GithubA")
|
||||
self.assertEqual(gist.files["GithubAPI.lua"].raw_url, "https://gist.githubusercontent.com/jacquev6/6296732/raw/88aafa25fb28e17013054a117354a37f0d78963c/GithubAPI.lua")
|
||||
self.assertEqual(gist.forks, [])
|
||||
self.assertEqual(gist.git_pull_url, "https://gist.github.com/6296732.git")
|
||||
self.assertEqual(gist.git_push_url, "https://gist.github.com/6296732.git")
|
||||
self.assertEqual(len(gist.history), 1)
|
||||
self.assertEqual(gist.history[0].change_status.additions, 793)
|
||||
self.assertEqual(gist.history[0].change_status.deletions, 0)
|
||||
self.assertEqual(gist.history[0].change_status.total, 793)
|
||||
self.assertEqual(gist.history[0].committed_at, datetime.datetime(2013, 8, 21, 16, 12, 27))
|
||||
self.assertEqual(gist.history[0].url, "https://api.github.com/gists/6296732/c464aecd7fea16684e935607eeea7ae4f8caa0e2")
|
||||
self.assertEqual(gist.history[0].user, None)
|
||||
self.assertEqual(gist.history[0].owner.login, "jacquev6")
|
||||
self.assertEqual(gist.history[0].version, "c464aecd7fea16684e935607eeea7ae4f8caa0e2")
|
||||
self.assertEqual(gist.html_url, "https://gist.github.com/6296732")
|
||||
self.assertEqual(gist.id, "6296732")
|
||||
self.assertTrue(gist.public)
|
||||
self.assertEqual(gist.updated_at, datetime.datetime(2013, 8, 21, 16, 28, 24))
|
||||
self.assertEqual(gist.url, "https://api.github.com/gists/6296732")
|
||||
self.assertEqual(gist.user, None)
|
||||
self.assertEqual(gist.owner.login, "jacquev6")
|
||||
self.assertEqual(gist.git_pull_url, "https://gist.github.com/6296732.git")
|
||||
self.assertEqual(gist.git_push_url, "https://gist.github.com/6296732.git")
|
||||
self.assertEqual(gist.html_url, "https://gist.github.com/6296732")
|
||||
self.assertEqual(gist.url, "https://api.github.com/gists/6296732")
|
||||
|
||||
def testEditWithoutParameters(self):
|
||||
gist = self.g.get_gist("2729810")
|
||||
gist.edit()
|
||||
self.assertEqual(gist.description, "Gist created by PyGithub")
|
||||
self.assertEqual(gist.updated_at, datetime.datetime(2012, 5, 19, 7, 0, 58))
|
||||
|
||||
def testEditWithAllParameters(self):
|
||||
gist = self.g.get_gist("2729810")
|
||||
gist.edit("Description edited by PyGithub", {"barbaz.txt": github.InputFileContent("File also created by PyGithub")})
|
||||
self.assertEqual(gist.description, "Description edited by PyGithub")
|
||||
self.assertEqual(gist.updated_at, datetime.datetime(2012, 5, 19, 7, 6, 10))
|
||||
self.assertEqual(set(gist.files.keys()), set(["foobar.txt", "barbaz.txt"]))
|
||||
|
||||
def testDeleteFile(self):
|
||||
gist = self.g.get_gist("5339374")
|
||||
self.assertEqual(sorted(gist.files.keys()), ["bar.txt", "foo.txt"])
|
||||
gist.edit(files={"foo.txt": None})
|
||||
self.assertEqual(gist.files.keys(), ["bar.txt"])
|
||||
|
||||
def testRenameFile(self):
|
||||
gist = self.g.get_gist("5339374")
|
||||
self.assertEqual(gist.files.keys(), ["bar.txt"])
|
||||
gist.edit(files={"bar.txt": github.InputFileContent(gist.files["bar.txt"].content, new_name="baz.txt")})
|
||||
self.assertEqual(gist.files.keys(), ["baz.txt"])
|
||||
|
||||
def testCreateComment(self):
|
||||
gist = self.g.get_gist("2729810")
|
||||
comment = gist.create_comment("Comment created by PyGithub")
|
||||
self.assertEqual(comment.id, 323629)
|
||||
|
||||
def testGetComments(self):
|
||||
gist = self.g.get_gist("2729810")
|
||||
self.assertListKeyEqual(gist.get_comments(), lambda c: c.id, [323637])
|
||||
|
||||
def testStarring(self):
|
||||
gist = self.g.get_gist("2729810")
|
||||
self.assertFalse(gist.is_starred())
|
||||
gist.set_starred()
|
||||
self.assertTrue(gist.is_starred())
|
||||
gist.reset_starred()
|
||||
self.assertFalse(gist.is_starred())
|
||||
|
||||
def testFork(self):
|
||||
gist = self.g.get_gist("6296553") # Random gist
|
||||
myGist = gist.create_fork()
|
||||
self.assertEqual(myGist.id, "6296732")
|
||||
self.assertEqual(myGist.fork_of, None) # WTF
|
||||
sameGist = self.g.get_gist("6296732")
|
||||
self.assertEqual(sameGist.fork_of.id, "6296553")
|
||||
|
||||
def testDelete(self):
|
||||
gist = self.g.get_gist("2729810")
|
||||
gist.delete()
|
||||
50
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GistComment.py
vendored
Normal file
50
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GistComment.py
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class GistComment(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.comment = self.g.get_gist("2729810").get_comment(323629)
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.comment.body, "Comment created by PyGithub")
|
||||
self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 19, 7, 7, 57))
|
||||
self.assertEqual(self.comment.id, 323629)
|
||||
self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 7, 57))
|
||||
self.assertEqual(self.comment.url, "https://api.github.com/gists/2729810/comments/323629")
|
||||
self.assertEqual(self.comment.user.login, "jacquev6")
|
||||
|
||||
def testEdit(self):
|
||||
self.comment.edit("Comment edited by PyGithub")
|
||||
self.assertEqual(self.comment.body, "Comment edited by PyGithub")
|
||||
self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 12, 32))
|
||||
|
||||
def testDelete(self):
|
||||
self.comment.delete()
|
||||
41
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GitBlob.py
vendored
Normal file
41
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GitBlob.py
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class GitBlob(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.blob = self.g.get_user().get_repo("PyGithub").get_git_blob("53bce9fa919b4544e67275089b3ec5b44be20667")
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertTrue(self.blob.content.startswith("IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgpmcm9tIGRpc3R1dGlscy5jb3JlIGlt\ncG9ydCBzZXR1cAppbXBvcnQgdGV4dHdyYXAKCnNldHVwKAogICAgbmFtZSA9\n"))
|
||||
self.assertTrue(self.blob.content.endswith("Z3JhbW1pbmcgTGFuZ3VhZ2UgOjogUHl0aG9uIiwKICAgICAgICAiVG9waWMg\nOjogU29mdHdhcmUgRGV2ZWxvcG1lbnQiLAogICAgXSwKKQo=\n"))
|
||||
self.assertEqual(len(self.blob.content), 1757)
|
||||
self.assertEqual(self.blob.encoding, "base64")
|
||||
self.assertEqual(self.blob.size, 1295)
|
||||
self.assertEqual(self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667")
|
||||
self.assertEqual(self.blob.url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667")
|
||||
49
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GitCommit.py
vendored
Normal file
49
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GitCommit.py
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class GitCommit(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.commit = self.g.get_user().get_repo("PyGithub").get_git_commit("4303c5b90e2216d927155e9609436ccb8984c495")
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.commit.author.name, "Vincent Jacques")
|
||||
self.assertEqual(self.commit.author.email, "vincent@vincent-jacques.net")
|
||||
self.assertEqual(self.commit.author.date, datetime.datetime(2012, 4, 17, 17, 55, 16))
|
||||
self.assertEqual(self.commit.committer.name, "Vincent Jacques")
|
||||
self.assertEqual(self.commit.committer.email, "vincent@vincent-jacques.net")
|
||||
self.assertEqual(self.commit.committer.date, datetime.datetime(2012, 4, 17, 17, 55, 16))
|
||||
self.assertEqual(self.commit.message, "Merge branch 'develop'\n")
|
||||
self.assertEqual(len(self.commit.parents), 2)
|
||||
self.assertEqual(self.commit.parents[0].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d")
|
||||
self.assertEqual(self.commit.parents[1].sha, "2a7e80e6421c5d4d201d60619068dea6bae612cb")
|
||||
self.assertEqual(self.commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495")
|
||||
self.assertEqual(self.commit.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad")
|
||||
self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495")
|
||||
48
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GitRef.py
vendored
Normal file
48
plug-ins/ARTv2/Core/Scripts/ThirdParty/github/tests/GitRef.py
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ########################## Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
class GitRef(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.ref = self.g.get_user().get_repo("PyGithub").get_git_ref("heads/BranchCreatedByPyGithub")
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.ref.object.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
self.assertEqual(self.ref.object.type, "commit")
|
||||
self.assertEqual(self.ref.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
|
||||
self.assertEqual(self.ref.ref, "refs/heads/BranchCreatedByPyGithub")
|
||||
self.assertEqual(self.ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub")
|
||||
|
||||
def testEdit(self):
|
||||
self.ref.edit("04cde900a0775b51f762735637bd30de392a2793")
|
||||
|
||||
def testEditWithForce(self):
|
||||
self.ref.edit("4303c5b90e2216d927155e9609436ccb8984c495", force=True)
|
||||
|
||||
def testDelete(self):
|
||||
self.ref.delete()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user