Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +10 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/AUTHORS +59 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/INSTALLER +1 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/LICENSE +29 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/METADATA +295 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/RECORD +83 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/REQUESTED +0 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/WHEEL +5 -0
- python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/top_level.txt +1 -0
- python_embeded/Lib/site-packages/github/Hook.py +226 -0
- python_embeded/Lib/site-packages/github/HookResponse.py +79 -0
- python_embeded/Lib/site-packages/github/InputFileContent.py +62 -0
- python_embeded/Lib/site-packages/github/InputGitAuthor.py +70 -0
- python_embeded/Lib/site-packages/github/InputGitTreeElement.py +78 -0
- python_embeded/Lib/site-packages/github/Installation.py +280 -0
- python_embeded/Lib/site-packages/github/InstallationAuthorization.py +136 -0
- python_embeded/Lib/site-packages/github/Invitation.py +155 -0
- python_embeded/Lib/site-packages/github/Issue.py +673 -0
- python_embeded/Lib/site-packages/github/IssueComment.py +289 -0
- python_embeded/Lib/site-packages/github/IssueEvent.py +266 -0
- python_embeded/Lib/site-packages/github/IssuePullRequest.py +95 -0
- python_embeded/Lib/site-packages/github/Label.py +158 -0
- python_embeded/Lib/site-packages/github/License.py +167 -0
- python_embeded/Lib/site-packages/github/MainClass.py +1058 -0
- python_embeded/Lib/site-packages/github/Membership.py +131 -0
- python_embeded/Lib/site-packages/github/MergedUpstream.py +68 -0
- python_embeded/Lib/site-packages/github/Migration.py +266 -0
- python_embeded/Lib/site-packages/github/Milestone.py +243 -0
- python_embeded/Lib/site-packages/github/NamedEnterpriseUser.py +204 -0
- python_embeded/Lib/site-packages/github/NamedUser.py +693 -0
- python_embeded/Lib/site-packages/github/Notification.py +175 -0
- python_embeded/Lib/site-packages/github/NotificationSubject.py +93 -0
- python_embeded/Lib/site-packages/github/Organization.py +1997 -0
- python_embeded/Lib/site-packages/github/OrganizationCustomProperty.py +183 -0
- python_embeded/Lib/site-packages/github/OrganizationDependabotAlert.py +58 -0
- python_embeded/Lib/site-packages/github/OrganizationSecret.py +138 -0
- python_embeded/Lib/site-packages/github/OrganizationVariable.py +134 -0
- python_embeded/Lib/site-packages/github/PaginatedList.py +441 -0
- python_embeded/Lib/site-packages/github/Path.py +98 -0
- python_embeded/Lib/site-packages/github/Permissions.py +107 -0
- python_embeded/Lib/site-packages/github/Plan.py +103 -0
- python_embeded/Lib/site-packages/github/Project.py +265 -0
- python_embeded/Lib/site-packages/github/ProjectCard.py +225 -0
- python_embeded/Lib/site-packages/github/ProjectColumn.py +221 -0
- python_embeded/Lib/site-packages/github/PublicKey.py +136 -0
- python_embeded/Lib/site-packages/github/PullRequest.py +1141 -0
- python_embeded/Lib/site-packages/github/PullRequestComment.py +379 -0
- python_embeded/Lib/site-packages/github/PullRequestMergeStatus.py +81 -0
- python_embeded/Lib/site-packages/github/PullRequestPart.py +107 -0
- python_embeded/Lib/site-packages/github/PullRequestReview.py +160 -0
.gitattributes
CHANGED
|
@@ -37,3 +37,13 @@ python_embeded/python.exe filter=lfs diff=lfs merge=lfs -text
|
|
| 37 |
python_embeded/vcruntime140.dll filter=lfs diff=lfs merge=lfs -text
|
| 38 |
python_embeded/libssl-3.dll filter=lfs diff=lfs merge=lfs -text
|
| 39 |
python_embeded/sqlite3.dll filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
python_embeded/vcruntime140.dll filter=lfs diff=lfs merge=lfs -text
|
| 38 |
python_embeded/libssl-3.dll filter=lfs diff=lfs merge=lfs -text
|
| 39 |
python_embeded/sqlite3.dll filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
python_embeded/pythonw.exe filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
python_embeded/python.cat filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
python_embeded/libcrypto-3.dll filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
python_embeded/python312.dll filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
python_embeded/Scripts/accelerate-estimate-memory.exe filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
python_embeded/Scripts/accelerate-config.exe filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
python_embeded/Scripts/coloredlogs.exe filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
python_embeded/Scripts/chardetect.exe filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
python_embeded/Scripts/alembic.exe filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
python_embeded/Scripts/dotenv.exe filter=lfs diff=lfs merge=lfs -text
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/AUTHORS
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GitPython was originally written by Michael Trier.
|
| 2 |
+
GitPython 0.2 was partially (re)written by Sebastian Thiel, based on 0.1.6 and git-dulwich.
|
| 3 |
+
|
| 4 |
+
Contributors are:
|
| 5 |
+
|
| 6 |
+
-Michael Trier <mtrier _at_ gmail.com>
|
| 7 |
+
-Alan Briolat
|
| 8 |
+
-Florian Apolloner <florian _at_ apolloner.eu>
|
| 9 |
+
-David Aguilar <davvid _at_ gmail.com>
|
| 10 |
+
-Jelmer Vernooij <jelmer _at_ samba.org>
|
| 11 |
+
-Steve Frécinaux <code _at_ istique.net>
|
| 12 |
+
-Kai Lautaportti <kai _at_ lautaportti.fi>
|
| 13 |
+
-Paul Sowden <paul _at_ idontsmoke.co.uk>
|
| 14 |
+
-Sebastian Thiel <byronimo _at_ gmail.com>
|
| 15 |
+
-Jonathan Chu <jonathan.chu _at_ me.com>
|
| 16 |
+
-Vincent Driessen <me _at_ nvie.com>
|
| 17 |
+
-Phil Elson <pelson _dot_ pub _at_ gmail.com>
|
| 18 |
+
-Bernard `Guyzmo` Pratz <guyzmo+gitpython+pub@m0g.net>
|
| 19 |
+
-Timothy B. Hartman <tbhartman _at_ gmail.com>
|
| 20 |
+
-Konstantin Popov <konstantin.popov.89 _at_ yandex.ru>
|
| 21 |
+
-Peter Jones <pjones _at_ redhat.com>
|
| 22 |
+
-Anson Mansfield <anson.mansfield _at_ gmail.com>
|
| 23 |
+
-Ken Odegard <ken.odegard _at_ gmail.com>
|
| 24 |
+
-Alexis Horgix Chotard
|
| 25 |
+
-Piotr Babij <piotr.babij _at_ gmail.com>
|
| 26 |
+
-Mikuláš Poul <mikulaspoul _at_ gmail.com>
|
| 27 |
+
-Charles Bouchard-Légaré <cblegare.atl _at_ ntis.ca>
|
| 28 |
+
-Yaroslav Halchenko <debian _at_ onerussian.com>
|
| 29 |
+
-Tim Swast <swast _at_ google.com>
|
| 30 |
+
-William Luc Ritchie
|
| 31 |
+
-David Host <hostdm _at_ outlook.com>
|
| 32 |
+
-A. Jesse Jiryu Davis <jesse _at_ emptysquare.net>
|
| 33 |
+
-Steven Whitman <ninloot _at_ gmail.com>
|
| 34 |
+
-Stefan Stancu <stefan.stancu _at_ gmail.com>
|
| 35 |
+
-César Izurieta <cesar _at_ caih.org>
|
| 36 |
+
-Arthur Milchior <arthur _at_ milchior.fr>
|
| 37 |
+
-Anil Khatri <anil.soccer.khatri _at_ gmail.com>
|
| 38 |
+
-JJ Graham <thetwoj _at_ gmail.com>
|
| 39 |
+
-Ben Thayer <ben _at_ benthayer.com>
|
| 40 |
+
-Dries Kennes <admin _at_ dries007.net>
|
| 41 |
+
-Pratik Anurag <panurag247365 _at_ gmail.com>
|
| 42 |
+
-Harmon <harmon.public _at_ gmail.com>
|
| 43 |
+
-Liam Beguin <liambeguin _at_ gmail.com>
|
| 44 |
+
-Ram Rachum <ram _at_ rachum.com>
|
| 45 |
+
-Alba Mendez <me _at_ alba.sh>
|
| 46 |
+
-Robert Westman <robert _at_ byteflux.io>
|
| 47 |
+
-Hugo van Kemenade
|
| 48 |
+
-Hiroki Tokunaga <tokusan441 _at_ gmail.com>
|
| 49 |
+
-Julien Mauroy <pro.julien.mauroy _at_ gmail.com>
|
| 50 |
+
-Patrick Gerard
|
| 51 |
+
-Luke Twist <itsluketwist@gmail.com>
|
| 52 |
+
-Joseph Hale <me _at_ jhale.dev>
|
| 53 |
+
-Santos Gallegos <stsewd _at_ proton.me>
|
| 54 |
+
-Wenhan Zhu <wzhu.cosmos _at_ gmail.com>
|
| 55 |
+
-Eliah Kagan <eliah.kagan _at_ gmail.com>
|
| 56 |
+
-Ethan Lin <et.repositories _at_ gmail.com>
|
| 57 |
+
-Jonas Scharpf <jonas.scharpf _at_ checkmk.com>
|
| 58 |
+
|
| 59 |
+
Portions derived from other open source works and are clearly marked.
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (C) 2008, 2009 Michael Trier and contributors
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without
|
| 5 |
+
modification, are permitted provided that the following conditions
|
| 6 |
+
are met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
|
| 11 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 12 |
+
notice, this list of conditions and the following disclaimer in the
|
| 13 |
+
documentation and/or other materials provided with the distribution.
|
| 14 |
+
|
| 15 |
+
* Neither the name of the GitPython project nor the names of
|
| 16 |
+
its contributors may be used to endorse or promote products derived
|
| 17 |
+
from this software without specific prior written permission.
|
| 18 |
+
|
| 19 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 20 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 21 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 22 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 23 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 24 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
| 25 |
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
| 26 |
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY TH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ython
|
| 3 |
+
Version: 3.1.44
|
| 4 |
+
Summary: GitPython is a Python library used to interact with Git repositories
|
| 5 |
+
Home-page: https://github.com/gitpython-developers/GitPython
|
| 6 |
+
Author: Sebastian Thiel, Michael Trier
|
| 7 |
+
Author-email: byronimo@gmail.com, mtrier@gmail.com
|
| 8 |
+
License: BSD-3-Clause
|
| 9 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 10 |
+
Classifier: Environment :: Console
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 13 |
+
Classifier: Operating System :: OS Independent
|
| 14 |
+
Classifier: Operating System :: POSIX
|
| 15 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 16 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
| 17 |
+
Classifier: Typing :: Typed
|
| 18 |
+
Classifier: Programming Language :: Python
|
| 19 |
+
Classifier: Programming Language :: Python :: 3
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 26 |
+
Requires-Python: >=3.7
|
| 27 |
+
Description-Content-Type: text/markdown
|
| 28 |
+
License-File: LICENSE
|
| 29 |
+
License-File: AUTHORS
|
| 30 |
+
Requires-Dist: gitdb<5,>=4.0.1
|
| 31 |
+
Requires-Dist: typing-extensions>=3.7.4.3; python_version < "3.8"
|
| 32 |
+
Provides-Extra: test
|
| 33 |
+
Requires-Dist: coverage[toml]; extra == "test"
|
| 34 |
+
Requires-Dist: ddt!=1.4.3,>=1.1.1; extra == "test"
|
| 35 |
+
Requires-Dist: mock; python_version < "3.8" and extra == "test"
|
| 36 |
+
Requires-Dist: mypy; extra == "test"
|
| 37 |
+
Requires-Dist: pre-commit; extra == "test"
|
| 38 |
+
Requires-Dist: pytest>=7.3.1; extra == "test"
|
| 39 |
+
Requires-Dist: pytest-cov; extra == "test"
|
| 40 |
+
Requires-Dist: pytest-instafail; extra == "test"
|
| 41 |
+
Requires-Dist: pytest-mock; extra == "test"
|
| 42 |
+
Requires-Dist: pytest-sugar; extra == "test"
|
| 43 |
+
Requires-Dist: typing-extensions; python_version < "3.11" and extra == "test"
|
| 44 |
+
Provides-Extra: doc
|
| 45 |
+
Requires-Dist: sphinx<7.2,>=7.1.2; extra == "doc"
|
| 46 |
+
Requires-Dist: sphinx_rtd_theme; extra == "doc"
|
| 47 |
+
Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
[](https://readthedocs.org/projects/gitpython/?badge=stable)
|
| 51 |
+
[](https://repology.org/metapackage/python:gitpython/versions)
|
| 52 |
+
|
| 53 |
+
## [Gitoxide](https://github.com/Byron/gitoxide): A peek into the future…
|
| 54 |
+
|
| 55 |
+
I started working on GitPython in 2009, back in the days when Python was 'my thing' and I had great plans with it.
|
| 56 |
+
Of course, back in the days, I didn't really know what I was doing and this shows in many places. Somewhat similar to
|
| 57 |
+
Python this happens to be 'good enough', but at the same time is deeply flawed and broken beyond repair.
|
| 58 |
+
|
| 59 |
+
By now, GitPython is widely used and I am sure there is a good reason for that, it's something to be proud of and happy about.
|
| 60 |
+
The community is maintaining the software and is keeping it relevant for which I am absolutely grateful. For the time to come I am happy to continue maintaining GitPython, remaining hopeful that one day it won't be needed anymore.
|
| 61 |
+
|
| 62 |
+
More than 15 years after my first meeting with 'git' I am still in excited about it, and am happy to finally have the tools and
|
| 63 |
+
probably the skills to scratch that itch of mine: implement `git` in a way that makes tool creation a piece of cake for most.
|
| 64 |
+
|
| 65 |
+
If you like the idea and want to learn more, please head over to [gitoxide](https://github.com/Byron/gitoxide), an
|
| 66 |
+
implementation of 'git' in [Rust](https://www.rust-lang.org).
|
| 67 |
+
|
| 68 |
+
*(Please note that `gitoxide` is not currently available for use in Python, and that Rust is required.)*
|
| 69 |
+
|
| 70 |
+
## GitPython
|
| 71 |
+
|
| 72 |
+
GitPython is a python library used to interact with git repositories, high-level like git-porcelain,
|
| 73 |
+
or low-level like git-plumbing.
|
| 74 |
+
|
| 75 |
+
It provides abstractions of git objects for easy access of repository data often backed by calling the `git`
|
| 76 |
+
command-line program.
|
| 77 |
+
|
| 78 |
+
### DEVELOPMENT STATUS
|
| 79 |
+
|
| 80 |
+
This project is in **maintenance mode**, which means that
|
| 81 |
+
|
| 82 |
+
- …there will be no feature development, unless these are contributed
|
| 83 |
+
- …there will be no bug fixes, unless they are relevant to the safety of users, or contributed
|
| 84 |
+
- …issues will be responded to with waiting times of up to a month
|
| 85 |
+
|
| 86 |
+
The project is open to contributions of all kinds, as well as new maintainers.
|
| 87 |
+
|
| 88 |
+
### REQUIREMENTS
|
| 89 |
+
|
| 90 |
+
GitPython needs the `git` executable to be installed on the system and available in your
|
| 91 |
+
`PATH` for most operations. If it is not in your `PATH`, you can help GitPython find it
|
| 92 |
+
by setting the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable.
|
| 93 |
+
|
| 94 |
+
- Git (1.7.x or newer)
|
| 95 |
+
- Python >= 3.7
|
| 96 |
+
|
| 97 |
+
The list of dependencies are listed in `./requirements.txt` and `./test-requirements.txt`.
|
| 98 |
+
The installer takes care of installing them for you.
|
| 99 |
+
|
| 100 |
+
### INSTALL
|
| 101 |
+
|
| 102 |
+
GitPython and its required package dependencies can be installed in any of the following ways, all of which should typically be done in a [virtual environment](https://docs.python.org/3/tutorial/venv.html).
|
| 103 |
+
|
| 104 |
+
#### From PyPI
|
| 105 |
+
|
| 106 |
+
To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run:
|
| 107 |
+
|
| 108 |
+
```sh
|
| 109 |
+
pip install GitPython
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
(A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).)
|
| 113 |
+
|
| 114 |
+
#### From downloaded source code
|
| 115 |
+
|
| 116 |
+
If you have downloaded the source code, run this from inside the unpacked `GitPython` directory:
|
| 117 |
+
|
| 118 |
+
```sh
|
| 119 |
+
pip install .
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
#### By cloning the source code repository
|
| 123 |
+
|
| 124 |
+
To clone the [the GitHub repository](https://github.com/gitpython-developers/GitPython) from source to work on the code, you can do it like so:
|
| 125 |
+
|
| 126 |
+
```sh
|
| 127 |
+
git clone https://github.com/gitpython-developers/GitPython
|
| 128 |
+
cd GitPython
|
| 129 |
+
./init-tests-after-clone.sh
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
On Windows, `./init-tests-after-clone.sh` can be run in a Git Bash shell.
|
| 133 |
+
|
| 134 |
+
If you are cloning [your own fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks), then replace the above `git clone` command with one that gives the URL of your fork. Or use this [`gh`](https://cli.github.com/) command (assuming you have `gh` and your fork is called `GitPython`):
|
| 135 |
+
|
| 136 |
+
```sh
|
| 137 |
+
gh repo clone GitPython
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html).
|
| 141 |
+
|
| 142 |
+
Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):
|
| 143 |
+
|
| 144 |
+
```sh
|
| 145 |
+
pip install -e ".[test]"
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.
|
| 149 |
+
|
| 150 |
+
#### With editable *dependencies* (not preferred, and rarely needed)
|
| 151 |
+
|
| 152 |
+
In rare cases, you may want to work on GitPython and one or both of its [gitdb](https://github.com/gitpython-developers/gitdb) and [smmap](https://github.com/gitpython-developers/smmap) dependencies at the same time, with changes in your local working copy of gitdb or smmap immediately reflected in the behavior of your local working copy of GitPython. This can be done by making editable installations of those dependencies in the same virtual environment where you install GitPython.
|
| 153 |
+
|
| 154 |
+
If you want to do that *and* you want the versions in GitPython's git submodules to be used, then pass `-e git/ext/gitdb` and/or `-e git/ext/gitdb/gitdb/ext/smmap` to `pip install`. This can be done in any order, and in separate `pip install` commands or the same one, so long as `-e` appears before *each* path. For example, you can install GitPython, gitdb, and smmap editably in the currently active virtual environment this way:
|
| 155 |
+
|
| 156 |
+
```sh
|
| 157 |
+
pip install -e ".[test]" -e git/ext/gitdb -e git/ext/gitdb/gitdb/ext/smmap
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
The submodules must have been cloned for that to work, but that will already be the case if you have run `./init-tests-after-clone.sh`. You can use `pip list` to check which packages are installed editably and which are installed normally.
|
| 161 |
+
|
| 162 |
+
To reiterate, this approach should only rarely be used. For most development it is preferable to allow the gitdb and smmap dependencices to be retrieved automatically from PyPI in their latest stable packaged versions.
|
| 163 |
+
|
| 164 |
+
### Limitations
|
| 165 |
+
|
| 166 |
+
#### Leakage of System Resources
|
| 167 |
+
|
| 168 |
+
GitPython is not suited for long-running processes (like daemons) as it tends to
|
| 169 |
+
leak system resources. It was written in a time where destructors (as implemented
|
| 170 |
+
in the `__del__` method) still ran deterministically.
|
| 171 |
+
|
| 172 |
+
In case you still want to use it in such a context, you will want to search the
|
| 173 |
+
codebase for `__del__` implementations and call these yourself when you see fit.
|
| 174 |
+
|
| 175 |
+
Another way assure proper cleanup of resources is to factor out GitPython into a
|
| 176 |
+
separate process which can be dropped periodically.
|
| 177 |
+
|
| 178 |
+
#### Windows support
|
| 179 |
+
|
| 180 |
+
See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).
|
| 181 |
+
|
| 182 |
+
### RUNNING TESTS
|
| 183 |
+
|
| 184 |
+
_Important_: Right after cloning this repository, please be sure to have executed
|
| 185 |
+
the `./init-tests-after-clone.sh` script in the repository root. Otherwise
|
| 186 |
+
you will encounter test failures.
|
| 187 |
+
|
| 188 |
+
#### Install test dependencies
|
| 189 |
+
|
| 190 |
+
Ensure testing libraries are installed. This is taken care of already if you installed with:
|
| 191 |
+
|
| 192 |
+
```sh
|
| 193 |
+
pip install -e ".[test]"
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
If you had installed with a command like `pip install -e .` instead, you can still run
|
| 197 |
+
the above command to add the testing dependencies.
|
| 198 |
+
|
| 199 |
+
#### Test commands
|
| 200 |
+
|
| 201 |
+
To test, run:
|
| 202 |
+
|
| 203 |
+
```sh
|
| 204 |
+
pytest
|
| 205 |
+
```
|
| 206 |
+
|
| 207 |
+
To lint, and apply some linting fixes as well as automatic code formatting, run:
|
| 208 |
+
|
| 209 |
+
```sh
|
| 210 |
+
pre-commit run --all-files
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
This includes the linting and autoformatting done by Ruff, as well as some other checks.
|
| 214 |
+
|
| 215 |
+
To typecheck, run:
|
| 216 |
+
|
| 217 |
+
```sh
|
| 218 |
+
mypy
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
#### CI (and tox)
|
| 222 |
+
|
| 223 |
+
Style and formatting checks, and running tests on all the different supported Python versions, will be performed:
|
| 224 |
+
|
| 225 |
+
- Upon submitting a pull request.
|
| 226 |
+
- On each push, *if* you have a fork with GitHub Actions enabled.
|
| 227 |
+
- Locally, if you run [`tox`](https://tox.wiki/) (this skips any Python versions you don't have installed).
|
| 228 |
+
|
| 229 |
+
#### Configuration files
|
| 230 |
+
|
| 231 |
+
Specific tools are all configured in the `./pyproject.toml` file:
|
| 232 |
+
|
| 233 |
+
- `pytest` (test runner)
|
| 234 |
+
- `coverage.py` (code coverage)
|
| 235 |
+
- `ruff` (linter and formatter)
|
| 236 |
+
- `mypy` (type checker)
|
| 237 |
+
|
| 238 |
+
Orchestration tools:
|
| 239 |
+
|
| 240 |
+
- Configuration for `pre-commit` is in the `./.pre-commit-config.yaml` file.
|
| 241 |
+
- Configuration for `tox` is in `./tox.ini`.
|
| 242 |
+
- Configuration for GitHub Actions (CI) is in files inside `./.github/workflows/`.
|
| 243 |
+
|
| 244 |
+
### Contributions
|
| 245 |
+
|
| 246 |
+
Please have a look at the [contributions file][contributing].
|
| 247 |
+
|
| 248 |
+
### INFRASTRUCTURE
|
| 249 |
+
|
| 250 |
+
- [User Documentation](http://gitpython.readthedocs.org)
|
| 251 |
+
- [Questions and Answers](http://stackexchange.com/filters/167317/gitpython)
|
| 252 |
+
- Please post on Stack Overflow and use the `gitpython` tag
|
| 253 |
+
- [Issue Tracker](https://github.com/gitpython-developers/GitPython/issues)
|
| 254 |
+
- Post reproducible bugs and feature requests as a new issue.
|
| 255 |
+
Please be sure to provide the following information if posting bugs:
|
| 256 |
+
- GitPython version (e.g. `import git; git.__version__`)
|
| 257 |
+
- Python version (e.g. `python --version`)
|
| 258 |
+
- The encountered stack-trace, if applicable
|
| 259 |
+
- Enough information to allow reproducing the issue
|
| 260 |
+
|
| 261 |
+
### How to make a new release
|
| 262 |
+
|
| 263 |
+
1. Update/verify the **version** in the `VERSION` file.
|
| 264 |
+
2. Update/verify that the `doc/source/changes.rst` changelog file was updated. It should include a link to the forthcoming release page: `https://github.com/gitpython-developers/GitPython/releases/tag/<version>`
|
| 265 |
+
3. Commit everything.
|
| 266 |
+
4. Run `git tag -s <version>` to tag the version in Git.
|
| 267 |
+
5. _Optionally_ create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment). (Then the next step can install `build` and `twine`.)
|
| 268 |
+
6. Run `make release`.
|
| 269 |
+
7. Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
|
| 270 |
+
|
| 271 |
+
### Projects using GitPython
|
| 272 |
+
|
| 273 |
+
- [PyDriller](https://github.com/ishepard/pydriller)
|
| 274 |
+
- [Kivy Designer](https://github.com/kivy/kivy-designer)
|
| 275 |
+
- [Prowl](https://github.com/nettitude/Prowl)
|
| 276 |
+
- [Python Taint](https://github.com/python-security/pyt)
|
| 277 |
+
- [Buster](https://github.com/axitkhurana/buster)
|
| 278 |
+
- [git-ftp](https://github.com/ezyang/git-ftp)
|
| 279 |
+
- [Git-Pandas](https://github.com/wdm0006/git-pandas)
|
| 280 |
+
- [PyGitUp](https://github.com/msiemens/PyGitUp)
|
| 281 |
+
- [PyJFuzz](https://github.com/mseclab/PyJFuzz)
|
| 282 |
+
- [Loki](https://github.com/Neo23x0/Loki)
|
| 283 |
+
- [Omniwallet](https://github.com/OmniLayer/omniwallet)
|
| 284 |
+
- [GitViper](https://github.com/BeayemX/GitViper)
|
| 285 |
+
- [Git Gud](https://github.com/bthayer2365/git-gud)
|
| 286 |
+
|
| 287 |
+
### LICENSE
|
| 288 |
+
|
| 289 |
+
[3-Clause BSD License](https://opensource.org/license/bsd-3-clause/), also known as the New BSD License. See the [LICENSE file][license].
|
| 290 |
+
|
| 291 |
+
One file exclusively used for fuzz testing is subject to [a separate license, detailed here](./fuzzing/README.md#license).
|
| 292 |
+
This file is not included in the wheel or sdist packages published by the maintainers of GitPython.
|
| 293 |
+
|
| 294 |
+
[contributing]: https://github.com/gitpython-developers/GitPython/blob/main/CONTRIBUTING.md
|
| 295 |
+
[license]: https://github.com/gitpython-developers/GitPython/blob/main/LICENSE
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/RECORD
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GitPython-3.1.44.dist-info/AUTHORS,sha256=tZ9LuyBks2V2HKTPK7kCmtd9Guu_LyU1oZHvU0NiAok,2334
|
| 2 |
+
GitPython-3.1.44.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 3 |
+
GitPython-3.1.44.dist-info/LICENSE,sha256=hvyUwyGpr7wRUUcTURuv3tIl8lEA3MD3NQ6CvCMbi-s,1503
|
| 4 |
+
GitPython-3.1.44.dist-info/METADATA,sha256=0O_Fr2Y7A-DlPYhlbSxGjblBC2mWkw3USNUhyL80Ip8,13245
|
| 5 |
+
GitPython-3.1.44.dist-info/RECORD,,
|
| 6 |
+
GitPython-3.1.44.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 7 |
+
GitPython-3.1.44.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
| 8 |
+
GitPython-3.1.44.dist-info/top_level.txt,sha256=0hzDuIp8obv624V3GmbqsagBWkk8ohtGU-Bc1PmTT0o,4
|
| 9 |
+
git/__init__.py,sha256=nkQImgv-bWdiZOFDjzN-gbt93FoRHD0nY6_t9LQxy4Y,8899
|
| 10 |
+
git/__pycache__/__init__.cpython-312.pyc,,
|
| 11 |
+
git/__pycache__/cmd.cpython-312.pyc,,
|
| 12 |
+
git/__pycache__/compat.cpython-312.pyc,,
|
| 13 |
+
git/__pycache__/config.cpython-312.pyc,,
|
| 14 |
+
git/__pycache__/db.cpython-312.pyc,,
|
| 15 |
+
git/__pycache__/diff.cpython-312.pyc,,
|
| 16 |
+
git/__pycache__/exc.cpython-312.pyc,,
|
| 17 |
+
git/__pycache__/remote.cpython-312.pyc,,
|
| 18 |
+
git/__pycache__/types.cpython-312.pyc,,
|
| 19 |
+
git/__pycache__/util.cpython-312.pyc,,
|
| 20 |
+
git/cmd.py,sha256=QwiaBy0mFbi9xjRKhRgUVK-_-K6xVdFqh9l0cxPqPSc,67724
|
| 21 |
+
git/compat.py,sha256=y1E6y6O2q5r8clSlr8ZNmuIWG9nmHuehQEsVsmBffs8,4526
|
| 22 |
+
git/config.py,sha256=vTUlK6d8ORqFqjOv4Vbq_Hm-5mp-jOAt1dkq0IdzJ3U,34933
|
| 23 |
+
git/db.py,sha256=vIW9uWSbqu99zbuU2ZDmOhVOv1UPTmxrnqiCtRHCfjE,2368
|
| 24 |
+
git/diff.py,sha256=wmpMCIdMiVOqreGVPOGYyO4gFboGOAicyrvvI7PPjEg,27095
|
| 25 |
+
git/exc.py,sha256=Gc7g1pHpn8OmTse30NHmJVsBJ2CYH8LxaR8y8UA3lIM,7119
|
| 26 |
+
git/index/__init__.py,sha256=i-Nqb8Lufp9aFbmxpQBORmmQnjEVVM1Pn58fsQkyGgQ,406
|
| 27 |
+
git/index/__pycache__/__init__.cpython-312.pyc,,
|
| 28 |
+
git/index/__pycache__/base.cpython-312.pyc,,
|
| 29 |
+
git/index/__pycache__/fun.cpython-312.pyc,,
|
| 30 |
+
git/index/__pycache__/typ.cpython-312.pyc,,
|
| 31 |
+
git/index/__pycache__/util.cpython-312.pyc,,
|
| 32 |
+
git/index/base.py,sha256=nDD7XVLNbgBKpJMrrTVyHBy6NVLWgDkk7oUw6ZOegPc,60808
|
| 33 |
+
git/index/fun.py,sha256=37cA3DBC9vpAnSVu5TGA072SnoF5XZOkOukExwlejHs,16736
|
| 34 |
+
git/index/typ.py,sha256=uuKNwitUw83FhVaLSwo4pY7PHDQudtZTLJrLGym4jcI,6570
|
| 35 |
+
git/index/util.py,sha256=fULi7GPG-MvprKrRCD5c15GNdzku_1E38We0d97WB3A,3659
|
| 36 |
+
git/objects/__init__.py,sha256=O6ZL_olX7e5-8iIbKviRPkVSJxN37WA-EC0q9d48U5Y,637
|
| 37 |
+
git/objects/__pycache__/__init__.cpython-312.pyc,,
|
| 38 |
+
git/objects/__pycache__/base.cpython-312.pyc,,
|
| 39 |
+
git/objects/__pycache__/blob.cpython-312.pyc,,
|
| 40 |
+
git/objects/__pycache__/commit.cpython-312.pyc,,
|
| 41 |
+
git/objects/__pycache__/fun.cpython-312.pyc,,
|
| 42 |
+
git/objects/__pycache__/tag.cpython-312.pyc,,
|
| 43 |
+
git/objects/__pycache__/tree.cpython-312.pyc,,
|
| 44 |
+
git/objects/__pycache__/util.cpython-312.pyc,,
|
| 45 |
+
git/objects/base.py,sha256=0dqNkSRVH0mk0-7ZKIkGBK7iNYrzLTVxwQFUd6CagsE,10277
|
| 46 |
+
git/objects/blob.py,sha256=zwwq0KfOMYeP5J2tW5CQatoLyeqFRlfkxP1Vwx1h07s,1215
|
| 47 |
+
git/objects/commit.py,sha256=GH1_83C9t7RGTukwozTHDgvxYQPRjTHhPDkXJyBbJyo,30553
|
| 48 |
+
git/objects/fun.py,sha256=B4jCqhAjm6Hl79GK58FPzW1H9K6Wc7Tx0rssyWmAcEE,8935
|
| 49 |
+
git/objects/submodule/__init__.py,sha256=6xySp767LVz3UylWgUalntS_nGXRuVzXxDuFAv_Wc2c,303
|
| 50 |
+
git/objects/submodule/__pycache__/__init__.cpython-312.pyc,,
|
| 51 |
+
git/objects/submodule/__pycache__/base.cpython-312.pyc,,
|
| 52 |
+
git/objects/submodule/__pycache__/root.cpython-312.pyc,,
|
| 53 |
+
git/objects/submodule/__pycache__/util.cpython-312.pyc,,
|
| 54 |
+
git/objects/submodule/base.py,sha256=MQ-2xV8JznGwy2hLQv1aeQNgAkhBhgc5tdtClFL3DmE,63901
|
| 55 |
+
git/objects/submodule/root.py,sha256=5eTtYNHasqdPq6q0oDCPr7IaO6uAHL3b4DxMoiO2LhE,20246
|
| 56 |
+
git/objects/submodule/util.py,sha256=sQqAYaiSJdFkZa9NlAuK_wTsMNiS-kkQnQjvIoJtc_o,3509
|
| 57 |
+
git/objects/tag.py,sha256=jAGESnpmTEv-dLakPzheT5ILZFFArcItnXYqfxfDrgc,4441
|
| 58 |
+
git/objects/tree.py,sha256=jJH888SHiP4dGzE-ra1yenQOyya_0C_MkHr06c1gHpM,13849
|
| 59 |
+
git/objects/util.py,sha256=Nlza4zLgdPmr_Yasyvvs6c1rKtW_wMxI6wDmQpQ3ufw,23846
|
| 60 |
+
git/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 61 |
+
git/refs/__init__.py,sha256=DWlJNnsx-4jM_E-VycbP-FZUdn6iWhjnH_uZ_pZXBro,509
|
| 62 |
+
git/refs/__pycache__/__init__.cpython-312.pyc,,
|
| 63 |
+
git/refs/__pycache__/head.cpython-312.pyc,,
|
| 64 |
+
git/refs/__pycache__/log.cpython-312.pyc,,
|
| 65 |
+
git/refs/__pycache__/reference.cpython-312.pyc,,
|
| 66 |
+
git/refs/__pycache__/remote.cpython-312.pyc,,
|
| 67 |
+
git/refs/__pycache__/symbolic.cpython-312.pyc,,
|
| 68 |
+
git/refs/__pycache__/tag.cpython-312.pyc,,
|
| 69 |
+
git/refs/head.py,sha256=SGa3N301HfAi79X6UR5Mcg7mO9TnCH3Bk549kHlJVaQ,10513
|
| 70 |
+
git/refs/log.py,sha256=kXiuAgTo1DIuM_BfbDUk9gQ0YO-mutIMVdHv1_ES90o,12493
|
| 71 |
+
git/refs/reference.py,sha256=l6mhF4YLSEwtjz6b9PpOQH-fkng7EYWMaJhkjn-2jXA,5630
|
| 72 |
+
git/refs/remote.py,sha256=WwqV9T7BbYf3F_WZNUQivu9xktIIKGklCjDpwQrhD-A,2806
|
| 73 |
+
git/refs/symbolic.py,sha256=c8zOwaqzcg-J-rGrpuWdvh8zwMvSUqAHghd4vJoYG_s,34552
|
| 74 |
+
git/refs/tag.py,sha256=kgzV2vhpL4FD2TqHb0BJuMRAHgAvJF-TcoyWlaB-djQ,5010
|
| 75 |
+
git/remote.py,sha256=pYn9dAlz-QwvNMWXD1M57pMPQitthOM86qTRK_cpTqU,46786
|
| 76 |
+
git/repo/__init__.py,sha256=CILSVH36fX_WxVFSjD9o1WF5LgsNedPiJvSngKZqfVU,210
|
| 77 |
+
git/repo/__pycache__/__init__.cpython-312.pyc,,
|
| 78 |
+
git/repo/__pycache__/base.cpython-312.pyc,,
|
| 79 |
+
git/repo/__pycache__/fun.cpython-312.pyc,,
|
| 80 |
+
git/repo/base.py,sha256=0GU6nKNdT8SYjDI5Y5DeZ1zCEX3tHeq1VW2MSpne05g,59891
|
| 81 |
+
git/repo/fun.py,sha256=HSGC0-rqeKKx9fDg7JyQyMZgIwUWn-FnSZR_gRGpG-E,13573
|
| 82 |
+
git/types.py,sha256=MQzIDEOnoueXGsAJF_0MgUc_osH7Eu0Sw3DQofYzCVE,10272
|
| 83 |
+
git/util.py,sha256=2uAv34zZ_827-zJ3-D5ACrVH-4Q4EO_KLUTH23zi2AI,43770
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/REQUESTED
ADDED
|
File without changes
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (75.6.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
python_embeded/Lib/site-packages/GitPython-3.1.44.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
git
|
python_embeded/Lib/site-packages/github/Hook.py
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 17 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 21 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 22 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# #
|
| 25 |
+
# This file is part of PyGithub. #
|
| 26 |
+
# http://pygithub.readthedocs.io/ #
|
| 27 |
+
# #
|
| 28 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 29 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 30 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 31 |
+
# any later version. #
|
| 32 |
+
# #
|
| 33 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 34 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 35 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 36 |
+
# details. #
|
| 37 |
+
# #
|
| 38 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 39 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 40 |
+
# #
|
| 41 |
+
################################################################################
|
| 42 |
+
|
| 43 |
+
from __future__ import annotations
|
| 44 |
+
|
| 45 |
+
from datetime import datetime
|
| 46 |
+
from typing import Any
|
| 47 |
+
|
| 48 |
+
import github.GithubObject
|
| 49 |
+
import github.HookResponse
|
| 50 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt, is_optional, is_optional_list
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class Hook(CompletableGithubObject):
|
| 54 |
+
"""
|
| 55 |
+
This class represents Hooks.
|
| 56 |
+
|
| 57 |
+
The reference can be found here
|
| 58 |
+
https://docs.github.com/en/rest/reference/repos#webhooks
|
| 59 |
+
|
| 60 |
+
The OpenAPI schema can be found at
|
| 61 |
+
- /components/schemas/hook
|
| 62 |
+
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
def _initAttributes(self) -> None:
|
| 66 |
+
self._active: Attribute[bool] = NotSet
|
| 67 |
+
self._config: Attribute[dict] = NotSet
|
| 68 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 69 |
+
self._deliveries_url: Attribute[str] = NotSet
|
| 70 |
+
self._events: Attribute[list[str]] = NotSet
|
| 71 |
+
self._id: Attribute[int] = NotSet
|
| 72 |
+
self._last_response: Attribute[github.HookResponse.HookResponse] = NotSet
|
| 73 |
+
self._name: Attribute[str] = NotSet
|
| 74 |
+
self._ping_url: Attribute[str] = NotSet
|
| 75 |
+
self._test_url: Attribute[str] = NotSet
|
| 76 |
+
self._type: Attribute[str] = NotSet
|
| 77 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 78 |
+
self._url: Attribute[str] = NotSet
|
| 79 |
+
|
| 80 |
+
def __repr__(self) -> str:
|
| 81 |
+
return self.get__repr__({"id": self._id.value, "url": self._url.value})
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def active(self) -> bool:
|
| 85 |
+
self._completeIfNotSet(self._active)
|
| 86 |
+
return self._active.value
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def config(self) -> dict:
|
| 90 |
+
self._completeIfNotSet(self._config)
|
| 91 |
+
return self._config.value
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def created_at(self) -> datetime:
|
| 95 |
+
self._completeIfNotSet(self._created_at)
|
| 96 |
+
return self._created_at.value
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def deliveries_url(self) -> str:
|
| 100 |
+
self._completeIfNotSet(self._deliveries_url)
|
| 101 |
+
return self._deliveries_url.value
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def events(self) -> list[str]:
|
| 105 |
+
self._completeIfNotSet(self._events)
|
| 106 |
+
return self._events.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def id(self) -> int:
|
| 110 |
+
self._completeIfNotSet(self._id)
|
| 111 |
+
return self._id.value
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def last_response(self) -> github.HookResponse.HookResponse:
|
| 115 |
+
self._completeIfNotSet(self._last_response)
|
| 116 |
+
return self._last_response.value
|
| 117 |
+
|
| 118 |
+
@property
|
| 119 |
+
def name(self) -> str:
|
| 120 |
+
self._completeIfNotSet(self._name)
|
| 121 |
+
return self._name.value
|
| 122 |
+
|
| 123 |
+
@property
|
| 124 |
+
def ping_url(self) -> str:
|
| 125 |
+
self._completeIfNotSet(self._ping_url)
|
| 126 |
+
return self._ping_url.value
|
| 127 |
+
|
| 128 |
+
@property
|
| 129 |
+
def test_url(self) -> str:
|
| 130 |
+
self._completeIfNotSet(self._test_url)
|
| 131 |
+
return self._test_url.value
|
| 132 |
+
|
| 133 |
+
@property
|
| 134 |
+
def type(self) -> str:
|
| 135 |
+
self._completeIfNotSet(self._type)
|
| 136 |
+
return self._type.value
|
| 137 |
+
|
| 138 |
+
@property
|
| 139 |
+
def updated_at(self) -> datetime:
|
| 140 |
+
self._completeIfNotSet(self._updated_at)
|
| 141 |
+
return self._updated_at.value
|
| 142 |
+
|
| 143 |
+
@property
|
| 144 |
+
def url(self) -> str:
|
| 145 |
+
self._completeIfNotSet(self._url)
|
| 146 |
+
return self._url.value
|
| 147 |
+
|
| 148 |
+
def delete(self) -> None:
|
| 149 |
+
"""
|
| 150 |
+
:calls: `DELETE /repos/{owner}/{repo}/hooks/{id} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 151 |
+
"""
|
| 152 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
|
| 153 |
+
|
| 154 |
+
def edit(
|
| 155 |
+
self,
|
| 156 |
+
name: str,
|
| 157 |
+
config: dict,
|
| 158 |
+
events: Opt[list[str]] = NotSet,
|
| 159 |
+
add_events: Opt[list[str]] = NotSet,
|
| 160 |
+
remove_events: Opt[list[str]] = NotSet,
|
| 161 |
+
active: Opt[bool] = NotSet,
|
| 162 |
+
) -> None:
|
| 163 |
+
"""
|
| 164 |
+
:calls: `PATCH /repos/{owner}/{repo}/hooks/{id} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 165 |
+
"""
|
| 166 |
+
assert isinstance(name, str), name
|
| 167 |
+
assert isinstance(config, dict), config
|
| 168 |
+
assert is_optional_list(events, str), events
|
| 169 |
+
assert is_optional_list(add_events, str), add_events
|
| 170 |
+
assert is_optional_list(remove_events, str), remove_events
|
| 171 |
+
assert is_optional(active, bool), active
|
| 172 |
+
post_parameters = NotSet.remove_unset_items(
|
| 173 |
+
{
|
| 174 |
+
"name": name,
|
| 175 |
+
"config": config,
|
| 176 |
+
"events": events,
|
| 177 |
+
"add_events": add_events,
|
| 178 |
+
"remove_events": remove_events,
|
| 179 |
+
"active": active,
|
| 180 |
+
}
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 184 |
+
self._useAttributes(data)
|
| 185 |
+
|
| 186 |
+
def test(self) -> None:
|
| 187 |
+
"""
|
| 188 |
+
:calls: `POST /repos/{owner}/{repo}/hooks/{id}/tests <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 189 |
+
"""
|
| 190 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/tests")
|
| 191 |
+
|
| 192 |
+
def ping(self) -> None:
|
| 193 |
+
"""
|
| 194 |
+
:calls: `POST /repos/{owner}/{repo}/hooks/{id}/pings <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 195 |
+
"""
|
| 196 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/pings")
|
| 197 |
+
|
| 198 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 199 |
+
if "active" in attributes: # pragma no branch
|
| 200 |
+
self._active = self._makeBoolAttribute(attributes["active"])
|
| 201 |
+
if "config" in attributes: # pragma no branch
|
| 202 |
+
self._config = self._makeDictAttribute(attributes["config"])
|
| 203 |
+
if "created_at" in attributes: # pragma no branch
|
| 204 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 205 |
+
if "deliveries_url" in attributes: # pragma no branch
|
| 206 |
+
self._deliveries_url = self._makeStringAttribute(attributes["deliveries_url"])
|
| 207 |
+
if "events" in attributes: # pragma no branch
|
| 208 |
+
self._events = self._makeListOfStringsAttribute(attributes["events"])
|
| 209 |
+
if "id" in attributes: # pragma no branch
|
| 210 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 211 |
+
if "last_response" in attributes: # pragma no branch
|
| 212 |
+
self._last_response = self._makeClassAttribute(
|
| 213 |
+
github.HookResponse.HookResponse, attributes["last_response"]
|
| 214 |
+
)
|
| 215 |
+
if "name" in attributes: # pragma no branch
|
| 216 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 217 |
+
if "ping_url" in attributes: # pragma no branch
|
| 218 |
+
self._ping_url = self._makeStringAttribute(attributes["ping_url"])
|
| 219 |
+
if "test_url" in attributes: # pragma no branch
|
| 220 |
+
self._test_url = self._makeStringAttribute(attributes["test_url"])
|
| 221 |
+
if "type" in attributes: # pragma no branch
|
| 222 |
+
self._type = self._makeStringAttribute(attributes["type"])
|
| 223 |
+
if "updated_at" in attributes: # pragma no branch
|
| 224 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 225 |
+
if "url" in attributes: # pragma no branch
|
| 226 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/HookResponse.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 16 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 17 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 20 |
+
# #
|
| 21 |
+
# This file is part of PyGithub. #
|
| 22 |
+
# http://pygithub.readthedocs.io/ #
|
| 23 |
+
# #
|
| 24 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 25 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 26 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 27 |
+
# any later version. #
|
| 28 |
+
# #
|
| 29 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 30 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 31 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 32 |
+
# details. #
|
| 33 |
+
# #
|
| 34 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 35 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 36 |
+
# #
|
| 37 |
+
################################################################################
|
| 38 |
+
|
| 39 |
+
from typing import Any, Dict
|
| 40 |
+
|
| 41 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class HookResponse(NonCompletableGithubObject):
|
| 45 |
+
"""
|
| 46 |
+
This class represents HookResponses.
|
| 47 |
+
|
| 48 |
+
The OpenAPI schema can be found at
|
| 49 |
+
- /components/schemas/hook-response
|
| 50 |
+
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
def _initAttributes(self) -> None:
|
| 54 |
+
self._code: Attribute[int] = NotSet
|
| 55 |
+
self._message: Attribute[str] = NotSet
|
| 56 |
+
self._status: Attribute[str] = NotSet
|
| 57 |
+
|
| 58 |
+
def __repr__(self) -> str:
|
| 59 |
+
return self.get__repr__({"status": self._status.value})
|
| 60 |
+
|
| 61 |
+
@property
|
| 62 |
+
def code(self) -> int:
|
| 63 |
+
return self._code.value
|
| 64 |
+
|
| 65 |
+
@property
|
| 66 |
+
def message(self) -> str:
|
| 67 |
+
return self._message.value
|
| 68 |
+
|
| 69 |
+
@property
|
| 70 |
+
def status(self) -> str:
|
| 71 |
+
return self._status.value
|
| 72 |
+
|
| 73 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 74 |
+
if "code" in attributes: # pragma no branch
|
| 75 |
+
self._code = self._makeIntAttribute(attributes["code"])
|
| 76 |
+
if "message" in attributes: # pragma no branch
|
| 77 |
+
self._message = self._makeStringAttribute(attributes["message"])
|
| 78 |
+
if "status" in attributes: # pragma no branch
|
| 79 |
+
self._status = self._makeStringAttribute(attributes["status"])
|
python_embeded/Lib/site-packages/github/InputFileContent.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 6 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 8 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 9 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 10 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 11 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 14 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 15 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 16 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 17 |
+
# #
|
| 18 |
+
# This file is part of PyGithub. #
|
| 19 |
+
# http://pygithub.readthedocs.io/ #
|
| 20 |
+
# #
|
| 21 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 22 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 23 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 24 |
+
# any later version. #
|
| 25 |
+
# #
|
| 26 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 27 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 28 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 29 |
+
# details. #
|
| 30 |
+
# #
|
| 31 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 32 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 33 |
+
# #
|
| 34 |
+
################################################################################
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
from __future__ import annotations
|
| 38 |
+
|
| 39 |
+
from typing import Any
|
| 40 |
+
|
| 41 |
+
from github.GithubObject import NotSet, Opt, is_defined, is_optional
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class InputFileContent:
|
| 45 |
+
"""
|
| 46 |
+
This class represents InputFileContents.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
def __init__(self, content: str, new_name: Opt[str] = NotSet):
|
| 50 |
+
assert isinstance(content, str), content
|
| 51 |
+
assert is_optional(new_name, str), new_name
|
| 52 |
+
self.__newName: Opt[str] = new_name
|
| 53 |
+
self.__content: str = content
|
| 54 |
+
|
| 55 |
+
@property
|
| 56 |
+
def _identity(self) -> dict[str, str]:
|
| 57 |
+
identity: dict[str, Any] = {
|
| 58 |
+
"content": self.__content,
|
| 59 |
+
}
|
| 60 |
+
if is_defined(self.__newName):
|
| 61 |
+
identity["filename"] = self.__newName
|
| 62 |
+
return identity
|
python_embeded/Lib/site-packages/github/InputGitAuthor.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 6 |
+
# Copyright 2014 Nic Dahlquist <nic@snapchat.com> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 16 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 17 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 19 |
+
# #
|
| 20 |
+
# This file is part of PyGithub. #
|
| 21 |
+
# http://pygithub.readthedocs.io/ #
|
| 22 |
+
# #
|
| 23 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 24 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 25 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 26 |
+
# any later version. #
|
| 27 |
+
# #
|
| 28 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 29 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 30 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 31 |
+
# details. #
|
| 32 |
+
# #
|
| 33 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 34 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 35 |
+
# #
|
| 36 |
+
################################################################################
|
| 37 |
+
|
| 38 |
+
from __future__ import annotations
|
| 39 |
+
|
| 40 |
+
from typing import Any
|
| 41 |
+
|
| 42 |
+
from github.GithubObject import NotSet, Opt, is_defined, is_optional
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class InputGitAuthor:
|
| 46 |
+
"""
|
| 47 |
+
This class represents InputGitAuthors.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
def __init__(self, name: str, email: str, date: Opt[str] = NotSet):
|
| 51 |
+
assert isinstance(name, str), name
|
| 52 |
+
assert isinstance(email, str), email
|
| 53 |
+
assert is_optional(date, str), date # @todo Datetime?
|
| 54 |
+
|
| 55 |
+
self.__name: str = name
|
| 56 |
+
self.__email: str = email
|
| 57 |
+
self.__date: Opt[str] = date
|
| 58 |
+
|
| 59 |
+
def __repr__(self) -> str:
|
| 60 |
+
return f'InputGitAuthor(name="{self.__name}")'
|
| 61 |
+
|
| 62 |
+
@property
|
| 63 |
+
def _identity(self) -> dict[str, str]:
|
| 64 |
+
identity: dict[str, Any] = {
|
| 65 |
+
"name": self.__name,
|
| 66 |
+
"email": self.__email,
|
| 67 |
+
}
|
| 68 |
+
if is_defined(self.__date):
|
| 69 |
+
identity["date"] = self.__date
|
| 70 |
+
return identity
|
python_embeded/Lib/site-packages/github/InputGitTreeElement.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 6 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 8 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 9 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 10 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 11 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 14 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 15 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 16 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 17 |
+
# #
|
| 18 |
+
# This file is part of PyGithub. #
|
| 19 |
+
# http://pygithub.readthedocs.io/ #
|
| 20 |
+
# #
|
| 21 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 22 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 23 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 24 |
+
# any later version. #
|
| 25 |
+
# #
|
| 26 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 27 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 28 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 29 |
+
# details. #
|
| 30 |
+
# #
|
| 31 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 32 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 33 |
+
# #
|
| 34 |
+
################################################################################
|
| 35 |
+
|
| 36 |
+
from __future__ import annotations
|
| 37 |
+
|
| 38 |
+
from typing import Any
|
| 39 |
+
|
| 40 |
+
from github.GithubObject import NotSet, Opt, is_defined, is_optional
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class InputGitTreeElement:
|
| 44 |
+
"""
|
| 45 |
+
This class represents InputGitTreeElements.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def __init__(
|
| 49 |
+
self,
|
| 50 |
+
path: str,
|
| 51 |
+
mode: str,
|
| 52 |
+
type: str,
|
| 53 |
+
content: Opt[str] = NotSet,
|
| 54 |
+
sha: Opt[str | None] = NotSet,
|
| 55 |
+
):
|
| 56 |
+
assert isinstance(path, str), path
|
| 57 |
+
assert isinstance(mode, str), mode
|
| 58 |
+
assert isinstance(type, str), type
|
| 59 |
+
assert is_optional(content, str), content
|
| 60 |
+
assert sha is None or is_optional(sha, str), sha
|
| 61 |
+
self.__path = path
|
| 62 |
+
self.__mode = mode
|
| 63 |
+
self.__type = type
|
| 64 |
+
self.__content = content
|
| 65 |
+
self.__sha: Opt[str] | None = sha
|
| 66 |
+
|
| 67 |
+
@property
|
| 68 |
+
def _identity(self) -> dict[str, Any]:
|
| 69 |
+
identity: dict[str, Any] = {
|
| 70 |
+
"path": self.__path,
|
| 71 |
+
"mode": self.__mode,
|
| 72 |
+
"type": self.__type,
|
| 73 |
+
}
|
| 74 |
+
if is_defined(self.__sha):
|
| 75 |
+
identity["sha"] = self.__sha
|
| 76 |
+
if is_defined(self.__content):
|
| 77 |
+
identity["content"] = self.__content
|
| 78 |
+
return identity
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
| 11 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2019 Adam Baratz <adam.baratz@gmail.com> #
|
| 15 |
+
# Copyright 2019 Rigas Papathanasopoulos <rigaspapas@gmail.com> #
|
| 16 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 18 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 20 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 22 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 24 |
+
# Copyright 2024 Min RK <benjaminrk@gmail.com> #
|
| 25 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# #
|
| 27 |
+
# This file is part of PyGithub. #
|
| 28 |
+
# http://pygithub.readthedocs.io/ #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 31 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 32 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 33 |
+
# any later version. #
|
| 34 |
+
# #
|
| 35 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 36 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 37 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 38 |
+
# details. #
|
| 39 |
+
# #
|
| 40 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 41 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 42 |
+
# #
|
| 43 |
+
################################################################################
|
| 44 |
+
|
| 45 |
+
from __future__ import annotations
|
| 46 |
+
|
| 47 |
+
from datetime import datetime
|
| 48 |
+
from typing import TYPE_CHECKING, Any
|
| 49 |
+
|
| 50 |
+
import github.Authorization
|
| 51 |
+
import github.Event
|
| 52 |
+
import github.Gist
|
| 53 |
+
import github.GithubObject
|
| 54 |
+
import github.Issue
|
| 55 |
+
import github.NamedUser
|
| 56 |
+
import github.Notification
|
| 57 |
+
import github.Organization
|
| 58 |
+
import github.PaginatedList
|
| 59 |
+
import github.Plan
|
| 60 |
+
import github.Repository
|
| 61 |
+
import github.UserKey
|
| 62 |
+
from github import Consts
|
| 63 |
+
from github.Auth import AppAuth
|
| 64 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 65 |
+
from github.PaginatedList import PaginatedList
|
| 66 |
+
from github.Requester import Requester
|
| 67 |
+
|
| 68 |
+
if TYPE_CHECKING:
|
| 69 |
+
from github.MainClass import Github
|
| 70 |
+
from github.NamedUser import NamedUser
|
| 71 |
+
from github.Organization import Organization
|
| 72 |
+
|
| 73 |
+
INTEGRATION_PREVIEW_HEADERS = {"Accept": Consts.mediaTypeIntegrationPreview}
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class Installation(NonCompletableGithubObject):
|
| 77 |
+
"""
|
| 78 |
+
This class represents Installations.
|
| 79 |
+
|
| 80 |
+
The reference can be found here
|
| 81 |
+
https://docs.github.com/en/rest/reference/apps#installations
|
| 82 |
+
|
| 83 |
+
The OpenAPI schema can be found at
|
| 84 |
+
- /components/schemas/installation
|
| 85 |
+
|
| 86 |
+
"""
|
| 87 |
+
|
| 88 |
+
def _initAttributes(self) -> None:
|
| 89 |
+
self._access_tokens_url: Attribute[str] = NotSet
|
| 90 |
+
self._account: Attribute[NamedUser | Organization] = NotSet
|
| 91 |
+
self._app_id: Attribute[int] = NotSet
|
| 92 |
+
self._app_slug: Attribute[str] = NotSet
|
| 93 |
+
self._contact_email: Attribute[str] = NotSet
|
| 94 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 95 |
+
self._events: Attribute[list[str]] = NotSet
|
| 96 |
+
self._has_multiple_single_files: Attribute[bool] = NotSet
|
| 97 |
+
self._html_url: Attribute[str] = NotSet
|
| 98 |
+
self._id: Attribute[int] = NotSet
|
| 99 |
+
self._permissions: Attribute[dict[str, Any]] = NotSet
|
| 100 |
+
self._repositories_url: Attribute[str] = NotSet
|
| 101 |
+
self._repository_selection: Attribute[str] = NotSet
|
| 102 |
+
self._single_file_name: Attribute[str] = NotSet
|
| 103 |
+
self._single_file_paths: Attribute[list[str]] = NotSet
|
| 104 |
+
self._suspended_at: Attribute[datetime] = NotSet
|
| 105 |
+
self._suspended_by: Attribute[NamedUser] = NotSet
|
| 106 |
+
self._target_id: Attribute[int] = NotSet
|
| 107 |
+
self._target_type: Attribute[str] = NotSet
|
| 108 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 109 |
+
|
| 110 |
+
def __init__(
|
| 111 |
+
self,
|
| 112 |
+
requester: Requester,
|
| 113 |
+
headers: dict[str, str | int],
|
| 114 |
+
attributes: Any,
|
| 115 |
+
) -> None:
|
| 116 |
+
super().__init__(requester, headers, attributes)
|
| 117 |
+
|
| 118 |
+
auth = self._requester.auth if self._requester is not None else None
|
| 119 |
+
# Usually, an Installation is created from a Requester with App authentication
|
| 120 |
+
if isinstance(auth, AppAuth):
|
| 121 |
+
# But the installation has to authenticate as an installation (e.g. for get_repos())
|
| 122 |
+
auth = auth.get_installation_auth(self.id, requester=self._requester)
|
| 123 |
+
self._requester = self._requester.withAuth(auth)
|
| 124 |
+
|
| 125 |
+
def __repr__(self) -> str:
|
| 126 |
+
return self.get__repr__({"id": self._id.value})
|
| 127 |
+
|
| 128 |
+
@property
|
| 129 |
+
def access_tokens_url(self) -> str:
|
| 130 |
+
return self._access_tokens_url.value
|
| 131 |
+
|
| 132 |
+
@property
|
| 133 |
+
def account(self) -> NamedUser | Organization:
|
| 134 |
+
return self._account.value
|
| 135 |
+
|
| 136 |
+
@property
|
| 137 |
+
def app_id(self) -> int:
|
| 138 |
+
return self._app_id.value
|
| 139 |
+
|
| 140 |
+
@property
|
| 141 |
+
def app_slug(self) -> str:
|
| 142 |
+
return self._app_slug.value
|
| 143 |
+
|
| 144 |
+
@property
|
| 145 |
+
def contact_email(self) -> str:
|
| 146 |
+
return self._contact_email.value
|
| 147 |
+
|
| 148 |
+
@property
|
| 149 |
+
def created_at(self) -> datetime:
|
| 150 |
+
return self._created_at.value
|
| 151 |
+
|
| 152 |
+
@property
|
| 153 |
+
def events(self) -> list[str]:
|
| 154 |
+
return self._events.value
|
| 155 |
+
|
| 156 |
+
@property
|
| 157 |
+
def has_multiple_single_files(self) -> bool:
|
| 158 |
+
return self._has_multiple_single_files.value
|
| 159 |
+
|
| 160 |
+
@property
|
| 161 |
+
def html_url(self) -> str:
|
| 162 |
+
return self._html_url.value
|
| 163 |
+
|
| 164 |
+
@property
|
| 165 |
+
def id(self) -> int:
|
| 166 |
+
return self._id.value
|
| 167 |
+
|
| 168 |
+
@property
|
| 169 |
+
def permissions(self) -> dict[str, Any]:
|
| 170 |
+
return self._permissions.value
|
| 171 |
+
|
| 172 |
+
@property
|
| 173 |
+
def repositories_url(self) -> str:
|
| 174 |
+
return self._repositories_url.value
|
| 175 |
+
|
| 176 |
+
@property
|
| 177 |
+
def repository_selection(self) -> str:
|
| 178 |
+
return self._repository_selection.value
|
| 179 |
+
|
| 180 |
+
@property
|
| 181 |
+
def requester(self) -> Requester:
|
| 182 |
+
"""
|
| 183 |
+
Return my Requester object.
|
| 184 |
+
|
| 185 |
+
For example, to make requests to API endpoints not yet supported by PyGitHub.
|
| 186 |
+
|
| 187 |
+
"""
|
| 188 |
+
return self._requester
|
| 189 |
+
|
| 190 |
+
@property
|
| 191 |
+
def single_file_name(self) -> str:
|
| 192 |
+
return self._single_file_name.value
|
| 193 |
+
|
| 194 |
+
@property
|
| 195 |
+
def single_file_paths(self) -> list[str]:
|
| 196 |
+
return self._single_file_paths.value
|
| 197 |
+
|
| 198 |
+
@property
|
| 199 |
+
def suspended_at(self) -> datetime:
|
| 200 |
+
return self._suspended_at.value
|
| 201 |
+
|
| 202 |
+
@property
|
| 203 |
+
def suspended_by(self) -> NamedUser:
|
| 204 |
+
return self._suspended_by.value
|
| 205 |
+
|
| 206 |
+
@property
|
| 207 |
+
def target_id(self) -> int:
|
| 208 |
+
return self._target_id.value
|
| 209 |
+
|
| 210 |
+
@property
|
| 211 |
+
def target_type(self) -> str:
|
| 212 |
+
return self._target_type.value
|
| 213 |
+
|
| 214 |
+
@property
|
| 215 |
+
def updated_at(self) -> datetime:
|
| 216 |
+
return self._updated_at.value
|
| 217 |
+
|
| 218 |
+
def get_github_for_installation(self) -> Github:
|
| 219 |
+
return github.Github(**self._requester.kwargs)
|
| 220 |
+
|
| 221 |
+
def get_repos(self) -> PaginatedList[github.Repository.Repository]:
|
| 222 |
+
"""
|
| 223 |
+
:calls: `GET /installation/repositories <https://docs.github.com/en/rest/reference/integrations/installations#list-repositories>`_
|
| 224 |
+
"""
|
| 225 |
+
url_parameters: dict[str, Any] = {}
|
| 226 |
+
|
| 227 |
+
return PaginatedList(
|
| 228 |
+
contentClass=github.Repository.Repository,
|
| 229 |
+
requester=self._requester,
|
| 230 |
+
firstUrl="/installation/repositories",
|
| 231 |
+
firstParams=url_parameters,
|
| 232 |
+
headers=INTEGRATION_PREVIEW_HEADERS,
|
| 233 |
+
list_item="repositories",
|
| 234 |
+
)
|
| 235 |
+
|
| 236 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 237 |
+
if "access_tokens_url" in attributes: # pragma no branch
|
| 238 |
+
self._access_tokens_url = self._makeStringAttribute(attributes["access_tokens_url"])
|
| 239 |
+
if "account" in attributes and "target_type" in attributes: # pragma no branch
|
| 240 |
+
target_type = attributes["target_type"]
|
| 241 |
+
if target_type == "User":
|
| 242 |
+
self._account = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["account"])
|
| 243 |
+
if target_type == "Organization":
|
| 244 |
+
self._account = self._makeClassAttribute(github.Organization.Organization, attributes["account"])
|
| 245 |
+
if "app_id" in attributes: # pragma no branch
|
| 246 |
+
self._app_id = self._makeIntAttribute(attributes["app_id"])
|
| 247 |
+
if "app_slug" in attributes: # pragma no branch
|
| 248 |
+
self._app_slug = self._makeStringAttribute(attributes["app_slug"])
|
| 249 |
+
if "contact_email" in attributes: # pragma no branch
|
| 250 |
+
self._contact_email = self._makeStringAttribute(attributes["contact_email"])
|
| 251 |
+
if "created_at" in attributes: # pragma no branch
|
| 252 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 253 |
+
if "events" in attributes: # pragma no branch
|
| 254 |
+
self._events = self._makeListOfStringsAttribute(attributes["events"])
|
| 255 |
+
if "has_multiple_single_files" in attributes: # pragma no branch
|
| 256 |
+
self._has_multiple_single_files = self._makeBoolAttribute(attributes["has_multiple_single_files"])
|
| 257 |
+
if "html_url" in attributes: # pragma no branch
|
| 258 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 259 |
+
if "id" in attributes: # pragma no branch
|
| 260 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 261 |
+
if "permissions" in attributes: # pragma no branch
|
| 262 |
+
self._permissions = self._makeDictAttribute(attributes["permissions"])
|
| 263 |
+
if "repositories_url" in attributes: # pragma no branch
|
| 264 |
+
self._repositories_url = self._makeStringAttribute(attributes["repositories_url"])
|
| 265 |
+
if "repository_selection" in attributes: # pragma no branch
|
| 266 |
+
self._repository_selection = self._makeStringAttribute(attributes["repository_selection"])
|
| 267 |
+
if "single_file_name" in attributes: # pragma no branch
|
| 268 |
+
self._single_file_name = self._makeStringAttribute(attributes["single_file_name"])
|
| 269 |
+
if "single_file_paths" in attributes: # pragma no branch
|
| 270 |
+
self._single_file_paths = self._makeListOfStringsAttribute(attributes["single_file_paths"])
|
| 271 |
+
if "suspended_at" in attributes: # pragma no branch
|
| 272 |
+
self._suspended_at = self._makeDatetimeAttribute(attributes["suspended_at"])
|
| 273 |
+
if "suspended_by" in attributes: # pragma no branch
|
| 274 |
+
self._suspended_by = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["suspended_by"])
|
| 275 |
+
if "target_id" in attributes: # pragma no branch
|
| 276 |
+
self._target_id = self._makeIntAttribute(attributes["target_id"])
|
| 277 |
+
if "target_type" in attributes: # pragma no branch
|
| 278 |
+
self._target_type = self._makeStringAttribute(attributes["target_type"])
|
| 279 |
+
if "updated_at" in attributes: # pragma no branch
|
| 280 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
python_embeded/Lib/site-packages/github/InstallationAuthorization.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 11 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2023 Denis Blanchette <dblanchette@coveo.com> #
|
| 17 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 20 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# #
|
| 24 |
+
# This file is part of PyGithub. #
|
| 25 |
+
# http://pygithub.readthedocs.io/ #
|
| 26 |
+
# #
|
| 27 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 28 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 29 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 30 |
+
# any later version. #
|
| 31 |
+
# #
|
| 32 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 33 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 34 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 35 |
+
# details. #
|
| 36 |
+
# #
|
| 37 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 38 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 39 |
+
# #
|
| 40 |
+
################################################################################
|
| 41 |
+
|
| 42 |
+
from __future__ import annotations
|
| 43 |
+
|
| 44 |
+
from datetime import datetime
|
| 45 |
+
from typing import TYPE_CHECKING, Any
|
| 46 |
+
|
| 47 |
+
import github.NamedUser
|
| 48 |
+
import github.PaginatedList
|
| 49 |
+
import github.Repository
|
| 50 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 51 |
+
|
| 52 |
+
if TYPE_CHECKING:
|
| 53 |
+
from github.NamedUser import NamedUser
|
| 54 |
+
from github.Repository import Repository
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class InstallationAuthorization(NonCompletableGithubObject):
|
| 58 |
+
"""
|
| 59 |
+
This class represents InstallationAuthorizations.
|
| 60 |
+
|
| 61 |
+
The OpenAPI schema can be found at
|
| 62 |
+
- /components/schemas/installation-token
|
| 63 |
+
|
| 64 |
+
"""
|
| 65 |
+
|
| 66 |
+
def _initAttributes(self) -> None:
|
| 67 |
+
self._expires_at: Attribute[datetime] = NotSet
|
| 68 |
+
self._has_multiple_single_files: Attribute[bool] = NotSet
|
| 69 |
+
self._on_behalf_of: Attribute[NamedUser] = NotSet
|
| 70 |
+
self._permissions: Attribute[dict] = NotSet
|
| 71 |
+
self._repositories: Attribute[list[Repository]] = NotSet
|
| 72 |
+
self._repository_selection: Attribute[str] = NotSet
|
| 73 |
+
self._single_file: Attribute[str] = NotSet
|
| 74 |
+
self._single_file_paths: Attribute[list[str]] = NotSet
|
| 75 |
+
self._token: Attribute[str] = NotSet
|
| 76 |
+
|
| 77 |
+
def __repr__(self) -> str:
|
| 78 |
+
return self.get__repr__({"expires_at": self._expires_at.value})
|
| 79 |
+
|
| 80 |
+
@property
|
| 81 |
+
def expires_at(self) -> datetime:
|
| 82 |
+
return self._expires_at.value
|
| 83 |
+
|
| 84 |
+
@property
|
| 85 |
+
def has_multiple_single_files(self) -> bool:
|
| 86 |
+
return self._has_multiple_single_files.value
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def on_behalf_of(self) -> NamedUser:
|
| 90 |
+
return self._on_behalf_of.value
|
| 91 |
+
|
| 92 |
+
@property
|
| 93 |
+
def permissions(self) -> dict:
|
| 94 |
+
return self._permissions.value
|
| 95 |
+
|
| 96 |
+
@property
|
| 97 |
+
def repositories(self) -> list[Repository]:
|
| 98 |
+
return self._repositories.value
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def repository_selection(self) -> str:
|
| 102 |
+
return self._repository_selection.value
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def single_file(self) -> str:
|
| 106 |
+
return self._single_file.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def single_file_paths(self) -> list[str]:
|
| 110 |
+
return self._single_file_paths.value
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def token(self) -> str:
|
| 114 |
+
return self._token.value
|
| 115 |
+
|
| 116 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 117 |
+
if "expires_at" in attributes: # pragma no branch
|
| 118 |
+
self._expires_at = self._makeDatetimeAttribute(attributes["expires_at"])
|
| 119 |
+
if "has_multiple_single_files" in attributes: # pragma no branch
|
| 120 |
+
self._has_multiple_single_files = self._makeBoolAttribute(attributes["has_multiple_single_files"])
|
| 121 |
+
if "on_behalf_of" in attributes: # pragma no branch
|
| 122 |
+
self._on_behalf_of = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["on_behalf_of"])
|
| 123 |
+
if "permissions" in attributes: # pragma no branch
|
| 124 |
+
self._permissions = self._makeDictAttribute(attributes["permissions"])
|
| 125 |
+
if "repositories" in attributes: # pragma no branch
|
| 126 |
+
self._repositories = self._makeListOfClassesAttribute(
|
| 127 |
+
github.Repository.Repository, attributes["repositories"]
|
| 128 |
+
)
|
| 129 |
+
if "repository_selection" in attributes: # pragma no branch
|
| 130 |
+
self._repository_selection = self._makeStringAttribute(attributes["repository_selection"])
|
| 131 |
+
if "single_file" in attributes: # pragma no branch
|
| 132 |
+
self._single_file = self._makeStringAttribute(attributes["single_file"])
|
| 133 |
+
if "single_file_paths" in attributes: # pragma no branch
|
| 134 |
+
self._single_file_paths = self._makeListOfStringsAttribute(attributes["single_file_paths"])
|
| 135 |
+
if "token" in attributes: # pragma no branch
|
| 136 |
+
self._token = self._makeStringAttribute(attributes["token"])
|
python_embeded/Lib/site-packages/github/Invitation.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
| 11 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 12 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 20 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# #
|
| 24 |
+
# This file is part of PyGithub. #
|
| 25 |
+
# http://pygithub.readthedocs.io/ #
|
| 26 |
+
# #
|
| 27 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 28 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 29 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 30 |
+
# any later version. #
|
| 31 |
+
# #
|
| 32 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 33 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 34 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 35 |
+
# details. #
|
| 36 |
+
# #
|
| 37 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 38 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 39 |
+
# #
|
| 40 |
+
################################################################################
|
| 41 |
+
|
| 42 |
+
from __future__ import annotations
|
| 43 |
+
|
| 44 |
+
from datetime import datetime
|
| 45 |
+
from typing import TYPE_CHECKING, Any
|
| 46 |
+
|
| 47 |
+
import github.GithubObject
|
| 48 |
+
import github.NamedUser
|
| 49 |
+
import github.Repository
|
| 50 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 51 |
+
|
| 52 |
+
if TYPE_CHECKING:
|
| 53 |
+
from github.NamedUser import NamedUser
|
| 54 |
+
from github.Repository import Repository
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class Invitation(CompletableGithubObject):
|
| 58 |
+
"""
|
| 59 |
+
This class represents repository invitations.
|
| 60 |
+
|
| 61 |
+
The reference can be found here
|
| 62 |
+
https://docs.github.com/en/rest/reference/repos#invitations
|
| 63 |
+
|
| 64 |
+
The OpenAPI schema can be found at
|
| 65 |
+
- /components/schemas/repository-invitation
|
| 66 |
+
|
| 67 |
+
"""
|
| 68 |
+
|
| 69 |
+
def _initAttributes(self) -> None:
|
| 70 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 71 |
+
self._expired: Attribute[bool] = NotSet
|
| 72 |
+
self._html_url: Attribute[str] = NotSet
|
| 73 |
+
self._id: Attribute[int] = NotSet
|
| 74 |
+
self._invitee: Attribute[NamedUser] = NotSet
|
| 75 |
+
self._inviter: Attribute[NamedUser] = NotSet
|
| 76 |
+
self._node_id: Attribute[str] = NotSet
|
| 77 |
+
self._permissions: Attribute[str] = NotSet
|
| 78 |
+
self._repository: Attribute[Repository] = NotSet
|
| 79 |
+
self._url: Attribute[str] = NotSet
|
| 80 |
+
|
| 81 |
+
def __repr__(self) -> str:
|
| 82 |
+
return self.get__repr__({"id": self._id.value})
|
| 83 |
+
|
| 84 |
+
@property
|
| 85 |
+
def created_at(self) -> datetime:
|
| 86 |
+
self._completeIfNotSet(self._created_at)
|
| 87 |
+
return self._created_at.value
|
| 88 |
+
|
| 89 |
+
@property
|
| 90 |
+
def expired(self) -> bool:
|
| 91 |
+
self._completeIfNotSet(self._expired)
|
| 92 |
+
return self._expired.value
|
| 93 |
+
|
| 94 |
+
@property
|
| 95 |
+
def html_url(self) -> str:
|
| 96 |
+
self._completeIfNotSet(self._html_url)
|
| 97 |
+
return self._html_url.value
|
| 98 |
+
|
| 99 |
+
@property
|
| 100 |
+
def id(self) -> int:
|
| 101 |
+
self._completeIfNotSet(self._id)
|
| 102 |
+
return self._id.value
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def invitee(self) -> NamedUser:
|
| 106 |
+
self._completeIfNotSet(self._invitee)
|
| 107 |
+
return self._invitee.value
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def inviter(self) -> NamedUser:
|
| 111 |
+
self._completeIfNotSet(self._inviter)
|
| 112 |
+
return self._inviter.value
|
| 113 |
+
|
| 114 |
+
@property
|
| 115 |
+
def node_id(self) -> str:
|
| 116 |
+
self._completeIfNotSet(self._node_id)
|
| 117 |
+
return self._node_id.value
|
| 118 |
+
|
| 119 |
+
@property
|
| 120 |
+
def permissions(self) -> str:
|
| 121 |
+
self._completeIfNotSet(self._permissions)
|
| 122 |
+
return self._permissions.value
|
| 123 |
+
|
| 124 |
+
@property
|
| 125 |
+
def repository(self) -> Repository:
|
| 126 |
+
self._completeIfNotSet(self._repository)
|
| 127 |
+
return self._repository.value
|
| 128 |
+
|
| 129 |
+
@property
|
| 130 |
+
def url(self) -> str:
|
| 131 |
+
self._completeIfNotSet(self._url)
|
| 132 |
+
return self._url.value
|
| 133 |
+
|
| 134 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 135 |
+
if "created_at" in attributes: # pragma no branch
|
| 136 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 137 |
+
if "expired" in attributes: # pragma no branch
|
| 138 |
+
self._expired = self._makeBoolAttribute(attributes["expired"])
|
| 139 |
+
if "html_url" in attributes: # pragma no branch
|
| 140 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 141 |
+
if "id" in attributes: # pragma no branch
|
| 142 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 143 |
+
if "invitee" in attributes: # pragma no branch
|
| 144 |
+
self._invitee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["invitee"])
|
| 145 |
+
if "inviter" in attributes: # pragma no branch
|
| 146 |
+
self._inviter = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["inviter"])
|
| 147 |
+
if "node_id" in attributes: # pragma no branch
|
| 148 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 149 |
+
|
| 150 |
+
if "permissions" in attributes: # pragma no branch
|
| 151 |
+
self._permissions = self._makeStringAttribute(attributes["permissions"])
|
| 152 |
+
if "repository" in attributes: # pragma no branch
|
| 153 |
+
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
|
| 154 |
+
if "url" in attributes: # pragma no branch
|
| 155 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/Issue.py
ADDED
|
@@ -0,0 +1,673 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Andrew Bettison <andrewb@zip.com.au> #
|
| 4 |
+
# Copyright 2012 Philip Kimmey <philip@rover.com> #
|
| 5 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 6 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 7 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 8 |
+
# Copyright 2013 David Farr <david.farr@sap.com> #
|
| 9 |
+
# Copyright 2013 Stuart Glaser <stuglaser@gmail.com> #
|
| 10 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 11 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 12 |
+
# Copyright 2015 Raja Reddy Karri <klnrajareddy@gmail.com> #
|
| 13 |
+
# Copyright 2016 @tmshn <tmshn@r.recruit.co.jp> #
|
| 14 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 15 |
+
# Copyright 2016 Matt Babineau <babineaum@users.noreply.github.com> #
|
| 16 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 17 |
+
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
| 18 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 19 |
+
# Copyright 2018 Aaron L. Levine <allevin@sandia.gov> #
|
| 20 |
+
# Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com> #
|
| 21 |
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
| 22 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 23 |
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
| 24 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 25 |
+
# Copyright 2019 Filipe Laíns <filipe.lains@gmail.com> #
|
| 26 |
+
# Copyright 2019 Nick Campbell <nicholas.j.campbell@gmail.com> #
|
| 27 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 28 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 29 |
+
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
| 30 |
+
# Copyright 2020 Huw Jones <huwcbjones@outlook.com> #
|
| 31 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 32 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 33 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 34 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 35 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 36 |
+
# Copyright 2023 Nicolas Schweitzer <nicolas.schweitzer@datadoghq.com> #
|
| 37 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 38 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 39 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 40 |
+
# Copyright 2024 Malik Shahzad Muzaffar <shahzad.malik.muzaffar@cern.ch> #
|
| 41 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 42 |
+
# #
|
| 43 |
+
# This file is part of PyGithub. #
|
| 44 |
+
# http://pygithub.readthedocs.io/ #
|
| 45 |
+
# #
|
| 46 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 47 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 48 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 49 |
+
# any later version. #
|
| 50 |
+
# #
|
| 51 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 52 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 53 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 54 |
+
# details. #
|
| 55 |
+
# #
|
| 56 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 57 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 58 |
+
# #
|
| 59 |
+
################################################################################
|
| 60 |
+
|
| 61 |
+
from __future__ import annotations
|
| 62 |
+
|
| 63 |
+
import urllib.parse
|
| 64 |
+
from datetime import datetime
|
| 65 |
+
from typing import TYPE_CHECKING, Any
|
| 66 |
+
|
| 67 |
+
import github.GithubApp
|
| 68 |
+
import github.GithubObject
|
| 69 |
+
import github.IssueComment
|
| 70 |
+
import github.IssueEvent
|
| 71 |
+
import github.IssuePullRequest
|
| 72 |
+
import github.Label
|
| 73 |
+
import github.Milestone
|
| 74 |
+
import github.NamedUser
|
| 75 |
+
import github.PullRequest
|
| 76 |
+
import github.Reaction
|
| 77 |
+
import github.Repository
|
| 78 |
+
import github.TimelineEvent
|
| 79 |
+
from github import Consts
|
| 80 |
+
from github.GithubObject import (
|
| 81 |
+
Attribute,
|
| 82 |
+
CompletableGithubObject,
|
| 83 |
+
NotSet,
|
| 84 |
+
Opt,
|
| 85 |
+
is_defined,
|
| 86 |
+
is_optional,
|
| 87 |
+
is_optional_list,
|
| 88 |
+
is_undefined,
|
| 89 |
+
)
|
| 90 |
+
from github.PaginatedList import PaginatedList
|
| 91 |
+
|
| 92 |
+
if TYPE_CHECKING:
|
| 93 |
+
from github.GithubApp import GithubApp
|
| 94 |
+
from github.IssueComment import IssueComment
|
| 95 |
+
from github.IssueEvent import IssueEvent
|
| 96 |
+
from github.IssuePullRequest import IssuePullRequest
|
| 97 |
+
from github.Label import Label
|
| 98 |
+
from github.Milestone import Milestone
|
| 99 |
+
from github.NamedUser import NamedUser
|
| 100 |
+
from github.PullRequest import PullRequest
|
| 101 |
+
from github.Reaction import Reaction
|
| 102 |
+
from github.Repository import Repository
|
| 103 |
+
from github.TimelineEvent import TimelineEvent
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class Issue(CompletableGithubObject):
|
| 107 |
+
"""
|
| 108 |
+
This class represents Issues.
|
| 109 |
+
|
| 110 |
+
The reference can be found here
|
| 111 |
+
https://docs.github.com/en/rest/reference/issues
|
| 112 |
+
|
| 113 |
+
The OpenAPI schema can be found at
|
| 114 |
+
- /components/schemas/issue
|
| 115 |
+
- /components/schemas/issue-search-result-item
|
| 116 |
+
- /components/schemas/nullable-issue
|
| 117 |
+
|
| 118 |
+
"""
|
| 119 |
+
|
| 120 |
+
def _initAttributes(self) -> None:
|
| 121 |
+
self._active_lock_reason: Attribute[str | None] = NotSet
|
| 122 |
+
self._assignee: Attribute[NamedUser | None] = NotSet
|
| 123 |
+
self._assignees: Attribute[list[NamedUser]] = NotSet
|
| 124 |
+
self._author_association: Attribute[str] = NotSet
|
| 125 |
+
self._body: Attribute[str] = NotSet
|
| 126 |
+
self._body_html: Attribute[str] = NotSet
|
| 127 |
+
self._body_text: Attribute[str] = NotSet
|
| 128 |
+
self._closed_at: Attribute[datetime] = NotSet
|
| 129 |
+
self._closed_by: Attribute[NamedUser] = NotSet
|
| 130 |
+
self._comments: Attribute[int] = NotSet
|
| 131 |
+
self._comments_url: Attribute[str] = NotSet
|
| 132 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 133 |
+
self._draft: Attribute[bool] = NotSet
|
| 134 |
+
self._events_url: Attribute[str] = NotSet
|
| 135 |
+
self._html_url: Attribute[str] = NotSet
|
| 136 |
+
self._id: Attribute[int] = NotSet
|
| 137 |
+
self._labels: Attribute[list[Label]] = NotSet
|
| 138 |
+
self._labels_url: Attribute[str] = NotSet
|
| 139 |
+
self._locked: Attribute[bool] = NotSet
|
| 140 |
+
self._milestone: Attribute[Milestone] = NotSet
|
| 141 |
+
self._node_id: Attribute[str] = NotSet
|
| 142 |
+
self._number: Attribute[int] = NotSet
|
| 143 |
+
self._performed_via_github_app: Attribute[GithubApp] = NotSet
|
| 144 |
+
self._pull_request: Attribute[IssuePullRequest] = NotSet
|
| 145 |
+
self._reactions: Attribute[dict] = NotSet
|
| 146 |
+
self._repository: Attribute[Repository] = NotSet
|
| 147 |
+
self._repository_url: Attribute[str] = NotSet
|
| 148 |
+
self._score: Attribute[float] = NotSet
|
| 149 |
+
self._state: Attribute[str] = NotSet
|
| 150 |
+
self._state_reason: Attribute[str | None] = NotSet
|
| 151 |
+
self._text_matches: Attribute[dict[str, Any]] = NotSet
|
| 152 |
+
self._timeline_url: Attribute[str] = NotSet
|
| 153 |
+
self._title: Attribute[str] = NotSet
|
| 154 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 155 |
+
self._url: Attribute[str] = NotSet
|
| 156 |
+
self._user: Attribute[NamedUser] = NotSet
|
| 157 |
+
|
| 158 |
+
def __repr__(self) -> str:
|
| 159 |
+
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
| 160 |
+
|
| 161 |
+
@property
|
| 162 |
+
def _identity(self) -> int:
|
| 163 |
+
return self.number
|
| 164 |
+
|
| 165 |
+
@property
|
| 166 |
+
def active_lock_reason(self) -> str | None:
|
| 167 |
+
self._completeIfNotSet(self._active_lock_reason)
|
| 168 |
+
return self._active_lock_reason.value
|
| 169 |
+
|
| 170 |
+
@property
|
| 171 |
+
def assignee(self) -> NamedUser | None:
|
| 172 |
+
self._completeIfNotSet(self._assignee)
|
| 173 |
+
return self._assignee.value
|
| 174 |
+
|
| 175 |
+
@property
|
| 176 |
+
def assignees(self) -> list[NamedUser]:
|
| 177 |
+
self._completeIfNotSet(self._assignees)
|
| 178 |
+
return self._assignees.value
|
| 179 |
+
|
| 180 |
+
@property
|
| 181 |
+
def author_association(self) -> str:
|
| 182 |
+
self._completeIfNotSet(self._author_association)
|
| 183 |
+
return self._author_association.value
|
| 184 |
+
|
| 185 |
+
@property
|
| 186 |
+
def body(self) -> str:
|
| 187 |
+
self._completeIfNotSet(self._body)
|
| 188 |
+
return self._body.value
|
| 189 |
+
|
| 190 |
+
@property
|
| 191 |
+
def body_html(self) -> str:
|
| 192 |
+
self._completeIfNotSet(self._body_html)
|
| 193 |
+
return self._body_html.value
|
| 194 |
+
|
| 195 |
+
@property
|
| 196 |
+
def body_text(self) -> str:
|
| 197 |
+
self._completeIfNotSet(self._body_text)
|
| 198 |
+
return self._body_text.value
|
| 199 |
+
|
| 200 |
+
@property
|
| 201 |
+
def closed_at(self) -> datetime:
|
| 202 |
+
self._completeIfNotSet(self._closed_at)
|
| 203 |
+
return self._closed_at.value
|
| 204 |
+
|
| 205 |
+
@property
|
| 206 |
+
def closed_by(self) -> NamedUser | None:
|
| 207 |
+
self._completeIfNotSet(self._closed_by)
|
| 208 |
+
return self._closed_by.value
|
| 209 |
+
|
| 210 |
+
@property
|
| 211 |
+
def comments(self) -> int:
|
| 212 |
+
self._completeIfNotSet(self._comments)
|
| 213 |
+
return self._comments.value
|
| 214 |
+
|
| 215 |
+
@property
|
| 216 |
+
def comments_url(self) -> str:
|
| 217 |
+
self._completeIfNotSet(self._comments_url)
|
| 218 |
+
return self._comments_url.value
|
| 219 |
+
|
| 220 |
+
@property
|
| 221 |
+
def created_at(self) -> datetime:
|
| 222 |
+
self._completeIfNotSet(self._created_at)
|
| 223 |
+
return self._created_at.value
|
| 224 |
+
|
| 225 |
+
@property
|
| 226 |
+
def draft(self) -> bool:
|
| 227 |
+
self._completeIfNotSet(self._draft)
|
| 228 |
+
return self._draft.value
|
| 229 |
+
|
| 230 |
+
@property
|
| 231 |
+
def events_url(self) -> str:
|
| 232 |
+
self._completeIfNotSet(self._events_url)
|
| 233 |
+
return self._events_url.value
|
| 234 |
+
|
| 235 |
+
@property
|
| 236 |
+
def html_url(self) -> str:
|
| 237 |
+
self._completeIfNotSet(self._html_url)
|
| 238 |
+
return self._html_url.value
|
| 239 |
+
|
| 240 |
+
@property
|
| 241 |
+
def id(self) -> int:
|
| 242 |
+
self._completeIfNotSet(self._id)
|
| 243 |
+
return self._id.value
|
| 244 |
+
|
| 245 |
+
@property
|
| 246 |
+
def labels(self) -> list[Label]:
|
| 247 |
+
self._completeIfNotSet(self._labels)
|
| 248 |
+
return self._labels.value
|
| 249 |
+
|
| 250 |
+
@property
|
| 251 |
+
def labels_url(self) -> str:
|
| 252 |
+
self._completeIfNotSet(self._labels_url)
|
| 253 |
+
return self._labels_url.value
|
| 254 |
+
|
| 255 |
+
@property
|
| 256 |
+
def locked(self) -> bool:
|
| 257 |
+
self._completeIfNotSet(self._locked)
|
| 258 |
+
return self._locked.value
|
| 259 |
+
|
| 260 |
+
@property
|
| 261 |
+
def milestone(self) -> Milestone:
|
| 262 |
+
self._completeIfNotSet(self._milestone)
|
| 263 |
+
return self._milestone.value
|
| 264 |
+
|
| 265 |
+
@property
|
| 266 |
+
def node_id(self) -> str:
|
| 267 |
+
self._completeIfNotSet(self._node_id)
|
| 268 |
+
return self._node_id.value
|
| 269 |
+
|
| 270 |
+
@property
|
| 271 |
+
def number(self) -> int:
|
| 272 |
+
self._completeIfNotSet(self._number)
|
| 273 |
+
return self._number.value
|
| 274 |
+
|
| 275 |
+
@property
|
| 276 |
+
def performed_via_github_app(self) -> GithubApp:
|
| 277 |
+
self._completeIfNotSet(self._performed_via_github_app)
|
| 278 |
+
return self._performed_via_github_app.value
|
| 279 |
+
|
| 280 |
+
@property
|
| 281 |
+
def pull_request(self) -> IssuePullRequest | None:
|
| 282 |
+
self._completeIfNotSet(self._pull_request)
|
| 283 |
+
return self._pull_request.value
|
| 284 |
+
|
| 285 |
+
@property
|
| 286 |
+
def reactions(self) -> dict:
|
| 287 |
+
self._completeIfNotSet(self._reactions)
|
| 288 |
+
return self._reactions.value
|
| 289 |
+
|
| 290 |
+
@property
|
| 291 |
+
def repository(self) -> Repository:
|
| 292 |
+
self._completeIfNotSet(self._repository)
|
| 293 |
+
if is_undefined(self._repository):
|
| 294 |
+
# The repository was not set automatically, so it must be looked up by url.
|
| 295 |
+
repo_url = "/".join(self.url.split("/")[:-2])
|
| 296 |
+
self._repository = github.GithubObject._ValuedAttribute(
|
| 297 |
+
github.Repository.Repository(self._requester, self._headers, {"url": repo_url}, completed=False)
|
| 298 |
+
)
|
| 299 |
+
return self._repository.value
|
| 300 |
+
|
| 301 |
+
@property
|
| 302 |
+
def repository_url(self) -> str:
|
| 303 |
+
self._completeIfNotSet(self._repository_url)
|
| 304 |
+
return self._repository_url.value
|
| 305 |
+
|
| 306 |
+
@property
|
| 307 |
+
def score(self) -> float:
|
| 308 |
+
self._completeIfNotSet(self._score)
|
| 309 |
+
return self._score.value
|
| 310 |
+
|
| 311 |
+
@property
|
| 312 |
+
def state(self) -> str:
|
| 313 |
+
self._completeIfNotSet(self._state)
|
| 314 |
+
return self._state.value
|
| 315 |
+
|
| 316 |
+
@property
|
| 317 |
+
def state_reason(self) -> str | None:
|
| 318 |
+
self._completeIfNotSet(self._state_reason)
|
| 319 |
+
return self._state_reason.value
|
| 320 |
+
|
| 321 |
+
@property
|
| 322 |
+
def text_matches(self) -> dict[str, Any]:
|
| 323 |
+
self._completeIfNotSet(self._text_matches)
|
| 324 |
+
return self._text_matches.value
|
| 325 |
+
|
| 326 |
+
@property
|
| 327 |
+
def timeline_url(self) -> str:
|
| 328 |
+
self._completeIfNotSet(self._timeline_url)
|
| 329 |
+
return self._timeline_url.value
|
| 330 |
+
|
| 331 |
+
@property
|
| 332 |
+
def title(self) -> str:
|
| 333 |
+
self._completeIfNotSet(self._title)
|
| 334 |
+
return self._title.value
|
| 335 |
+
|
| 336 |
+
@property
|
| 337 |
+
def updated_at(self) -> datetime:
|
| 338 |
+
self._completeIfNotSet(self._updated_at)
|
| 339 |
+
return self._updated_at.value
|
| 340 |
+
|
| 341 |
+
@property
|
| 342 |
+
def url(self) -> str:
|
| 343 |
+
self._completeIfNotSet(self._url)
|
| 344 |
+
return self._url.value
|
| 345 |
+
|
| 346 |
+
@property
|
| 347 |
+
def user(self) -> NamedUser:
|
| 348 |
+
self._completeIfNotSet(self._user)
|
| 349 |
+
return self._user.value
|
| 350 |
+
|
| 351 |
+
def as_pull_request(self) -> PullRequest:
|
| 352 |
+
"""
|
| 353 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number} <https://docs.github.com/en/rest/reference/pulls>`_
|
| 354 |
+
"""
|
| 355 |
+
headers, data = self._requester.requestJsonAndCheck("GET", "/pulls/".join(self.url.rsplit("/issues/", 1)))
|
| 356 |
+
return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
|
| 357 |
+
|
| 358 |
+
def add_to_assignees(self, *assignees: NamedUser | str) -> None:
|
| 359 |
+
"""
|
| 360 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
|
| 361 |
+
"""
|
| 362 |
+
assert all(isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees), assignees
|
| 363 |
+
post_parameters = {
|
| 364 |
+
"assignees": [
|
| 365 |
+
assignee.login if isinstance(assignee, github.NamedUser.NamedUser) else assignee
|
| 366 |
+
for assignee in assignees
|
| 367 |
+
]
|
| 368 |
+
}
|
| 369 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/assignees", input=post_parameters)
|
| 370 |
+
self._useAttributes(data)
|
| 371 |
+
|
| 372 |
+
def add_to_labels(self, *labels: Label | str) -> None:
|
| 373 |
+
"""
|
| 374 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 375 |
+
"""
|
| 376 |
+
assert all(isinstance(element, (github.Label.Label, str)) for element in labels), labels
|
| 377 |
+
post_parameters = [label.name if isinstance(label, github.Label.Label) else label for label in labels]
|
| 378 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/labels", input=post_parameters)
|
| 379 |
+
|
| 380 |
+
def create_comment(self, body: str) -> IssueComment:
|
| 381 |
+
"""
|
| 382 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 383 |
+
"""
|
| 384 |
+
assert isinstance(body, str), body
|
| 385 |
+
post_parameters = {
|
| 386 |
+
"body": body,
|
| 387 |
+
}
|
| 388 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/comments", input=post_parameters)
|
| 389 |
+
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
| 390 |
+
|
| 391 |
+
def delete_labels(self) -> None:
|
| 392 |
+
"""
|
| 393 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 394 |
+
"""
|
| 395 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/labels")
|
| 396 |
+
|
| 397 |
+
def edit(
|
| 398 |
+
self,
|
| 399 |
+
title: Opt[str] = NotSet,
|
| 400 |
+
body: Opt[str] = NotSet,
|
| 401 |
+
assignee: Opt[str | NamedUser | None] = NotSet,
|
| 402 |
+
state: Opt[str] = NotSet,
|
| 403 |
+
milestone: Opt[Milestone | None] = NotSet,
|
| 404 |
+
labels: Opt[list[str]] = NotSet,
|
| 405 |
+
assignees: Opt[list[NamedUser | str]] = NotSet,
|
| 406 |
+
state_reason: Opt[str] = NotSet,
|
| 407 |
+
) -> None:
|
| 408 |
+
"""
|
| 409 |
+
:calls: `PATCH /repos/{owner}/{repo}/issues/{number} <https://docs.github.com/en/rest/reference/issues>`_
|
| 410 |
+
:param assignee: deprecated, use `assignees` instead. `assignee=None` means to remove current assignee.
|
| 411 |
+
:param milestone: `milestone=None` means to remove current milestone.
|
| 412 |
+
"""
|
| 413 |
+
assert is_optional(title, str), title
|
| 414 |
+
assert is_optional(body, str), body
|
| 415 |
+
assert assignee is None or is_optional(assignee, (github.NamedUser.NamedUser, str)), assignee
|
| 416 |
+
assert is_optional_list(assignees, (github.NamedUser.NamedUser, str)), assignees
|
| 417 |
+
assert is_optional(state, str), state
|
| 418 |
+
assert milestone is None or is_optional(milestone, github.Milestone.Milestone), milestone
|
| 419 |
+
assert is_optional_list(labels, str), labels
|
| 420 |
+
|
| 421 |
+
post_parameters = NotSet.remove_unset_items(
|
| 422 |
+
{
|
| 423 |
+
"title": title,
|
| 424 |
+
"body": body,
|
| 425 |
+
"state": state,
|
| 426 |
+
"state_reason": state_reason,
|
| 427 |
+
"labels": labels,
|
| 428 |
+
"assignee": assignee._identity
|
| 429 |
+
if isinstance(assignee, github.NamedUser.NamedUser)
|
| 430 |
+
else (assignee or ""),
|
| 431 |
+
"milestone": milestone._identity
|
| 432 |
+
if isinstance(milestone, github.Milestone.Milestone)
|
| 433 |
+
else (milestone or ""),
|
| 434 |
+
}
|
| 435 |
+
)
|
| 436 |
+
|
| 437 |
+
if is_defined(assignees):
|
| 438 |
+
post_parameters["assignees"] = [
|
| 439 |
+
element._identity if isinstance(element, github.NamedUser.NamedUser) else element
|
| 440 |
+
for element in assignees
|
| 441 |
+
]
|
| 442 |
+
|
| 443 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 444 |
+
self._useAttributes(data)
|
| 445 |
+
|
| 446 |
+
def lock(self, lock_reason: str) -> None:
|
| 447 |
+
"""
|
| 448 |
+
:calls: `PUT /repos/{owner}/{repo}/issues/{issue_number}/lock <https://docs.github.com/en/rest/reference/issues>`_
|
| 449 |
+
"""
|
| 450 |
+
assert isinstance(lock_reason, str), lock_reason
|
| 451 |
+
put_parameters = {"lock_reason": lock_reason}
|
| 452 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 453 |
+
"PUT",
|
| 454 |
+
f"{self.url}/lock",
|
| 455 |
+
input=put_parameters,
|
| 456 |
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
| 457 |
+
)
|
| 458 |
+
|
| 459 |
+
def unlock(self) -> None:
|
| 460 |
+
"""
|
| 461 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock <https://docs.github.com/en/rest/reference/issues>`_
|
| 462 |
+
"""
|
| 463 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/lock")
|
| 464 |
+
|
| 465 |
+
def get_comment(self, id: int) -> IssueComment:
|
| 466 |
+
"""
|
| 467 |
+
:calls: `GET /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 468 |
+
"""
|
| 469 |
+
assert isinstance(id, int), id
|
| 470 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self._parentUrl(self.url)}/comments/{id}")
|
| 471 |
+
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
| 472 |
+
|
| 473 |
+
def get_comments(self, since: Opt[datetime] = NotSet) -> PaginatedList[IssueComment]:
|
| 474 |
+
"""
|
| 475 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 476 |
+
"""
|
| 477 |
+
url_parameters = {}
|
| 478 |
+
if is_defined(since):
|
| 479 |
+
assert isinstance(since, datetime), since
|
| 480 |
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 481 |
+
|
| 482 |
+
return PaginatedList(
|
| 483 |
+
github.IssueComment.IssueComment,
|
| 484 |
+
self._requester,
|
| 485 |
+
f"{self.url}/comments",
|
| 486 |
+
url_parameters,
|
| 487 |
+
)
|
| 488 |
+
|
| 489 |
+
def get_events(self) -> PaginatedList[IssueEvent]:
|
| 490 |
+
"""
|
| 491 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/events <https://docs.github.com/en/rest/reference/issues#events>`_
|
| 492 |
+
"""
|
| 493 |
+
return PaginatedList(
|
| 494 |
+
github.IssueEvent.IssueEvent,
|
| 495 |
+
self._requester,
|
| 496 |
+
f"{self.url}/events",
|
| 497 |
+
None,
|
| 498 |
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
| 499 |
+
)
|
| 500 |
+
|
| 501 |
+
def get_labels(self) -> PaginatedList[Label]:
|
| 502 |
+
"""
|
| 503 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 504 |
+
"""
|
| 505 |
+
return PaginatedList(github.Label.Label, self._requester, f"{self.url}/labels", None)
|
| 506 |
+
|
| 507 |
+
def remove_from_assignees(self, *assignees: NamedUser | str) -> None:
|
| 508 |
+
"""
|
| 509 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
|
| 510 |
+
"""
|
| 511 |
+
assert all(isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees), assignees
|
| 512 |
+
post_parameters = {
|
| 513 |
+
"assignees": [
|
| 514 |
+
assignee.login if isinstance(assignee, github.NamedUser.NamedUser) else assignee
|
| 515 |
+
for assignee in assignees
|
| 516 |
+
]
|
| 517 |
+
}
|
| 518 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/assignees", input=post_parameters)
|
| 519 |
+
self._useAttributes(data)
|
| 520 |
+
|
| 521 |
+
def remove_from_labels(self, label: Label | str) -> None:
|
| 522 |
+
"""
|
| 523 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{number}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 524 |
+
"""
|
| 525 |
+
assert isinstance(label, (github.Label.Label, str)), label
|
| 526 |
+
if isinstance(label, github.Label.Label):
|
| 527 |
+
label = label._identity
|
| 528 |
+
else:
|
| 529 |
+
label = urllib.parse.quote(label)
|
| 530 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/labels/{label}")
|
| 531 |
+
|
| 532 |
+
def set_labels(self, *labels: Label | str) -> None:
|
| 533 |
+
"""
|
| 534 |
+
:calls: `PUT /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 535 |
+
"""
|
| 536 |
+
assert all(isinstance(element, (github.Label.Label, str)) for element in labels), labels
|
| 537 |
+
post_parameters = [label.name if isinstance(label, github.Label.Label) else label for label in labels]
|
| 538 |
+
headers, data = self._requester.requestJsonAndCheck("PUT", f"{self.url}/labels", input=post_parameters)
|
| 539 |
+
|
| 540 |
+
def get_reactions(self) -> PaginatedList[Reaction]:
|
| 541 |
+
"""
|
| 542 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number}/reactions <https://docs.github.com/en/rest/reference/reactions#list-reactions-for-an-issue>`_
|
| 543 |
+
"""
|
| 544 |
+
return PaginatedList(
|
| 545 |
+
github.Reaction.Reaction,
|
| 546 |
+
self._requester,
|
| 547 |
+
f"{self.url}/reactions",
|
| 548 |
+
None,
|
| 549 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 550 |
+
)
|
| 551 |
+
|
| 552 |
+
def create_reaction(self, reaction_type: str) -> Reaction:
|
| 553 |
+
"""
|
| 554 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/reactions <https://docs.github.com/en/rest/reference/reactions>`_
|
| 555 |
+
"""
|
| 556 |
+
assert isinstance(reaction_type, str), reaction_type
|
| 557 |
+
post_parameters = {
|
| 558 |
+
"content": reaction_type,
|
| 559 |
+
}
|
| 560 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 561 |
+
"POST",
|
| 562 |
+
f"{self.url}/reactions",
|
| 563 |
+
input=post_parameters,
|
| 564 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 565 |
+
)
|
| 566 |
+
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
| 567 |
+
|
| 568 |
+
def delete_reaction(self, reaction_id: int) -> bool:
|
| 569 |
+
"""
|
| 570 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} <https://docs.github.com/en/rest/reference/reactions#delete-an-issue-reaction>`_
|
| 571 |
+
"""
|
| 572 |
+
assert isinstance(reaction_id, int), reaction_id
|
| 573 |
+
status, _, _ = self._requester.requestJson(
|
| 574 |
+
"DELETE",
|
| 575 |
+
f"{self.url}/reactions/{reaction_id}",
|
| 576 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 577 |
+
)
|
| 578 |
+
return status == 204
|
| 579 |
+
|
| 580 |
+
def get_timeline(self) -> PaginatedList[TimelineEvent]:
|
| 581 |
+
"""
|
| 582 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number}/timeline <https://docs.github.com/en/rest/reference/issues#list-timeline-events-for-an-issue>`_
|
| 583 |
+
"""
|
| 584 |
+
return PaginatedList(
|
| 585 |
+
github.TimelineEvent.TimelineEvent,
|
| 586 |
+
self._requester,
|
| 587 |
+
f"{self.url}/timeline",
|
| 588 |
+
None,
|
| 589 |
+
headers={"Accept": Consts.issueTimelineEventsPreview},
|
| 590 |
+
)
|
| 591 |
+
|
| 592 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 593 |
+
if "active_lock_reason" in attributes: # pragma no branch
|
| 594 |
+
self._active_lock_reason = self._makeStringAttribute(attributes["active_lock_reason"])
|
| 595 |
+
if "assignee" in attributes: # pragma no branch
|
| 596 |
+
self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
|
| 597 |
+
if "assignees" in attributes: # pragma no branch
|
| 598 |
+
self._assignees = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, attributes["assignees"])
|
| 599 |
+
elif "assignee" in attributes:
|
| 600 |
+
if attributes["assignee"] is not None:
|
| 601 |
+
self._assignees = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, [attributes["assignee"]])
|
| 602 |
+
else:
|
| 603 |
+
self._assignees = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, [])
|
| 604 |
+
if "author_association" in attributes: # pragma no branch
|
| 605 |
+
self._author_association = self._makeStringAttribute(attributes["author_association"])
|
| 606 |
+
if "body" in attributes: # pragma no branch
|
| 607 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 608 |
+
if "body_html" in attributes: # pragma no branch
|
| 609 |
+
self._body_html = self._makeStringAttribute(attributes["body_html"])
|
| 610 |
+
if "body_text" in attributes: # pragma no branch
|
| 611 |
+
self._body_text = self._makeStringAttribute(attributes["body_text"])
|
| 612 |
+
if "closed_at" in attributes: # pragma no branch
|
| 613 |
+
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
| 614 |
+
if "closed_by" in attributes: # pragma no branch
|
| 615 |
+
self._closed_by = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["closed_by"])
|
| 616 |
+
if "comments" in attributes: # pragma no branch
|
| 617 |
+
self._comments = self._makeIntAttribute(attributes["comments"])
|
| 618 |
+
if "comments_url" in attributes: # pragma no branch
|
| 619 |
+
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
| 620 |
+
if "created_at" in attributes: # pragma no branch
|
| 621 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 622 |
+
if "draft" in attributes: # pragma no branch
|
| 623 |
+
self._draft = self._makeBoolAttribute(attributes["draft"])
|
| 624 |
+
if "events_url" in attributes: # pragma no branch
|
| 625 |
+
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
| 626 |
+
if "html_url" in attributes: # pragma no branch
|
| 627 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 628 |
+
if "id" in attributes: # pragma no branch
|
| 629 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 630 |
+
if "labels" in attributes: # pragma no branch
|
| 631 |
+
self._labels = self._makeListOfClassesAttribute(github.Label.Label, attributes["labels"])
|
| 632 |
+
if "labels_url" in attributes: # pragma no branch
|
| 633 |
+
self._labels_url = self._makeStringAttribute(attributes["labels_url"])
|
| 634 |
+
if "locked" in attributes: # pragma no branch
|
| 635 |
+
self._locked = self._makeBoolAttribute(attributes["locked"])
|
| 636 |
+
if "milestone" in attributes: # pragma no branch
|
| 637 |
+
self._milestone = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
|
| 638 |
+
if "node_id" in attributes: # pragma no branch
|
| 639 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 640 |
+
if "number" in attributes: # pragma no branch
|
| 641 |
+
self._number = self._makeIntAttribute(attributes["number"])
|
| 642 |
+
if "performed_via_github_app" in attributes: # pragma no branch
|
| 643 |
+
self._performed_via_github_app = self._makeClassAttribute(
|
| 644 |
+
github.GithubApp.GithubApp, attributes["performed_via_github_app"]
|
| 645 |
+
)
|
| 646 |
+
if "pull_request" in attributes: # pragma no branch
|
| 647 |
+
self._pull_request = self._makeClassAttribute(
|
| 648 |
+
github.IssuePullRequest.IssuePullRequest, attributes["pull_request"]
|
| 649 |
+
)
|
| 650 |
+
if "reactions" in attributes:
|
| 651 |
+
self._reactions = self._makeDictAttribute(attributes["reactions"])
|
| 652 |
+
if "repository" in attributes: # pragma no branch
|
| 653 |
+
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
|
| 654 |
+
if "repository_url" in attributes: # pragma no branch
|
| 655 |
+
self._repository_url = self._makeStringAttribute(attributes["repository_url"])
|
| 656 |
+
if "score" in attributes: # pragma no branch
|
| 657 |
+
self._score = self._makeFloatAttribute(attributes["score"])
|
| 658 |
+
if "state" in attributes: # pragma no branch
|
| 659 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 660 |
+
if "state_reason" in attributes: # pragma no branch
|
| 661 |
+
self._state_reason = self._makeStringAttribute(attributes["state_reason"])
|
| 662 |
+
if "text_matches" in attributes: # pragma no branch
|
| 663 |
+
self._text_matches = self._makeDictAttribute(attributes["text_matches"])
|
| 664 |
+
if "timeline_url" in attributes: # pragma no branch
|
| 665 |
+
self._timeline_url = self._makeStringAttribute(attributes["timeline_url"])
|
| 666 |
+
if "title" in attributes: # pragma no branch
|
| 667 |
+
self._title = self._makeStringAttribute(attributes["title"])
|
| 668 |
+
if "updated_at" in attributes: # pragma no branch
|
| 669 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 670 |
+
if "url" in attributes: # pragma no branch
|
| 671 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 672 |
+
if "user" in attributes: # pragma no branch
|
| 673 |
+
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
python_embeded/Lib/site-packages/github/IssueComment.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
| 14 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 17 |
+
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
| 18 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 20 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 21 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 22 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2023 Malik Shahzad Muzaffar <shahzad.malik.muzaffar@cern.ch> #
|
| 24 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 25 |
+
# Copyright 2024 Arash Kadkhodaei <arash77.kad@gmail.com> #
|
| 26 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 27 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 28 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 29 |
+
# #
|
| 30 |
+
# This file is part of PyGithub. #
|
| 31 |
+
# http://pygithub.readthedocs.io/ #
|
| 32 |
+
# #
|
| 33 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 34 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 35 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 36 |
+
# any later version. #
|
| 37 |
+
# #
|
| 38 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 39 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 40 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 41 |
+
# details. #
|
| 42 |
+
# #
|
| 43 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 44 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 45 |
+
# #
|
| 46 |
+
################################################################################
|
| 47 |
+
|
| 48 |
+
from __future__ import annotations
|
| 49 |
+
|
| 50 |
+
from datetime import datetime
|
| 51 |
+
from typing import TYPE_CHECKING, Any
|
| 52 |
+
|
| 53 |
+
import github.GithubApp
|
| 54 |
+
import github.GithubObject
|
| 55 |
+
import github.NamedUser
|
| 56 |
+
from github import Consts
|
| 57 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 58 |
+
from github.PaginatedList import PaginatedList
|
| 59 |
+
|
| 60 |
+
if TYPE_CHECKING:
|
| 61 |
+
from github.GithubApp import GithubApp
|
| 62 |
+
from github.NamedUser import NamedUser
|
| 63 |
+
from github.Reaction import Reaction
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class IssueComment(CompletableGithubObject):
|
| 67 |
+
"""
|
| 68 |
+
This class represents IssueComments.
|
| 69 |
+
|
| 70 |
+
The reference can be found here
|
| 71 |
+
https://docs.github.com/en/rest/reference/issues#comments
|
| 72 |
+
|
| 73 |
+
The OpenAPI schema can be found at
|
| 74 |
+
- /components/schemas/issue-comment
|
| 75 |
+
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
def _initAttributes(self) -> None:
|
| 79 |
+
self._author_association: Attribute[str] = NotSet
|
| 80 |
+
self._body: Attribute[str] = NotSet
|
| 81 |
+
self._body_html: Attribute[str] = NotSet
|
| 82 |
+
self._body_text: Attribute[str] = NotSet
|
| 83 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 84 |
+
self._html_url: Attribute[str] = NotSet
|
| 85 |
+
self._id: Attribute[int] = NotSet
|
| 86 |
+
self._issue_url: Attribute[str] = NotSet
|
| 87 |
+
self._node_id: Attribute[str] = NotSet
|
| 88 |
+
self._performed_via_github_app: Attribute[GithubApp] = NotSet
|
| 89 |
+
self._reactions: Attribute[dict] = NotSet
|
| 90 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 91 |
+
self._url: Attribute[str] = NotSet
|
| 92 |
+
self._user: Attribute[NamedUser] = NotSet
|
| 93 |
+
|
| 94 |
+
def __repr__(self) -> str:
|
| 95 |
+
return self.get__repr__({"id": self._id.value, "user": self._user.value})
|
| 96 |
+
|
| 97 |
+
@property
|
| 98 |
+
def author_association(self) -> str:
|
| 99 |
+
self._completeIfNotSet(self._author_association)
|
| 100 |
+
return self._author_association.value
|
| 101 |
+
|
| 102 |
+
@property
|
| 103 |
+
def body(self) -> str:
|
| 104 |
+
self._completeIfNotSet(self._body)
|
| 105 |
+
return self._body.value
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def body_html(self) -> str:
|
| 109 |
+
self._completeIfNotSet(self._body_html)
|
| 110 |
+
return self._body_html.value
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def body_text(self) -> str:
|
| 114 |
+
self._completeIfNotSet(self._body_text)
|
| 115 |
+
return self._body_text.value
|
| 116 |
+
|
| 117 |
+
@property
|
| 118 |
+
def created_at(self) -> datetime:
|
| 119 |
+
self._completeIfNotSet(self._created_at)
|
| 120 |
+
return self._created_at.value
|
| 121 |
+
|
| 122 |
+
@property
|
| 123 |
+
def html_url(self) -> str:
|
| 124 |
+
self._completeIfNotSet(self._html_url)
|
| 125 |
+
return self._html_url.value
|
| 126 |
+
|
| 127 |
+
@property
|
| 128 |
+
def id(self) -> int:
|
| 129 |
+
self._completeIfNotSet(self._id)
|
| 130 |
+
return self._id.value
|
| 131 |
+
|
| 132 |
+
@property
|
| 133 |
+
def issue_url(self) -> str:
|
| 134 |
+
self._completeIfNotSet(self._issue_url)
|
| 135 |
+
return self._issue_url.value
|
| 136 |
+
|
| 137 |
+
@property
|
| 138 |
+
def node_id(self) -> str:
|
| 139 |
+
self._completeIfNotSet(self._node_id)
|
| 140 |
+
return self._node_id.value
|
| 141 |
+
|
| 142 |
+
@property
|
| 143 |
+
def performed_via_github_app(self) -> GithubApp:
|
| 144 |
+
self._completeIfNotSet(self._performed_via_github_app)
|
| 145 |
+
return self._performed_via_github_app.value
|
| 146 |
+
|
| 147 |
+
@property
|
| 148 |
+
def reactions(self) -> dict:
|
| 149 |
+
self._completeIfNotSet(self._reactions)
|
| 150 |
+
return self._reactions.value
|
| 151 |
+
|
| 152 |
+
@property
|
| 153 |
+
def updated_at(self) -> datetime:
|
| 154 |
+
self._completeIfNotSet(self._updated_at)
|
| 155 |
+
return self._updated_at.value
|
| 156 |
+
|
| 157 |
+
@property
|
| 158 |
+
def url(self) -> str:
|
| 159 |
+
self._completeIfNotSet(self._url)
|
| 160 |
+
return self._url.value
|
| 161 |
+
|
| 162 |
+
@property
|
| 163 |
+
def user(self) -> NamedUser:
|
| 164 |
+
self._completeIfNotSet(self._user)
|
| 165 |
+
return self._user.value
|
| 166 |
+
|
| 167 |
+
def delete(self) -> None:
|
| 168 |
+
"""
|
| 169 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 170 |
+
"""
|
| 171 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
|
| 172 |
+
|
| 173 |
+
def edit(self, body: str) -> None:
|
| 174 |
+
"""
|
| 175 |
+
:calls: `PATCH /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 176 |
+
"""
|
| 177 |
+
assert isinstance(body, str), body
|
| 178 |
+
post_parameters = {
|
| 179 |
+
"body": body,
|
| 180 |
+
}
|
| 181 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 182 |
+
self._useAttributes(data)
|
| 183 |
+
|
| 184 |
+
def get_reactions(self) -> PaginatedList[Reaction]:
|
| 185 |
+
"""
|
| 186 |
+
:calls: `GET /repos/{owner}/{repo}/issues/comments/{id}/reactions
|
| 187 |
+
<https://docs.github.com/en/rest/reference/reactions#list-reactions-for-an-issue-comment>`_
|
| 188 |
+
"""
|
| 189 |
+
return PaginatedList(
|
| 190 |
+
github.Reaction.Reaction,
|
| 191 |
+
self._requester,
|
| 192 |
+
f"{self.url}/reactions",
|
| 193 |
+
None,
|
| 194 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
def create_reaction(self, reaction_type: str) -> Reaction:
|
| 198 |
+
"""
|
| 199 |
+
:calls: `POST /repos/{owner}/{repo}/issues/comments/{id}/reactions
|
| 200 |
+
<https://docs.github.com/en/rest/reference/reactions#create-reaction-for-an-issue-comment>`_
|
| 201 |
+
"""
|
| 202 |
+
assert isinstance(reaction_type, str), reaction_type
|
| 203 |
+
post_parameters = {
|
| 204 |
+
"content": reaction_type,
|
| 205 |
+
}
|
| 206 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 207 |
+
"POST",
|
| 208 |
+
f"{self.url}/reactions",
|
| 209 |
+
input=post_parameters,
|
| 210 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 211 |
+
)
|
| 212 |
+
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
| 213 |
+
|
| 214 |
+
def delete_reaction(self, reaction_id: int) -> bool:
|
| 215 |
+
"""
|
| 216 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
|
| 217 |
+
<https://docs.github.com/en/rest/reference/reactions#delete-an-issue-comment-reaction>`_
|
| 218 |
+
"""
|
| 219 |
+
assert isinstance(reaction_id, int), reaction_id
|
| 220 |
+
status, _, _ = self._requester.requestJson(
|
| 221 |
+
"DELETE",
|
| 222 |
+
f"{self.url}/reactions/{reaction_id}",
|
| 223 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 224 |
+
)
|
| 225 |
+
return status == 204
|
| 226 |
+
|
| 227 |
+
def minimize(self, reason: str = "OUTDATED") -> bool:
|
| 228 |
+
"""
|
| 229 |
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to minimize comment
|
| 230 |
+
<https://docs.github.com/en/graphql/reference/mutations#minimizecomment>
|
| 231 |
+
"""
|
| 232 |
+
assert isinstance(reason, str), reason
|
| 233 |
+
variables = {
|
| 234 |
+
"subjectId": self.node_id,
|
| 235 |
+
"classifier": reason,
|
| 236 |
+
}
|
| 237 |
+
_, data = self._requester.graphql_named_mutation(
|
| 238 |
+
mutation_name="minimizeComment",
|
| 239 |
+
mutation_input=NotSet.remove_unset_items(variables),
|
| 240 |
+
output_schema="minimizedComment { isMinimized }",
|
| 241 |
+
)
|
| 242 |
+
return data["minimizedComment"]["isMinimized"] is True
|
| 243 |
+
|
| 244 |
+
def unminimize(self) -> bool:
|
| 245 |
+
"""
|
| 246 |
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to unminimize comment
|
| 247 |
+
<https://docs.github.com/en/graphql/reference/mutations#unminimizecomment>
|
| 248 |
+
"""
|
| 249 |
+
variables = {
|
| 250 |
+
"subjectId": self.node_id,
|
| 251 |
+
}
|
| 252 |
+
_, data = self._requester.graphql_named_mutation(
|
| 253 |
+
mutation_name="unminimizeComment",
|
| 254 |
+
mutation_input=NotSet.remove_unset_items(variables),
|
| 255 |
+
output_schema="unminimizedComment { isMinimized }",
|
| 256 |
+
)
|
| 257 |
+
return data["unminimizedComment"]["isMinimized"] is False
|
| 258 |
+
|
| 259 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 260 |
+
if "author_association" in attributes: # pragma no branch
|
| 261 |
+
self._author_association = self._makeStringAttribute(attributes["author_association"])
|
| 262 |
+
if "body" in attributes: # pragma no branch
|
| 263 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 264 |
+
if "body_html" in attributes: # pragma no branch
|
| 265 |
+
self._body_html = self._makeStringAttribute(attributes["body_html"])
|
| 266 |
+
if "body_text" in attributes: # pragma no branch
|
| 267 |
+
self._body_text = self._makeStringAttribute(attributes["body_text"])
|
| 268 |
+
if "created_at" in attributes: # pragma no branch
|
| 269 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 270 |
+
if "html_url" in attributes: # pragma no branch
|
| 271 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 272 |
+
if "id" in attributes: # pragma no branch
|
| 273 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 274 |
+
if "issue_url" in attributes: # pragma no branch
|
| 275 |
+
self._issue_url = self._makeStringAttribute(attributes["issue_url"])
|
| 276 |
+
if "node_id" in attributes: # pragma no branch
|
| 277 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 278 |
+
if "performed_via_github_app" in attributes: # pragma no branch
|
| 279 |
+
self._performed_via_github_app = self._makeClassAttribute(
|
| 280 |
+
github.GithubApp.GithubApp, attributes["performed_via_github_app"]
|
| 281 |
+
)
|
| 282 |
+
if "reactions" in attributes:
|
| 283 |
+
self._reactions = self._makeDictAttribute(attributes["reactions"])
|
| 284 |
+
if "updated_at" in attributes: # pragma no branch
|
| 285 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 286 |
+
if "url" in attributes: # pragma no branch
|
| 287 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 288 |
+
if "user" in attributes: # pragma no branch
|
| 289 |
+
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
python_embeded/Lib/site-packages/github/IssueEvent.py
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 11 |
+
# Copyright 2018 Aaron L. Levine <allevin@sandia.gov> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 16 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 21 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 22 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# #
|
| 25 |
+
# This file is part of PyGithub. #
|
| 26 |
+
# http://pygithub.readthedocs.io/ #
|
| 27 |
+
# #
|
| 28 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 29 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 30 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 31 |
+
# any later version. #
|
| 32 |
+
# #
|
| 33 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 34 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 35 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 36 |
+
# details. #
|
| 37 |
+
# #
|
| 38 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 39 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 40 |
+
# #
|
| 41 |
+
################################################################################
|
| 42 |
+
|
| 43 |
+
from __future__ import annotations
|
| 44 |
+
|
| 45 |
+
from datetime import datetime
|
| 46 |
+
from typing import TYPE_CHECKING, Any
|
| 47 |
+
|
| 48 |
+
import github.GithubApp
|
| 49 |
+
import github.GithubObject
|
| 50 |
+
import github.Issue
|
| 51 |
+
import github.Label
|
| 52 |
+
import github.Milestone
|
| 53 |
+
import github.NamedUser
|
| 54 |
+
import github.Team
|
| 55 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 56 |
+
|
| 57 |
+
if TYPE_CHECKING:
|
| 58 |
+
from github.GithubApp import GithubApp
|
| 59 |
+
from github.Issue import Issue
|
| 60 |
+
from github.Label import Label
|
| 61 |
+
from github.Milestone import Milestone
|
| 62 |
+
from github.NamedUser import NamedUser
|
| 63 |
+
from github.Team import Team
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class IssueEvent(CompletableGithubObject):
|
| 67 |
+
"""
|
| 68 |
+
This class represents IssueEvents.
|
| 69 |
+
|
| 70 |
+
The reference can be found here
|
| 71 |
+
https://docs.github.com/en/rest/reference/issues#events
|
| 72 |
+
|
| 73 |
+
The OpenAPI schema can be found at
|
| 74 |
+
- /components/schemas/issue-event
|
| 75 |
+
- /components/schemas/issue-event-for-issue
|
| 76 |
+
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
def _initAttributes(self) -> None:
|
| 80 |
+
self._actor: Attribute[NamedUser] = NotSet
|
| 81 |
+
self._assignee: Attribute[NamedUser] = NotSet
|
| 82 |
+
self._assigner: Attribute[NamedUser] = NotSet
|
| 83 |
+
self._author_association: Attribute[dict[str, Any]] = NotSet
|
| 84 |
+
self._commit_id: Attribute[str] = NotSet
|
| 85 |
+
self._commit_url: Attribute[str] = NotSet
|
| 86 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 87 |
+
self._dismissed_review: Attribute[dict] = NotSet
|
| 88 |
+
self._event: Attribute[str] = NotSet
|
| 89 |
+
self._id: Attribute[int] = NotSet
|
| 90 |
+
self._issue: Attribute[Issue] = NotSet
|
| 91 |
+
self._label: Attribute[Label] = NotSet
|
| 92 |
+
self._lock_reason: Attribute[str] = NotSet
|
| 93 |
+
self._milestone: Attribute[Milestone] = NotSet
|
| 94 |
+
self._node_id: Attribute[str] = NotSet
|
| 95 |
+
self._performed_via_github_app: Attribute[GithubApp] = NotSet
|
| 96 |
+
self._project_card: Attribute[dict[str, Any]] = NotSet
|
| 97 |
+
self._rename: Attribute[dict] = NotSet
|
| 98 |
+
self._requested_reviewer: Attribute[NamedUser] = NotSet
|
| 99 |
+
self._requested_team: Attribute[Team] = NotSet
|
| 100 |
+
self._review_requester: Attribute[NamedUser] = NotSet
|
| 101 |
+
self._url: Attribute[str] = NotSet
|
| 102 |
+
|
| 103 |
+
def __repr__(self) -> str:
|
| 104 |
+
return self.get__repr__({"id": self._id.value})
|
| 105 |
+
|
| 106 |
+
@property
|
| 107 |
+
def actor(self) -> NamedUser:
|
| 108 |
+
self._completeIfNotSet(self._actor)
|
| 109 |
+
return self._actor.value
|
| 110 |
+
|
| 111 |
+
@property
|
| 112 |
+
def assignee(self) -> NamedUser:
|
| 113 |
+
self._completeIfNotSet(self._assignee)
|
| 114 |
+
return self._assignee.value
|
| 115 |
+
|
| 116 |
+
@property
|
| 117 |
+
def assigner(self) -> NamedUser:
|
| 118 |
+
self._completeIfNotSet(self._assigner)
|
| 119 |
+
return self._assigner.value
|
| 120 |
+
|
| 121 |
+
@property
|
| 122 |
+
def author_association(self) -> dict[str, Any]:
|
| 123 |
+
self._completeIfNotSet(self._author_association)
|
| 124 |
+
return self._author_association.value
|
| 125 |
+
|
| 126 |
+
@property
|
| 127 |
+
def commit_id(self) -> str:
|
| 128 |
+
self._completeIfNotSet(self._commit_id)
|
| 129 |
+
return self._commit_id.value
|
| 130 |
+
|
| 131 |
+
@property
|
| 132 |
+
def commit_url(self) -> str:
|
| 133 |
+
self._completeIfNotSet(self._commit_url)
|
| 134 |
+
return self._commit_url.value
|
| 135 |
+
|
| 136 |
+
@property
|
| 137 |
+
def created_at(self) -> datetime:
|
| 138 |
+
self._completeIfNotSet(self._created_at)
|
| 139 |
+
return self._created_at.value
|
| 140 |
+
|
| 141 |
+
@property
|
| 142 |
+
def dismissed_review(self) -> dict:
|
| 143 |
+
self._completeIfNotSet(self._dismissed_review)
|
| 144 |
+
return self._dismissed_review.value
|
| 145 |
+
|
| 146 |
+
@property
|
| 147 |
+
def event(self) -> str:
|
| 148 |
+
self._completeIfNotSet(self._event)
|
| 149 |
+
return self._event.value
|
| 150 |
+
|
| 151 |
+
@property
|
| 152 |
+
def id(self) -> int:
|
| 153 |
+
self._completeIfNotSet(self._id)
|
| 154 |
+
return self._id.value
|
| 155 |
+
|
| 156 |
+
@property
|
| 157 |
+
def issue(self) -> Issue:
|
| 158 |
+
self._completeIfNotSet(self._issue)
|
| 159 |
+
return self._issue.value
|
| 160 |
+
|
| 161 |
+
@property
|
| 162 |
+
def label(self) -> Label:
|
| 163 |
+
self._completeIfNotSet(self._label)
|
| 164 |
+
return self._label.value
|
| 165 |
+
|
| 166 |
+
@property
|
| 167 |
+
def lock_reason(self) -> str:
|
| 168 |
+
self._completeIfNotSet(self._lock_reason)
|
| 169 |
+
return self._lock_reason.value
|
| 170 |
+
|
| 171 |
+
@property
|
| 172 |
+
def milestone(self) -> Milestone:
|
| 173 |
+
self._completeIfNotSet(self._milestone)
|
| 174 |
+
return self._milestone.value
|
| 175 |
+
|
| 176 |
+
@property
|
| 177 |
+
def node_id(self) -> str:
|
| 178 |
+
self._completeIfNotSet(self._node_id)
|
| 179 |
+
return self._node_id.value
|
| 180 |
+
|
| 181 |
+
@property
|
| 182 |
+
def performed_via_github_app(self) -> GithubApp:
|
| 183 |
+
self._completeIfNotSet(self._performed_via_github_app)
|
| 184 |
+
return self._performed_via_github_app.value
|
| 185 |
+
|
| 186 |
+
@property
|
| 187 |
+
def project_card(self) -> dict[str, Any]:
|
| 188 |
+
self._completeIfNotSet(self._project_card)
|
| 189 |
+
return self._project_card.value
|
| 190 |
+
|
| 191 |
+
@property
|
| 192 |
+
def rename(self) -> dict:
|
| 193 |
+
self._completeIfNotSet(self._rename)
|
| 194 |
+
return self._rename.value
|
| 195 |
+
|
| 196 |
+
@property
|
| 197 |
+
def requested_reviewer(self) -> NamedUser:
|
| 198 |
+
self._completeIfNotSet(self._requested_reviewer)
|
| 199 |
+
return self._requested_reviewer.value
|
| 200 |
+
|
| 201 |
+
@property
|
| 202 |
+
def requested_team(self) -> Team:
|
| 203 |
+
self._completeIfNotSet(self._requested_team)
|
| 204 |
+
return self._requested_team.value
|
| 205 |
+
|
| 206 |
+
@property
|
| 207 |
+
def review_requester(self) -> NamedUser:
|
| 208 |
+
self._completeIfNotSet(self._review_requester)
|
| 209 |
+
return self._review_requester.value
|
| 210 |
+
|
| 211 |
+
@property
|
| 212 |
+
def url(self) -> str:
|
| 213 |
+
self._completeIfNotSet(self._url)
|
| 214 |
+
return self._url.value
|
| 215 |
+
|
| 216 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 217 |
+
if "actor" in attributes: # pragma no branch
|
| 218 |
+
self._actor = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"])
|
| 219 |
+
if "assignee" in attributes: # pragma no branch
|
| 220 |
+
self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
|
| 221 |
+
if "assigner" in attributes: # pragma no branch
|
| 222 |
+
self._assigner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assigner"])
|
| 223 |
+
if "author_association" in attributes: # pragma no branch
|
| 224 |
+
self._author_association = self._makeDictAttribute(attributes["author_association"])
|
| 225 |
+
if "commit_id" in attributes: # pragma no branch
|
| 226 |
+
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
|
| 227 |
+
if "commit_url" in attributes: # pragma no branch
|
| 228 |
+
self._commit_url = self._makeStringAttribute(attributes["commit_url"])
|
| 229 |
+
if "created_at" in attributes: # pragma no branch
|
| 230 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 231 |
+
if "dismissed_review" in attributes: # pragma no branch
|
| 232 |
+
self._dismissed_review = self._makeDictAttribute(attributes["dismissed_review"])
|
| 233 |
+
if "event" in attributes: # pragma no branch
|
| 234 |
+
self._event = self._makeStringAttribute(attributes["event"])
|
| 235 |
+
if "id" in attributes: # pragma no branch
|
| 236 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 237 |
+
if "issue" in attributes: # pragma no branch
|
| 238 |
+
self._issue = self._makeClassAttribute(github.Issue.Issue, attributes["issue"])
|
| 239 |
+
if "label" in attributes: # pragma no branch
|
| 240 |
+
self._label = self._makeClassAttribute(github.Label.Label, attributes["label"])
|
| 241 |
+
if "lock_reason" in attributes: # pragma no branch
|
| 242 |
+
self._lock_reason = self._makeStringAttribute(attributes["lock_reason"])
|
| 243 |
+
if "milestone" in attributes: # pragma no branch
|
| 244 |
+
self._milestone = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
|
| 245 |
+
if "node_id" in attributes: # pragma no branch
|
| 246 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 247 |
+
if "performed_via_github_app" in attributes: # pragma no branch
|
| 248 |
+
self._performed_via_github_app = self._makeClassAttribute(
|
| 249 |
+
github.GithubApp.GithubApp, attributes["performed_via_github_app"]
|
| 250 |
+
)
|
| 251 |
+
if "project_card" in attributes: # pragma no branch
|
| 252 |
+
self._project_card = self._makeDictAttribute(attributes["project_card"])
|
| 253 |
+
if "rename" in attributes: # pragma no branch
|
| 254 |
+
self._rename = self._makeDictAttribute(attributes["rename"])
|
| 255 |
+
if "requested_reviewer" in attributes: # pragma no branch
|
| 256 |
+
self._requested_reviewer = self._makeClassAttribute(
|
| 257 |
+
github.NamedUser.NamedUser, attributes["requested_reviewer"]
|
| 258 |
+
)
|
| 259 |
+
if "requested_team" in attributes: # pragma no branch
|
| 260 |
+
self._requested_team = self._makeClassAttribute(github.Team.Team, attributes["requested_team"])
|
| 261 |
+
if "review_requester" in attributes: # pragma no branch
|
| 262 |
+
self._review_requester = self._makeClassAttribute(
|
| 263 |
+
github.NamedUser.NamedUser, attributes["review_requester"]
|
| 264 |
+
)
|
| 265 |
+
if "url" in attributes: # pragma no branch
|
| 266 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/IssuePullRequest.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 9 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 10 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 12 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 15 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 16 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 17 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 18 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# #
|
| 20 |
+
# This file is part of PyGithub. #
|
| 21 |
+
# http://pygithub.readthedocs.io/ #
|
| 22 |
+
# #
|
| 23 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 24 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 25 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 26 |
+
# any later version. #
|
| 27 |
+
# #
|
| 28 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 29 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 30 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 31 |
+
# details. #
|
| 32 |
+
# #
|
| 33 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 34 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 35 |
+
# #
|
| 36 |
+
################################################################################
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
from __future__ import annotations
|
| 40 |
+
|
| 41 |
+
from datetime import datetime
|
| 42 |
+
from typing import Any
|
| 43 |
+
|
| 44 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class IssuePullRequest(NonCompletableGithubObject):
|
| 48 |
+
"""
|
| 49 |
+
This class represents IssuePullRequests.
|
| 50 |
+
|
| 51 |
+
The OpenAPI schema can be found at
|
| 52 |
+
- /components/schemas/issue-search-result-item/properties/pull_request
|
| 53 |
+
- /components/schemas/issue/properties/pull_request
|
| 54 |
+
- /components/schemas/nullable-issue/properties/pull_request
|
| 55 |
+
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
def _initAttributes(self) -> None:
|
| 59 |
+
self._diff_url: Attribute[str] = NotSet
|
| 60 |
+
self._html_url: Attribute[str] = NotSet
|
| 61 |
+
self._merged_at: Attribute[datetime] = NotSet
|
| 62 |
+
self._patch_url: Attribute[str] = NotSet
|
| 63 |
+
self._url: Attribute[str] = NotSet
|
| 64 |
+
|
| 65 |
+
@property
|
| 66 |
+
def diff_url(self) -> str:
|
| 67 |
+
return self._diff_url.value
|
| 68 |
+
|
| 69 |
+
@property
|
| 70 |
+
def html_url(self) -> str:
|
| 71 |
+
return self._html_url.value
|
| 72 |
+
|
| 73 |
+
@property
|
| 74 |
+
def merged_at(self) -> datetime:
|
| 75 |
+
return self._merged_at.value
|
| 76 |
+
|
| 77 |
+
@property
|
| 78 |
+
def patch_url(self) -> str:
|
| 79 |
+
return self._patch_url.value
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def url(self) -> str:
|
| 83 |
+
return self._url.value
|
| 84 |
+
|
| 85 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 86 |
+
if "diff_url" in attributes: # pragma no branch
|
| 87 |
+
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
| 88 |
+
if "html_url" in attributes: # pragma no branch
|
| 89 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 90 |
+
if "merged_at" in attributes: # pragma no branch
|
| 91 |
+
self._merged_at = self._makeDatetimeAttribute(attributes["merged_at"])
|
| 92 |
+
if "patch_url" in attributes: # pragma no branch
|
| 93 |
+
self._patch_url = self._makeStringAttribute(attributes["patch_url"])
|
| 94 |
+
if "url" in attributes: # pragma no branch
|
| 95 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/Label.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 8 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2018 Mateusz Loskot <mateusz@loskot.net> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 16 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 18 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 20 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 21 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 22 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 24 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 25 |
+
# #
|
| 26 |
+
# This file is part of PyGithub. #
|
| 27 |
+
# http://pygithub.readthedocs.io/ #
|
| 28 |
+
# #
|
| 29 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 30 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 31 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 32 |
+
# any later version. #
|
| 33 |
+
# #
|
| 34 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 35 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 36 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 37 |
+
# details. #
|
| 38 |
+
# #
|
| 39 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 40 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 41 |
+
# #
|
| 42 |
+
################################################################################
|
| 43 |
+
|
| 44 |
+
from __future__ import annotations
|
| 45 |
+
|
| 46 |
+
import urllib.parse
|
| 47 |
+
from typing import Any
|
| 48 |
+
|
| 49 |
+
from github import Consts
|
| 50 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt, is_optional
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class Label(CompletableGithubObject):
|
| 54 |
+
"""
|
| 55 |
+
This class represents Labels.
|
| 56 |
+
|
| 57 |
+
The reference can be found here
|
| 58 |
+
https://docs.github.com/en/rest/reference/issues#labels
|
| 59 |
+
|
| 60 |
+
The OpenAPI schema can be found at
|
| 61 |
+
- /components/schemas/issue-event-label
|
| 62 |
+
- /components/schemas/issue-search-result-item/properties/labels/items
|
| 63 |
+
- /components/schemas/issue/properties/labels/items/oneOf/1
|
| 64 |
+
- /components/schemas/label
|
| 65 |
+
- /components/schemas/nullable-issue/properties/labels/items/oneOf/1
|
| 66 |
+
- /components/schemas/pull-request-simple/properties/labels/items
|
| 67 |
+
- /components/schemas/pull-request/properties/labels/items
|
| 68 |
+
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
def _initAttributes(self) -> None:
|
| 72 |
+
self._color: Attribute[str] = NotSet
|
| 73 |
+
self._default: Attribute[bool] = NotSet
|
| 74 |
+
self._description: Attribute[str] = NotSet
|
| 75 |
+
self._id: Attribute[int] = NotSet
|
| 76 |
+
self._name: Attribute[str] = NotSet
|
| 77 |
+
self._node_id: Attribute[str] = NotSet
|
| 78 |
+
self._url: Attribute[str] = NotSet
|
| 79 |
+
|
| 80 |
+
def __repr__(self) -> str:
|
| 81 |
+
return self.get__repr__({"name": self._name.value})
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def _identity(self) -> str:
|
| 85 |
+
return urllib.parse.quote(self.name)
|
| 86 |
+
|
| 87 |
+
@property
|
| 88 |
+
def color(self) -> str:
|
| 89 |
+
self._completeIfNotSet(self._color)
|
| 90 |
+
return self._color.value
|
| 91 |
+
|
| 92 |
+
@property
|
| 93 |
+
def default(self) -> bool:
|
| 94 |
+
self._completeIfNotSet(self._default)
|
| 95 |
+
return self._default.value
|
| 96 |
+
|
| 97 |
+
@property
|
| 98 |
+
def description(self) -> str:
|
| 99 |
+
self._completeIfNotSet(self._description)
|
| 100 |
+
return self._description.value
|
| 101 |
+
|
| 102 |
+
@property
|
| 103 |
+
def id(self) -> int:
|
| 104 |
+
self._completeIfNotSet(self._id)
|
| 105 |
+
return self._id.value
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def name(self) -> str:
|
| 109 |
+
self._completeIfNotSet(self._name)
|
| 110 |
+
return self._name.value
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def node_id(self) -> str:
|
| 114 |
+
self._completeIfNotSet(self._node_id)
|
| 115 |
+
return self._node_id.value
|
| 116 |
+
|
| 117 |
+
@property
|
| 118 |
+
def url(self) -> str:
|
| 119 |
+
self._completeIfNotSet(self._url)
|
| 120 |
+
return self._url.value
|
| 121 |
+
|
| 122 |
+
def delete(self) -> None:
|
| 123 |
+
"""
|
| 124 |
+
:calls: `DELETE /repos/{owner}/{repo}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 125 |
+
"""
|
| 126 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
|
| 127 |
+
|
| 128 |
+
def edit(self, name: str, color: str, description: Opt[str] = NotSet) -> None:
|
| 129 |
+
"""
|
| 130 |
+
:calls: `PATCH /repos/{owner}/{repo}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 131 |
+
"""
|
| 132 |
+
assert isinstance(name, str), name
|
| 133 |
+
assert isinstance(color, str), color
|
| 134 |
+
assert is_optional(description, str), description
|
| 135 |
+
post_parameters = NotSet.remove_unset_items({"new_name": name, "color": color, "description": description})
|
| 136 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 137 |
+
"PATCH",
|
| 138 |
+
self.url,
|
| 139 |
+
input=post_parameters,
|
| 140 |
+
headers={"Accept": Consts.mediaTypeLabelDescriptionSearchPreview},
|
| 141 |
+
)
|
| 142 |
+
self._useAttributes(data)
|
| 143 |
+
|
| 144 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 145 |
+
if "color" in attributes: # pragma no branch
|
| 146 |
+
self._color = self._makeStringAttribute(attributes["color"])
|
| 147 |
+
if "default" in attributes: # pragma no branch
|
| 148 |
+
self._default = self._makeBoolAttribute(attributes["default"])
|
| 149 |
+
if "description" in attributes: # pragma no branch
|
| 150 |
+
self._description = self._makeStringAttribute(attributes["description"])
|
| 151 |
+
if "id" in attributes: # pragma no branch
|
| 152 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 153 |
+
if "name" in attributes: # pragma no branch
|
| 154 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 155 |
+
if "node_id" in attributes: # pragma no branch
|
| 156 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 157 |
+
if "url" in attributes: # pragma no branch
|
| 158 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/License.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Aaron Levine <allevin@sandia.gov> #
|
| 11 |
+
# Copyright 2017 Mike Miller <github@mikeage.net> #
|
| 12 |
+
# Copyright 2018 Darragh Bailey <daragh.bailey@gmail.com> #
|
| 13 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2019 Adam Baratz <adam.baratz@gmail.com> #
|
| 16 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 18 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 20 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 23 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 25 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# #
|
| 27 |
+
# This file is part of PyGithub. #
|
| 28 |
+
# http://pygithub.readthedocs.io/ #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 31 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 32 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 33 |
+
# any later version. #
|
| 34 |
+
# #
|
| 35 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 36 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 37 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 38 |
+
# details. #
|
| 39 |
+
# #
|
| 40 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 41 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 42 |
+
# #
|
| 43 |
+
################################################################################
|
| 44 |
+
|
| 45 |
+
from __future__ import annotations
|
| 46 |
+
|
| 47 |
+
from typing import Any
|
| 48 |
+
|
| 49 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class License(CompletableGithubObject):
|
| 53 |
+
"""
|
| 54 |
+
This class represents Licenses.
|
| 55 |
+
|
| 56 |
+
The reference can be found here
|
| 57 |
+
https://docs.github.com/en/rest/reference/licenses
|
| 58 |
+
|
| 59 |
+
The OpenAPI schema can be found at
|
| 60 |
+
- /components/schemas/license-simple
|
| 61 |
+
- /components/schemas/minimal-repository/properties/license
|
| 62 |
+
- /components/schemas/nullable-license-simple
|
| 63 |
+
|
| 64 |
+
"""
|
| 65 |
+
|
| 66 |
+
def _initAttributes(self) -> None:
|
| 67 |
+
self._body: Attribute[str] = NotSet
|
| 68 |
+
self._conditions: Attribute[list[str]] = NotSet
|
| 69 |
+
self._description: Attribute[str] = NotSet
|
| 70 |
+
self._html_url: Attribute[str] = NotSet
|
| 71 |
+
self._implementation: Attribute[str] = NotSet
|
| 72 |
+
self._key: Attribute[str] = NotSet
|
| 73 |
+
self._limitations: Attribute[list[str]] = NotSet
|
| 74 |
+
self._name: Attribute[str] = NotSet
|
| 75 |
+
self._node_id: Attribute[str] = NotSet
|
| 76 |
+
self._permissions: Attribute[list[str]] = NotSet
|
| 77 |
+
self._spdx_id: Attribute[str] = NotSet
|
| 78 |
+
self._url: Attribute[str] = NotSet
|
| 79 |
+
|
| 80 |
+
def __repr__(self) -> str:
|
| 81 |
+
return self.get__repr__({"name": self._name.value})
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def body(self) -> str:
|
| 85 |
+
self._completeIfNotSet(self._body)
|
| 86 |
+
return self._body.value
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def conditions(self) -> list[str]:
|
| 90 |
+
self._completeIfNotSet(self._conditions)
|
| 91 |
+
return self._conditions.value
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def description(self) -> str:
|
| 95 |
+
self._completeIfNotSet(self._description)
|
| 96 |
+
return self._description.value
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def html_url(self) -> str:
|
| 100 |
+
self._completeIfNotSet(self._html_url)
|
| 101 |
+
return self._html_url.value
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def implementation(self) -> str:
|
| 105 |
+
self._completeIfNotSet(self._implementation)
|
| 106 |
+
return self._implementation.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def key(self) -> str:
|
| 110 |
+
self._completeIfNotSet(self._key)
|
| 111 |
+
return self._key.value
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def limitations(self) -> list[str]:
|
| 115 |
+
self._completeIfNotSet(self._limitations)
|
| 116 |
+
return self._limitations.value
|
| 117 |
+
|
| 118 |
+
@property
|
| 119 |
+
def name(self) -> str:
|
| 120 |
+
self._completeIfNotSet(self._name)
|
| 121 |
+
return self._name.value
|
| 122 |
+
|
| 123 |
+
@property
|
| 124 |
+
def node_id(self) -> str:
|
| 125 |
+
self._completeIfNotSet(self._node_id)
|
| 126 |
+
return self._node_id.value
|
| 127 |
+
|
| 128 |
+
@property
|
| 129 |
+
def permissions(self) -> list[str]:
|
| 130 |
+
self._completeIfNotSet(self._permissions)
|
| 131 |
+
return self._permissions.value
|
| 132 |
+
|
| 133 |
+
@property
|
| 134 |
+
def spdx_id(self) -> str:
|
| 135 |
+
self._completeIfNotSet(self._spdx_id)
|
| 136 |
+
return self._spdx_id.value
|
| 137 |
+
|
| 138 |
+
@property
|
| 139 |
+
def url(self) -> str:
|
| 140 |
+
self._completeIfNotSet(self._url)
|
| 141 |
+
return self._url.value
|
| 142 |
+
|
| 143 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 144 |
+
if "body" in attributes: # pragma no branch
|
| 145 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 146 |
+
if "conditions" in attributes: # pragma no branch
|
| 147 |
+
self._conditions = self._makeListOfStringsAttribute(attributes["conditions"])
|
| 148 |
+
if "description" in attributes: # pragma no branch
|
| 149 |
+
self._description = self._makeStringAttribute(attributes["description"])
|
| 150 |
+
if "html_url" in attributes: # pragma no branch
|
| 151 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 152 |
+
if "implementation" in attributes: # pragma no branch
|
| 153 |
+
self._implementation = self._makeStringAttribute(attributes["implementation"])
|
| 154 |
+
if "key" in attributes: # pragma no branch
|
| 155 |
+
self._key = self._makeStringAttribute(attributes["key"])
|
| 156 |
+
if "limitations" in attributes: # pragma no branch
|
| 157 |
+
self._limitations = self._makeListOfStringsAttribute(attributes["limitations"])
|
| 158 |
+
if "name" in attributes: # pragma no branch
|
| 159 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 160 |
+
if "node_id" in attributes: # pragma no branch
|
| 161 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 162 |
+
if "permissions" in attributes: # pragma no branch
|
| 163 |
+
self._permissions = self._makeListOfStringsAttribute(attributes["permissions"])
|
| 164 |
+
if "spdx_id" in attributes: # pragma no branch
|
| 165 |
+
self._spdx_id = self._makeStringAttribute(attributes["spdx_id"])
|
| 166 |
+
if "url" in attributes: # pragma no branch
|
| 167 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/MainClass.py
ADDED
|
@@ -0,0 +1,1058 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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awood <luke.cawood@99designs.com> #
|
| 5 |
+
# Copyright 2012 Michael Woodworth <mwoodworth@upverter.com> #
|
| 6 |
+
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
| 7 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 9 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 10 |
+
# Copyright 2013 Ed Jackson <ed.jackson@gmail.com> #
|
| 11 |
+
# Copyright 2013 Jonathan J Hunt <hunt@braincorporation.com> #
|
| 12 |
+
# Copyright 2013 Steve Brown <steve@evolvedlight.co.uk> #
|
| 13 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 14 |
+
# Copyright 2014 C. R. Oldham <cro@ncbt.org> #
|
| 15 |
+
# Copyright 2014 Thialfihar <thi@thialfihar.org> #
|
| 16 |
+
# Copyright 2014 Tyler Treat <ttreat31@gmail.com> #
|
| 17 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 18 |
+
# Copyright 2015 Daniel Pocock <daniel@pocock.pro> #
|
| 19 |
+
# Copyright 2015 Joseph Rawson <joseph.rawson.works@littledebian.org> #
|
| 20 |
+
# Copyright 2015 Uriel Corfa <uriel@corfa.fr> #
|
| 21 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 22 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2017 Colin Hoglund <colinhoglund@users.noreply.github.com> #
|
| 24 |
+
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
| 25 |
+
# Copyright 2018 Agor Maxime <maxime.agor23@gmail.com> #
|
| 26 |
+
# Copyright 2018 Arda Kuyumcu <kuyumcuarda@gmail.com> #
|
| 27 |
+
# Copyright 2018 Benoit Latinier <benoit@latinier.fr> #
|
| 28 |
+
# Copyright 2018 Bruce Richardson <itsbruce@workshy.org> #
|
| 29 |
+
# Copyright 2018 Joshua Hoblitt <josh@hoblitt.com> #
|
| 30 |
+
# Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com> #
|
| 31 |
+
# Copyright 2018 Mike Miller <github@mikeage.net> #
|
| 32 |
+
# Copyright 2018 Shubham Singh <41840111+singh811@users.noreply.github.com> #
|
| 33 |
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
| 34 |
+
# Copyright 2018 Svend Sorensen <svend@svends.net> #
|
| 35 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 36 |
+
# Copyright 2018 Yossarian King <yggy@blackbirdinteractive.com> #
|
| 37 |
+
# Copyright 2018 h.shi <10385628+AnYeMoWang@users.noreply.github.com> #
|
| 38 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 39 |
+
# Copyright 2019 Adam Baratz <adam.baratz@gmail.com> #
|
| 40 |
+
# Copyright 2019 Caleb Sweeney <caleb.w.sweeney@gmail.com> #
|
| 41 |
+
# Copyright 2019 Hamel Husain <hamelsmu@github.com> #
|
| 42 |
+
# Copyright 2019 Isac Souza <isouza@daitan.com> #
|
| 43 |
+
# Copyright 2019 Jake Klingensmith <jklingen92@users.noreply.github.com> #
|
| 44 |
+
# Copyright 2019 Jake Wilkins <jakewilkins@github.com> #
|
| 45 |
+
# Copyright 2019 Rigas Papathanasopoulos <rigaspapas@gmail.com> #
|
| 46 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 47 |
+
# Copyright 2019 Tomas Tomecek <nereone@gmail.com> #
|
| 48 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 49 |
+
# Copyright 2019 chillipeper <miguel.tpy@gmail.com> #
|
| 50 |
+
# Copyright 2019 秋葉 <ambiguous404@gmail.com> #
|
| 51 |
+
# Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
|
| 52 |
+
# Copyright 2020 Denis Blanchette <dblanchette@coveo.com> #
|
| 53 |
+
# Copyright 2020 Florent Clarret <florent.clarret@gmail.com> #
|
| 54 |
+
# Copyright 2020 Mahesh Raju <coder@mahesh.net> #
|
| 55 |
+
# Copyright 2020 Nikolay Edigaryev <edigaryev@gmail.com> #
|
| 56 |
+
# Copyright 2020 Omar Brikaa <brikaaomar@gmail.com> #
|
| 57 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 58 |
+
# Copyright 2021 Amador Pahim <apahim@redhat.com> #
|
| 59 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 60 |
+
# Copyright 2021 Sachi King <nakato@nakato.io> #
|
| 61 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 62 |
+
# Copyright 2023 Denis Blanchette <dblanchette@coveo.com> #
|
| 63 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 64 |
+
# Copyright 2023 Hemslo Wang <hemslo.wang@gmail.com> #
|
| 65 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 66 |
+
# Copyright 2023 Jonathan Greg <31892308+jmgreg31@users.noreply.github.com> #
|
| 67 |
+
# Copyright 2023 Joseph Henrich <crimsonknave@gmail.com> #
|
| 68 |
+
# Copyright 2023 Mark Amery <markamery@btinternet.com> #
|
| 69 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 70 |
+
# Copyright 2023 YugoHino <henom06@gmail.com> #
|
| 71 |
+
# Copyright 2023 chantra <chantra@users.noreply.github.com> #
|
| 72 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 73 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 74 |
+
# Copyright 2024 Min RK <benjaminrk@gmail.com> #
|
| 75 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 76 |
+
# Copyright 2025 blyedev <63808441+blyedev@users.noreply.github.com> #
|
| 77 |
+
# #
|
| 78 |
+
# This file is part of PyGithub. #
|
| 79 |
+
# http://pygithub.readthedocs.io/ #
|
| 80 |
+
# #
|
| 81 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 82 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 83 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 84 |
+
# any later version. #
|
| 85 |
+
# #
|
| 86 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 87 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 88 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 89 |
+
# details. #
|
| 90 |
+
# #
|
| 91 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 92 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 93 |
+
# #
|
| 94 |
+
################################################################################
|
| 95 |
+
|
| 96 |
+
from __future__ import annotations
|
| 97 |
+
|
| 98 |
+
import pickle
|
| 99 |
+
import urllib.parse
|
| 100 |
+
import warnings
|
| 101 |
+
from datetime import datetime
|
| 102 |
+
from typing import TYPE_CHECKING, Any, BinaryIO, TypeVar
|
| 103 |
+
|
| 104 |
+
import urllib3
|
| 105 |
+
from urllib3.util import Retry
|
| 106 |
+
|
| 107 |
+
import github.ApplicationOAuth
|
| 108 |
+
import github.Auth
|
| 109 |
+
import github.AuthenticatedUser
|
| 110 |
+
import github.Enterprise
|
| 111 |
+
import github.Event
|
| 112 |
+
import github.Gist
|
| 113 |
+
import github.GithubApp
|
| 114 |
+
import github.GithubIntegration
|
| 115 |
+
import github.GithubRetry
|
| 116 |
+
import github.GitignoreTemplate
|
| 117 |
+
import github.GlobalAdvisory
|
| 118 |
+
import github.License
|
| 119 |
+
import github.NamedUser
|
| 120 |
+
import github.Topic
|
| 121 |
+
from github import Consts
|
| 122 |
+
from github.GithubIntegration import GithubIntegration
|
| 123 |
+
from github.GithubObject import CompletableGithubObject, GithubObject, NotSet, Opt, is_defined
|
| 124 |
+
from github.GithubRetry import GithubRetry
|
| 125 |
+
from github.HookDelivery import HookDelivery, HookDeliverySummary
|
| 126 |
+
from github.HookDescription import HookDescription
|
| 127 |
+
from github.PaginatedList import PaginatedList
|
| 128 |
+
from github.RateLimit import RateLimit
|
| 129 |
+
from github.Requester import Requester
|
| 130 |
+
|
| 131 |
+
if TYPE_CHECKING:
|
| 132 |
+
from github.AppAuthentication import AppAuthentication
|
| 133 |
+
from github.ApplicationOAuth import ApplicationOAuth
|
| 134 |
+
from github.AuthenticatedUser import AuthenticatedUser
|
| 135 |
+
from github.Commit import Commit
|
| 136 |
+
from github.ContentFile import ContentFile
|
| 137 |
+
from github.Event import Event
|
| 138 |
+
from github.Gist import Gist
|
| 139 |
+
from github.GithubApp import GithubApp
|
| 140 |
+
from github.GitignoreTemplate import GitignoreTemplate
|
| 141 |
+
from github.GlobalAdvisory import GlobalAdvisory
|
| 142 |
+
from github.Issue import Issue
|
| 143 |
+
from github.License import License
|
| 144 |
+
from github.NamedUser import NamedUser
|
| 145 |
+
from github.Organization import Organization
|
| 146 |
+
from github.Project import Project
|
| 147 |
+
from github.ProjectColumn import ProjectColumn
|
| 148 |
+
from github.Repository import Repository
|
| 149 |
+
from github.RepositoryDiscussion import RepositoryDiscussion
|
| 150 |
+
from github.Topic import Topic
|
| 151 |
+
|
| 152 |
+
TGithubObject = TypeVar("TGithubObject", bound=GithubObject)
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
class Github:
|
| 156 |
+
"""
|
| 157 |
+
This is the main class you instantiate to access the Github API v3.
|
| 158 |
+
|
| 159 |
+
Optional parameters allow different authentication methods.
|
| 160 |
+
|
| 161 |
+
"""
|
| 162 |
+
|
| 163 |
+
__requester: Requester
|
| 164 |
+
|
| 165 |
+
default_retry = GithubRetry()
|
| 166 |
+
|
| 167 |
+
# keep non-deprecated arguments in-sync with Requester
|
| 168 |
+
# v3: remove login_or_token, password, jwt and app_auth
|
| 169 |
+
# v3: move auth to the front of arguments
|
| 170 |
+
# v3: add * before first argument so all arguments must be named,
|
| 171 |
+
# allows to reorder / add new arguments / remove deprecated arguments without breaking user code
|
| 172 |
+
def __init__(
|
| 173 |
+
self,
|
| 174 |
+
login_or_token: str | None = None,
|
| 175 |
+
password: str | None = None,
|
| 176 |
+
jwt: str | None = None,
|
| 177 |
+
app_auth: AppAuthentication | None = None,
|
| 178 |
+
base_url: str = Consts.DEFAULT_BASE_URL,
|
| 179 |
+
timeout: int = Consts.DEFAULT_TIMEOUT,
|
| 180 |
+
user_agent: str = Consts.DEFAULT_USER_AGENT,
|
| 181 |
+
per_page: int = Consts.DEFAULT_PER_PAGE,
|
| 182 |
+
verify: bool | str = True,
|
| 183 |
+
retry: int | Retry | None = default_retry,
|
| 184 |
+
pool_size: int | None = None,
|
| 185 |
+
seconds_between_requests: float | None = Consts.DEFAULT_SECONDS_BETWEEN_REQUESTS,
|
| 186 |
+
seconds_between_writes: float | None = Consts.DEFAULT_SECONDS_BETWEEN_WRITES,
|
| 187 |
+
auth: github.Auth.Auth | None = None,
|
| 188 |
+
# v3: set lazy = True as the default
|
| 189 |
+
lazy: bool = False,
|
| 190 |
+
) -> None:
|
| 191 |
+
"""
|
| 192 |
+
:param login_or_token: string deprecated, use auth=github.Auth.Login(...) or auth=github.Auth.Token(...) instead
|
| 193 |
+
:param password: string deprecated, use auth=github.Auth.Login(...) instead
|
| 194 |
+
:param jwt: string deprecated, use auth=github.Auth.AppAuth(...) or auth=github.Auth.AppAuthToken(...) instead
|
| 195 |
+
:param app_auth: github.AppAuthentication deprecated, use auth=github.Auth.AppInstallationAuth(...) instead
|
| 196 |
+
:param base_url: string
|
| 197 |
+
:param timeout: integer
|
| 198 |
+
:param user_agent: string
|
| 199 |
+
:param per_page: int
|
| 200 |
+
:param verify: boolean or string
|
| 201 |
+
:param retry: int or urllib3.util.retry.Retry object,
|
| 202 |
+
defaults to github.Github.default_retry,
|
| 203 |
+
set to None to disable retries
|
| 204 |
+
:param pool_size: int
|
| 205 |
+
:param seconds_between_requests: float
|
| 206 |
+
:param seconds_between_writes: float
|
| 207 |
+
:param auth: authentication method
|
| 208 |
+
:param lazy: completable objects created from this instance are lazy,
|
| 209 |
+
as well as completable objects created from those, and so on
|
| 210 |
+
"""
|
| 211 |
+
|
| 212 |
+
assert login_or_token is None or isinstance(login_or_token, str), login_or_token
|
| 213 |
+
assert password is None or isinstance(password, str), password
|
| 214 |
+
assert jwt is None or isinstance(jwt, str), jwt
|
| 215 |
+
assert isinstance(base_url, str), base_url
|
| 216 |
+
assert isinstance(timeout, int), timeout
|
| 217 |
+
assert user_agent is None or isinstance(user_agent, str), user_agent
|
| 218 |
+
assert isinstance(per_page, int), per_page
|
| 219 |
+
assert isinstance(verify, (bool, str)), verify
|
| 220 |
+
assert retry is None or isinstance(retry, int) or isinstance(retry, urllib3.util.Retry), retry
|
| 221 |
+
assert pool_size is None or isinstance(pool_size, int), pool_size
|
| 222 |
+
assert seconds_between_requests is None or seconds_between_requests >= 0
|
| 223 |
+
assert seconds_between_writes is None or seconds_between_writes >= 0
|
| 224 |
+
assert auth is None or isinstance(auth, github.Auth.Auth), auth
|
| 225 |
+
assert isinstance(lazy, bool), lazy
|
| 226 |
+
|
| 227 |
+
if password is not None:
|
| 228 |
+
warnings.warn(
|
| 229 |
+
"Arguments login_or_token and password are deprecated, please use "
|
| 230 |
+
"auth=github.Auth.Login(...) instead",
|
| 231 |
+
category=DeprecationWarning,
|
| 232 |
+
)
|
| 233 |
+
auth = github.Auth.Login(login_or_token, password) # type: ignore
|
| 234 |
+
elif login_or_token is not None:
|
| 235 |
+
warnings.warn(
|
| 236 |
+
"Argument login_or_token is deprecated, please use " "auth=github.Auth.Token(...) instead",
|
| 237 |
+
category=DeprecationWarning,
|
| 238 |
+
)
|
| 239 |
+
auth = github.Auth.Token(login_or_token)
|
| 240 |
+
elif jwt is not None:
|
| 241 |
+
warnings.warn(
|
| 242 |
+
"Argument jwt is deprecated, please use "
|
| 243 |
+
"auth=github.Auth.AppAuth(...) or "
|
| 244 |
+
"auth=github.Auth.AppAuthToken(...) instead",
|
| 245 |
+
category=DeprecationWarning,
|
| 246 |
+
)
|
| 247 |
+
auth = github.Auth.AppAuthToken(jwt)
|
| 248 |
+
elif app_auth is not None:
|
| 249 |
+
warnings.warn(
|
| 250 |
+
"Argument app_auth is deprecated, please use " "auth=github.Auth.AppInstallationAuth(...) instead",
|
| 251 |
+
category=DeprecationWarning,
|
| 252 |
+
)
|
| 253 |
+
auth = app_auth
|
| 254 |
+
|
| 255 |
+
self.__requester = Requester(
|
| 256 |
+
auth,
|
| 257 |
+
base_url,
|
| 258 |
+
timeout,
|
| 259 |
+
user_agent,
|
| 260 |
+
per_page,
|
| 261 |
+
verify,
|
| 262 |
+
retry,
|
| 263 |
+
pool_size,
|
| 264 |
+
seconds_between_requests,
|
| 265 |
+
seconds_between_writes,
|
| 266 |
+
lazy,
|
| 267 |
+
)
|
| 268 |
+
|
| 269 |
+
def withLazy(self, lazy: bool) -> Github:
|
| 270 |
+
"""
|
| 271 |
+
Create a Github instance with identical configuration but the given lazy setting.
|
| 272 |
+
|
| 273 |
+
:param lazy: completable objects created from this instance are lazy, as well as completable objects created
|
| 274 |
+
from those, and so on
|
| 275 |
+
:return: new Github instance
|
| 276 |
+
|
| 277 |
+
"""
|
| 278 |
+
kwargs = self.__requester.kwargs
|
| 279 |
+
kwargs.update(lazy=lazy)
|
| 280 |
+
return Github(**kwargs)
|
| 281 |
+
|
| 282 |
+
def close(self) -> None:
|
| 283 |
+
"""Close connections to the server. Alternatively, use the Github
|
| 284 |
+
object as a context manager:
|
| 285 |
+
|
| 286 |
+
.. code-block:: python
|
| 287 |
+
|
| 288 |
+
with github.Github(...) as gh:
|
| 289 |
+
# do something
|
| 290 |
+
"""
|
| 291 |
+
self.__requester.close()
|
| 292 |
+
|
| 293 |
+
def __enter__(self) -> Github:
|
| 294 |
+
return self
|
| 295 |
+
|
| 296 |
+
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
|
| 297 |
+
self.close()
|
| 298 |
+
|
| 299 |
+
@property
|
| 300 |
+
def requester(self) -> Requester:
|
| 301 |
+
"""
|
| 302 |
+
Return my Requester object.
|
| 303 |
+
|
| 304 |
+
For example, to make requests to API endpoints not yet supported by PyGitHub.
|
| 305 |
+
|
| 306 |
+
"""
|
| 307 |
+
return self.__requester
|
| 308 |
+
|
| 309 |
+
@property
|
| 310 |
+
def FIX_REPO_GET_GIT_REF(self) -> bool:
|
| 311 |
+
return self.__requester.FIX_REPO_GET_GIT_REF
|
| 312 |
+
|
| 313 |
+
@FIX_REPO_GET_GIT_REF.setter
|
| 314 |
+
def FIX_REPO_GET_GIT_REF(self, value: bool) -> None:
|
| 315 |
+
self.__requester.FIX_REPO_GET_GIT_REF = value
|
| 316 |
+
|
| 317 |
+
# v3: Remove this property? Why should it be necessary to read/modify it after construction
|
| 318 |
+
@property
|
| 319 |
+
def per_page(self) -> int:
|
| 320 |
+
return self.__requester.per_page
|
| 321 |
+
|
| 322 |
+
@per_page.setter
|
| 323 |
+
def per_page(self, value: int) -> None:
|
| 324 |
+
self.__requester.per_page = value
|
| 325 |
+
|
| 326 |
+
# v3: Provide a unified way to access values of headers of last response
|
| 327 |
+
# v3: (and add/keep ad hoc properties for specific useful headers like rate limiting, oauth scopes, etc.)
|
| 328 |
+
# v3: Return an instance of a class: using a tuple did not allow to add a field "resettime"
|
| 329 |
+
@property
|
| 330 |
+
def rate_limiting(self) -> tuple[int, int]:
|
| 331 |
+
"""
|
| 332 |
+
First value is requests remaining, second value is request limit.
|
| 333 |
+
"""
|
| 334 |
+
remaining, limit = self.__requester.rate_limiting
|
| 335 |
+
if limit < 0:
|
| 336 |
+
self.get_rate_limit()
|
| 337 |
+
return self.__requester.rate_limiting
|
| 338 |
+
|
| 339 |
+
@property
|
| 340 |
+
def rate_limiting_resettime(self) -> int:
|
| 341 |
+
"""
|
| 342 |
+
Unix timestamp indicating when rate limiting will reset.
|
| 343 |
+
"""
|
| 344 |
+
if self.__requester.rate_limiting_resettime == 0:
|
| 345 |
+
self.get_rate_limit()
|
| 346 |
+
return self.__requester.rate_limiting_resettime
|
| 347 |
+
|
| 348 |
+
def get_rate_limit(self) -> RateLimit:
|
| 349 |
+
"""
|
| 350 |
+
Rate limit status for different resources (core/search/graphql).
|
| 351 |
+
|
| 352 |
+
:calls:`GET /rate_limit <https://docs.github.com/en/rest/reference/rate-limit>`_
|
| 353 |
+
|
| 354 |
+
"""
|
| 355 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", "/rate_limit")
|
| 356 |
+
return RateLimit(self.__requester, headers, data["resources"])
|
| 357 |
+
|
| 358 |
+
@property
|
| 359 |
+
def oauth_scopes(self) -> list[str] | None:
|
| 360 |
+
"""
|
| 361 |
+
:type: list of string
|
| 362 |
+
"""
|
| 363 |
+
return self.__requester.oauth_scopes
|
| 364 |
+
|
| 365 |
+
def get_license(self, key: Opt[str] = NotSet) -> License:
|
| 366 |
+
"""
|
| 367 |
+
:calls: `GET /license/{license} <https://docs.github.com/en/rest/reference/licenses#get-a-license>`_
|
| 368 |
+
"""
|
| 369 |
+
|
| 370 |
+
assert isinstance(key, str), key
|
| 371 |
+
key = urllib.parse.quote(key)
|
| 372 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", f"/licenses/{key}")
|
| 373 |
+
return github.License.License(self.__requester, headers, data, completed=True)
|
| 374 |
+
|
| 375 |
+
def get_licenses(self) -> PaginatedList[License]:
|
| 376 |
+
"""
|
| 377 |
+
:calls: `GET /licenses <https://docs.github.com/en/rest/reference/licenses#get-all-commonly-used-licenses>`_
|
| 378 |
+
"""
|
| 379 |
+
|
| 380 |
+
url_parameters: dict[str, Any] = {}
|
| 381 |
+
|
| 382 |
+
return PaginatedList(github.License.License, self.__requester, "/licenses", url_parameters)
|
| 383 |
+
|
| 384 |
+
def get_events(self) -> PaginatedList[Event]:
|
| 385 |
+
"""
|
| 386 |
+
:calls: `GET /events <https://docs.github.com/en/rest/reference/activity#list-public-events>`_
|
| 387 |
+
"""
|
| 388 |
+
|
| 389 |
+
return PaginatedList(github.Event.Event, self.__requester, "/events", None)
|
| 390 |
+
|
| 391 |
+
def get_user(self, login: Opt[str] = NotSet) -> NamedUser | AuthenticatedUser:
|
| 392 |
+
"""
|
| 393 |
+
:calls: `GET /users/{user} <https://docs.github.com/en/rest/reference/users>`_ or `GET /user <https://docs.github.com/en/rest/reference/users>`_
|
| 394 |
+
"""
|
| 395 |
+
if login is NotSet:
|
| 396 |
+
url = "/user"
|
| 397 |
+
# always return a lazy completable AuthenticatedUser
|
| 398 |
+
# v3: given github.Github(lazy=True) is now default, remove completed=False here
|
| 399 |
+
return github.AuthenticatedUser.AuthenticatedUser(self.__requester, url=url, completed=False)
|
| 400 |
+
else:
|
| 401 |
+
assert isinstance(login, str), login
|
| 402 |
+
login = urllib.parse.quote(login)
|
| 403 |
+
url = f"/users/{login}"
|
| 404 |
+
# always return a completed NamedUser
|
| 405 |
+
# v3: remove complete() here and make this as lazy as github.Github is
|
| 406 |
+
return github.NamedUser.NamedUser(self.__requester, url=url).complete()
|
| 407 |
+
|
| 408 |
+
def get_user_by_id(self, user_id: int) -> NamedUser:
|
| 409 |
+
"""
|
| 410 |
+
:calls: `GET /user/{id} <https://docs.github.com/en/rest/reference/users>`_
|
| 411 |
+
:param user_id: int
|
| 412 |
+
:rtype: :class:`github.NamedUser.NamedUser`
|
| 413 |
+
"""
|
| 414 |
+
assert isinstance(user_id, int), user_id
|
| 415 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", f"/user/{user_id}")
|
| 416 |
+
return github.NamedUser.NamedUser(self.__requester, headers, data, completed=True)
|
| 417 |
+
|
| 418 |
+
def get_users(self, since: Opt[int] = NotSet) -> PaginatedList[NamedUser]:
|
| 419 |
+
"""
|
| 420 |
+
:calls: `GET /users <https://docs.github.com/en/rest/reference/users>`_
|
| 421 |
+
"""
|
| 422 |
+
assert since is NotSet or isinstance(since, int), since
|
| 423 |
+
url_parameters = dict()
|
| 424 |
+
if since is not NotSet:
|
| 425 |
+
url_parameters["since"] = since
|
| 426 |
+
return PaginatedList(github.NamedUser.NamedUser, self.__requester, "/users", url_parameters)
|
| 427 |
+
|
| 428 |
+
def get_organization(self, org: str) -> Organization:
|
| 429 |
+
"""
|
| 430 |
+
:calls: `GET /orgs/{org} <https://docs.github.com/en/rest/reference/orgs>`_
|
| 431 |
+
"""
|
| 432 |
+
assert isinstance(org, str), org
|
| 433 |
+
org = urllib.parse.quote(org)
|
| 434 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", f"/orgs/{org}")
|
| 435 |
+
return github.Organization.Organization(self.__requester, headers, data, completed=True)
|
| 436 |
+
|
| 437 |
+
def get_organizations(self, since: Opt[int] = NotSet) -> PaginatedList[Organization]:
|
| 438 |
+
"""
|
| 439 |
+
:calls: `GET /organizations <https://docs.github.com/en/rest/reference/orgs#list-organizations>`_
|
| 440 |
+
"""
|
| 441 |
+
assert since is NotSet or isinstance(since, int), since
|
| 442 |
+
url_parameters = dict()
|
| 443 |
+
if since is not NotSet:
|
| 444 |
+
url_parameters["since"] = since
|
| 445 |
+
return PaginatedList(
|
| 446 |
+
github.Organization.Organization,
|
| 447 |
+
self.__requester,
|
| 448 |
+
"/organizations",
|
| 449 |
+
url_parameters,
|
| 450 |
+
)
|
| 451 |
+
|
| 452 |
+
def get_enterprise(self, enterprise: str) -> github.Enterprise.Enterprise:
|
| 453 |
+
"""
|
| 454 |
+
:calls: `GET /enterprises/{enterprise} <https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin>`_
|
| 455 |
+
:param enterprise: string
|
| 456 |
+
:rtype: :class:`Enterprise`
|
| 457 |
+
"""
|
| 458 |
+
assert isinstance(enterprise, str), enterprise
|
| 459 |
+
# There is no native "/enterprises/{enterprise}" api, so this function is a hub for apis that start with "/enterprise/{enterprise}".
|
| 460 |
+
return github.Enterprise.Enterprise(self.__requester, enterprise)
|
| 461 |
+
|
| 462 |
+
def get_repo(self, full_name_or_id: int | str, lazy: bool = False) -> Repository:
|
| 463 |
+
"""
|
| 464 |
+
:calls: `GET /repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/repos>`_ or `GET /repositories/{id} <https://docs.github.com/en/rest/reference/repos>`_
|
| 465 |
+
"""
|
| 466 |
+
assert isinstance(full_name_or_id, (str, int)), full_name_or_id
|
| 467 |
+
url_base = "/repositories/" if isinstance(full_name_or_id, int) else "/repos/"
|
| 468 |
+
url = f"{url_base}{full_name_or_id}"
|
| 469 |
+
if lazy:
|
| 470 |
+
return github.Repository.Repository(self.__requester, {}, {"url": url}, completed=False)
|
| 471 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", url)
|
| 472 |
+
return github.Repository.Repository(self.__requester, headers, data, completed=True)
|
| 473 |
+
|
| 474 |
+
def get_repos(
|
| 475 |
+
self,
|
| 476 |
+
since: Opt[int] = NotSet,
|
| 477 |
+
visibility: Opt[str] = NotSet,
|
| 478 |
+
) -> PaginatedList[Repository]:
|
| 479 |
+
"""
|
| 480 |
+
:calls: `GET /repositories <https://docs.github.com/en/rest/reference/repos#list-public-repositories>`_
|
| 481 |
+
:param since: integer
|
| 482 |
+
:param visibility: string ('all','public')
|
| 483 |
+
"""
|
| 484 |
+
assert since is NotSet or isinstance(since, int), since
|
| 485 |
+
url_parameters: dict[str, Any] = {}
|
| 486 |
+
if since is not NotSet:
|
| 487 |
+
url_parameters["since"] = since
|
| 488 |
+
if visibility is not NotSet:
|
| 489 |
+
assert visibility in ("public", "all"), visibility
|
| 490 |
+
url_parameters["visibility"] = visibility
|
| 491 |
+
return PaginatedList(
|
| 492 |
+
github.Repository.Repository,
|
| 493 |
+
self.__requester,
|
| 494 |
+
"/repositories",
|
| 495 |
+
url_parameters,
|
| 496 |
+
)
|
| 497 |
+
|
| 498 |
+
def get_repository_discussion(self, node_id: str, discussion_graphql_schema: str) -> RepositoryDiscussion:
|
| 499 |
+
return self.__requester.graphql_node_class(
|
| 500 |
+
node_id, discussion_graphql_schema, github.RepositoryDiscussion.RepositoryDiscussion, "Discussion"
|
| 501 |
+
)
|
| 502 |
+
|
| 503 |
+
def get_project(self, id: int) -> Project:
|
| 504 |
+
"""
|
| 505 |
+
:calls: `GET /projects/{project_id} <https://docs.github.com/en/rest/reference/projects#get-a-project>`_
|
| 506 |
+
"""
|
| 507 |
+
headers, data = self.__requester.requestJsonAndCheck(
|
| 508 |
+
"GET",
|
| 509 |
+
f"/projects/{id:d}",
|
| 510 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 511 |
+
)
|
| 512 |
+
return github.Project.Project(self.__requester, headers, data, completed=True)
|
| 513 |
+
|
| 514 |
+
def get_project_column(self, id: int) -> ProjectColumn:
|
| 515 |
+
"""
|
| 516 |
+
:calls: `GET /projects/columns/{column_id} <https://docs.github.com/en/rest/reference/projects#get-a-project-column>`_
|
| 517 |
+
"""
|
| 518 |
+
headers, data = self.__requester.requestJsonAndCheck(
|
| 519 |
+
"GET",
|
| 520 |
+
"/projects/columns/%d" % id,
|
| 521 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 522 |
+
)
|
| 523 |
+
return github.ProjectColumn.ProjectColumn(self.__requester, headers, data, completed=True)
|
| 524 |
+
|
| 525 |
+
def get_gist(self, id: str) -> Gist:
|
| 526 |
+
"""
|
| 527 |
+
:calls: `GET /gists/{id} <https://docs.github.com/en/rest/reference/gists>`_
|
| 528 |
+
"""
|
| 529 |
+
assert isinstance(id, str), id
|
| 530 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", f"/gists/{id}")
|
| 531 |
+
return github.Gist.Gist(self.__requester, headers, data, completed=True)
|
| 532 |
+
|
| 533 |
+
def get_gists(self, since: Opt[datetime] = NotSet) -> PaginatedList[Gist]:
|
| 534 |
+
"""
|
| 535 |
+
:calls: `GET /gists/public <https://docs.github.com/en/rest/reference/gists>`_
|
| 536 |
+
"""
|
| 537 |
+
assert since is NotSet or isinstance(since, datetime), since
|
| 538 |
+
url_parameters = dict()
|
| 539 |
+
if is_defined(since):
|
| 540 |
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 541 |
+
return PaginatedList(github.Gist.Gist, self.__requester, "/gists/public", url_parameters)
|
| 542 |
+
|
| 543 |
+
def get_global_advisory(self, ghsa_id: str) -> GlobalAdvisory:
|
| 544 |
+
"""
|
| 545 |
+
:calls: `GET /advisories/{ghsa_id} <https://docs.github.com/en/rest/security-advisories/global-advisories>`_
|
| 546 |
+
:param ghsa_id: string
|
| 547 |
+
:rtype: :class:`github.GlobalAdvisory.GlobalAdvisory`
|
| 548 |
+
"""
|
| 549 |
+
assert isinstance(ghsa_id, str), ghsa_id
|
| 550 |
+
ghsa_id = urllib.parse.quote(ghsa_id)
|
| 551 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", f"/advisories/{ghsa_id}")
|
| 552 |
+
return github.GlobalAdvisory.GlobalAdvisory(self.__requester, headers, data)
|
| 553 |
+
|
| 554 |
+
def get_global_advisories(
|
| 555 |
+
self,
|
| 556 |
+
type: Opt[str] = NotSet,
|
| 557 |
+
ghsa_id: Opt[str] = NotSet,
|
| 558 |
+
cve_id: Opt[str] = NotSet,
|
| 559 |
+
ecosystem: Opt[str] = NotSet,
|
| 560 |
+
severity: Opt[str] = NotSet,
|
| 561 |
+
cwes: list[Opt[str]] | Opt[str] = NotSet,
|
| 562 |
+
is_withdrawn: Opt[bool] = NotSet,
|
| 563 |
+
affects: list[str] | Opt[str] = NotSet,
|
| 564 |
+
published: Opt[str] = NotSet,
|
| 565 |
+
updated: Opt[str] = NotSet,
|
| 566 |
+
modified: Opt[str] = NotSet,
|
| 567 |
+
keywords: Opt[str] = NotSet,
|
| 568 |
+
before: Opt[str] = NotSet,
|
| 569 |
+
after: Opt[str] = NotSet,
|
| 570 |
+
per_page: Opt[str] = NotSet,
|
| 571 |
+
sort: Opt[str] = NotSet,
|
| 572 |
+
direction: Opt[str] = NotSet,
|
| 573 |
+
) -> PaginatedList[GlobalAdvisory]:
|
| 574 |
+
"""
|
| 575 |
+
:calls: `GET /advisories <https://docs.github.com/en/rest/security-advisories/global-advisories>`
|
| 576 |
+
:param type: Optional string
|
| 577 |
+
:param ghsa_id: Optional string
|
| 578 |
+
:param cve_id: Optional string
|
| 579 |
+
:param ecosystem: Optional string
|
| 580 |
+
:param severity: Optional string
|
| 581 |
+
:param cwes: Optional comma separated string or list of integer or string
|
| 582 |
+
:param is_withdrawn: Optional bool
|
| 583 |
+
:param affects: Optional comma separated string or list of string
|
| 584 |
+
:param published: Optional string
|
| 585 |
+
:param updated: Optional string
|
| 586 |
+
:param modified: Optional string
|
| 587 |
+
:param before: Optional string
|
| 588 |
+
:param after: Optional string
|
| 589 |
+
:param sort: Optional string
|
| 590 |
+
:param direction: Optional string
|
| 591 |
+
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GlobalAdvisory.GlobalAdvisory`
|
| 592 |
+
"""
|
| 593 |
+
assert type is github.GithubObject.NotSet or isinstance(type, str), type
|
| 594 |
+
assert ghsa_id is github.GithubObject.NotSet or isinstance(ghsa_id, str)
|
| 595 |
+
assert cve_id is github.GithubObject.NotSet or isinstance(cve_id, str), cve_id
|
| 596 |
+
assert ecosystem is github.GithubObject.NotSet or isinstance(ecosystem, str), ecosystem
|
| 597 |
+
assert severity is github.GithubObject.NotSet or isinstance(severity, str), severity
|
| 598 |
+
assert cwes is github.GithubObject.NotSet or isinstance(cwes, list) or isinstance(cwes, str), cwes
|
| 599 |
+
assert is_withdrawn is github.GithubObject.NotSet or isinstance(is_withdrawn, bool), is_withdrawn
|
| 600 |
+
assert affects is github.GithubObject.NotSet or isinstance(affects, list) or isinstance(affects, str), affects
|
| 601 |
+
assert published is github.GithubObject.NotSet or isinstance(published, str), published
|
| 602 |
+
assert updated is github.GithubObject.NotSet or isinstance(updated, str), updated
|
| 603 |
+
assert modified is github.GithubObject.NotSet or isinstance(modified, str), modified
|
| 604 |
+
assert before is github.GithubObject.NotSet or isinstance(before, str), before
|
| 605 |
+
assert after is github.GithubObject.NotSet or isinstance(after, str), after
|
| 606 |
+
assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort
|
| 607 |
+
assert direction is github.GithubObject.NotSet or isinstance(direction, str), direction
|
| 608 |
+
|
| 609 |
+
url_parameters: dict[str, Opt[str | bool]] = dict()
|
| 610 |
+
if type is not github.GithubObject.NotSet: # pragma no branch (Should be covered)
|
| 611 |
+
assert type in ("reviewed", "unreviewed", "malware"), type
|
| 612 |
+
url_parameters["type"] = type
|
| 613 |
+
if ghsa_id is not github.GithubObject.NotSet:
|
| 614 |
+
url_parameters["ghsa_id"] = ghsa_id
|
| 615 |
+
if cve_id is not github.GithubObject.NotSet:
|
| 616 |
+
url_parameters["cve_id"] = cve_id
|
| 617 |
+
# Can be one of: actions, composer, erlang, go, maven, npm, nuget, other, pip, pub, rubygems, rust
|
| 618 |
+
# Not asserting in that list so that the package doesn't need to be updated when a new ecosystem is added
|
| 619 |
+
if ecosystem is not github.GithubObject.NotSet:
|
| 620 |
+
url_parameters["ecosystem"] = ecosystem
|
| 621 |
+
if severity is not github.GithubObject.NotSet:
|
| 622 |
+
assert severity in ("null", "low", "medium", "high", "critical"), severity
|
| 623 |
+
url_parameters["severity"] = severity
|
| 624 |
+
if cwes is not github.GithubObject.NotSet:
|
| 625 |
+
if isinstance(cwes, list):
|
| 626 |
+
cwes = ",".join([str(cwe) for cwe in cwes])
|
| 627 |
+
url_parameters["cwes"] = cwes
|
| 628 |
+
if is_withdrawn is not github.GithubObject.NotSet:
|
| 629 |
+
url_parameters["is_withdrawn"] = is_withdrawn
|
| 630 |
+
if affects is not github.GithubObject.NotSet:
|
| 631 |
+
if isinstance(affects, list):
|
| 632 |
+
affects = ",".join(affects)
|
| 633 |
+
url_parameters["affects"] = affects
|
| 634 |
+
if published is not github.GithubObject.NotSet:
|
| 635 |
+
url_parameters["published"] = published
|
| 636 |
+
if updated is not github.GithubObject.NotSet:
|
| 637 |
+
url_parameters["updated"] = updated
|
| 638 |
+
if modified is not github.GithubObject.NotSet:
|
| 639 |
+
url_parameters["modified"] = modified
|
| 640 |
+
if before is not github.GithubObject.NotSet:
|
| 641 |
+
url_parameters["before"] = before
|
| 642 |
+
if after is not github.GithubObject.NotSet:
|
| 643 |
+
url_parameters["after"] = after
|
| 644 |
+
if sort is not github.GithubObject.NotSet:
|
| 645 |
+
assert sort in ("published", "updated"), sort
|
| 646 |
+
url_parameters["sort"] = sort
|
| 647 |
+
if direction is not github.GithubObject.NotSet:
|
| 648 |
+
assert direction in ("asc", "desc"), direction
|
| 649 |
+
url_parameters["direction"] = direction
|
| 650 |
+
return github.PaginatedList.PaginatedList(
|
| 651 |
+
github.GlobalAdvisory.GlobalAdvisory,
|
| 652 |
+
self.__requester,
|
| 653 |
+
"/advisories",
|
| 654 |
+
url_parameters,
|
| 655 |
+
)
|
| 656 |
+
|
| 657 |
+
def search_repositories(
|
| 658 |
+
self,
|
| 659 |
+
query: str,
|
| 660 |
+
sort: Opt[str] = NotSet,
|
| 661 |
+
order: Opt[str] = NotSet,
|
| 662 |
+
**qualifiers: Any,
|
| 663 |
+
) -> PaginatedList[Repository]:
|
| 664 |
+
"""
|
| 665 |
+
:calls: `GET /search/repositories <https://docs.github.com/en/rest/reference/search>`_
|
| 666 |
+
:param query: string
|
| 667 |
+
:param sort: string ('stars', 'forks', 'updated')
|
| 668 |
+
:param order: string ('asc', 'desc')
|
| 669 |
+
:param qualifiers: keyword dict query qualifiers
|
| 670 |
+
"""
|
| 671 |
+
assert isinstance(query, str), query
|
| 672 |
+
url_parameters = dict()
|
| 673 |
+
if sort is not NotSet: # pragma no branch (Should be covered)
|
| 674 |
+
assert sort in ("stars", "forks", "updated"), sort
|
| 675 |
+
url_parameters["sort"] = sort
|
| 676 |
+
if order is not NotSet: # pragma no branch (Should be covered)
|
| 677 |
+
assert order in ("asc", "desc"), order
|
| 678 |
+
url_parameters["order"] = order
|
| 679 |
+
|
| 680 |
+
query_chunks = []
|
| 681 |
+
if query: # pragma no branch (Should be covered)
|
| 682 |
+
query_chunks.append(query)
|
| 683 |
+
|
| 684 |
+
for qualifier, value in qualifiers.items():
|
| 685 |
+
query_chunks.append(f"{qualifier}:{value}")
|
| 686 |
+
|
| 687 |
+
url_parameters["q"] = " ".join(query_chunks)
|
| 688 |
+
assert url_parameters["q"], "need at least one qualifier"
|
| 689 |
+
|
| 690 |
+
return PaginatedList(
|
| 691 |
+
github.Repository.Repository,
|
| 692 |
+
self.__requester,
|
| 693 |
+
"/search/repositories",
|
| 694 |
+
url_parameters,
|
| 695 |
+
)
|
| 696 |
+
|
| 697 |
+
def search_users(
|
| 698 |
+
self,
|
| 699 |
+
query: str,
|
| 700 |
+
sort: Opt[str] = NotSet,
|
| 701 |
+
order: Opt[str] = NotSet,
|
| 702 |
+
**qualifiers: Any,
|
| 703 |
+
) -> PaginatedList[NamedUser]:
|
| 704 |
+
"""
|
| 705 |
+
:calls: `GET /search/users <https://docs.github.com/en/rest/reference/search>`_
|
| 706 |
+
:param query: string
|
| 707 |
+
:param sort: string ('followers', 'repositories', 'joined')
|
| 708 |
+
:param order: string ('asc', 'desc')
|
| 709 |
+
:param qualifiers: keyword dict query qualifiers
|
| 710 |
+
:rtype: :class:`PaginatedList` of :class:`github.NamedUser.NamedUser`
|
| 711 |
+
"""
|
| 712 |
+
assert isinstance(query, str), query
|
| 713 |
+
url_parameters = dict()
|
| 714 |
+
if sort is not NotSet:
|
| 715 |
+
assert sort in ("followers", "repositories", "joined"), sort
|
| 716 |
+
url_parameters["sort"] = sort
|
| 717 |
+
if order is not NotSet:
|
| 718 |
+
assert order in ("asc", "desc"), order
|
| 719 |
+
url_parameters["order"] = order
|
| 720 |
+
|
| 721 |
+
query_chunks = []
|
| 722 |
+
if query:
|
| 723 |
+
query_chunks.append(query)
|
| 724 |
+
|
| 725 |
+
for qualifier, value in qualifiers.items():
|
| 726 |
+
query_chunks.append(f"{qualifier}:{value}")
|
| 727 |
+
|
| 728 |
+
url_parameters["q"] = " ".join(query_chunks)
|
| 729 |
+
assert url_parameters["q"], "need at least one qualifier"
|
| 730 |
+
|
| 731 |
+
return PaginatedList(
|
| 732 |
+
github.NamedUser.NamedUser,
|
| 733 |
+
self.__requester,
|
| 734 |
+
"/search/users",
|
| 735 |
+
url_parameters,
|
| 736 |
+
)
|
| 737 |
+
|
| 738 |
+
def search_issues(
|
| 739 |
+
self,
|
| 740 |
+
query: str,
|
| 741 |
+
sort: Opt[str] = NotSet,
|
| 742 |
+
order: Opt[str] = NotSet,
|
| 743 |
+
**qualifiers: Any,
|
| 744 |
+
) -> PaginatedList[Issue]:
|
| 745 |
+
"""
|
| 746 |
+
:calls: `GET /search/issues <https://docs.github.com/en/rest/reference/search>`_
|
| 747 |
+
:param query: string
|
| 748 |
+
:param sort: string ('comments', 'created', 'updated')
|
| 749 |
+
:param order: string ('asc', 'desc')
|
| 750 |
+
:param qualifiers: keyword dict query qualifiers
|
| 751 |
+
:rtype: :class:`PaginatedList` of :class:`github.Issue.Issue`
|
| 752 |
+
"""
|
| 753 |
+
assert isinstance(query, str), query
|
| 754 |
+
url_parameters = dict()
|
| 755 |
+
if sort is not NotSet:
|
| 756 |
+
assert sort in ("comments", "created", "updated"), sort
|
| 757 |
+
url_parameters["sort"] = sort
|
| 758 |
+
if order is not NotSet:
|
| 759 |
+
assert order in ("asc", "desc"), order
|
| 760 |
+
url_parameters["order"] = order
|
| 761 |
+
|
| 762 |
+
query_chunks = []
|
| 763 |
+
if query: # pragma no branch (Should be covered)
|
| 764 |
+
query_chunks.append(query)
|
| 765 |
+
|
| 766 |
+
for qualifier, value in qualifiers.items():
|
| 767 |
+
query_chunks.append(f"{qualifier}:{value}")
|
| 768 |
+
|
| 769 |
+
url_parameters["q"] = " ".join(query_chunks)
|
| 770 |
+
assert url_parameters["q"], "need at least one qualifier"
|
| 771 |
+
|
| 772 |
+
return PaginatedList(github.Issue.Issue, self.__requester, "/search/issues", url_parameters)
|
| 773 |
+
|
| 774 |
+
def search_code(
|
| 775 |
+
self,
|
| 776 |
+
query: str,
|
| 777 |
+
sort: Opt[str] = NotSet,
|
| 778 |
+
order: Opt[str] = NotSet,
|
| 779 |
+
highlight: bool = False,
|
| 780 |
+
**qualifiers: Any,
|
| 781 |
+
) -> PaginatedList[ContentFile]:
|
| 782 |
+
"""
|
| 783 |
+
:calls: `GET /search/code <https://docs.github.com/en/rest/reference/search>`_
|
| 784 |
+
:param query: string
|
| 785 |
+
:param sort: string ('indexed')
|
| 786 |
+
:param order: string ('asc', 'desc')
|
| 787 |
+
:param highlight: boolean (True, False)
|
| 788 |
+
:param qualifiers: keyword dict query qualifiers
|
| 789 |
+
:rtype: :class:`PaginatedList` of :class:`github.ContentFile.ContentFile`
|
| 790 |
+
"""
|
| 791 |
+
assert isinstance(query, str), query
|
| 792 |
+
url_parameters = dict()
|
| 793 |
+
if sort is not NotSet: # pragma no branch (Should be covered)
|
| 794 |
+
assert sort in ("indexed",), sort
|
| 795 |
+
url_parameters["sort"] = sort
|
| 796 |
+
if order is not NotSet: # pragma no branch (Should be covered)
|
| 797 |
+
assert order in ("asc", "desc"), order
|
| 798 |
+
url_parameters["order"] = order
|
| 799 |
+
|
| 800 |
+
query_chunks = []
|
| 801 |
+
if query: # pragma no branch (Should be covered)
|
| 802 |
+
query_chunks.append(query)
|
| 803 |
+
|
| 804 |
+
for qualifier, value in qualifiers.items():
|
| 805 |
+
query_chunks.append(f"{qualifier}:{value}")
|
| 806 |
+
|
| 807 |
+
url_parameters["q"] = " ".join(query_chunks)
|
| 808 |
+
assert url_parameters["q"], "need at least one qualifier"
|
| 809 |
+
|
| 810 |
+
headers = {"Accept": Consts.highLightSearchPreview} if highlight else None
|
| 811 |
+
|
| 812 |
+
return PaginatedList(
|
| 813 |
+
github.ContentFile.ContentFile,
|
| 814 |
+
self.__requester,
|
| 815 |
+
"/search/code",
|
| 816 |
+
url_parameters,
|
| 817 |
+
headers=headers,
|
| 818 |
+
)
|
| 819 |
+
|
| 820 |
+
def search_commits(
|
| 821 |
+
self,
|
| 822 |
+
query: str,
|
| 823 |
+
sort: Opt[str] = NotSet,
|
| 824 |
+
order: Opt[str] = NotSet,
|
| 825 |
+
**qualifiers: Any,
|
| 826 |
+
) -> PaginatedList[Commit]:
|
| 827 |
+
"""
|
| 828 |
+
:calls: `GET /search/commits <https://docs.github.com/en/rest/reference/search>`_
|
| 829 |
+
:param query: string
|
| 830 |
+
:param sort: string ('author-date', 'committer-date')
|
| 831 |
+
:param order: string ('asc', 'desc')
|
| 832 |
+
:param qualifiers: keyword dict query qualifiers
|
| 833 |
+
:rtype: :class:`PaginatedList` of :class:`github.Commit.Commit`
|
| 834 |
+
"""
|
| 835 |
+
assert isinstance(query, str), query
|
| 836 |
+
url_parameters = dict()
|
| 837 |
+
if sort is not NotSet:
|
| 838 |
+
assert sort in ("author-date", "committer-date"), sort
|
| 839 |
+
url_parameters["sort"] = sort
|
| 840 |
+
if order is not NotSet:
|
| 841 |
+
assert order in ("asc", "desc"), order
|
| 842 |
+
url_parameters["order"] = order
|
| 843 |
+
|
| 844 |
+
query_chunks = []
|
| 845 |
+
if query:
|
| 846 |
+
query_chunks.append(query)
|
| 847 |
+
|
| 848 |
+
for qualifier, value in qualifiers.items():
|
| 849 |
+
query_chunks.append(f"{qualifier}:{value}")
|
| 850 |
+
|
| 851 |
+
url_parameters["q"] = " ".join(query_chunks)
|
| 852 |
+
assert url_parameters["q"], "need at least one qualifier"
|
| 853 |
+
|
| 854 |
+
return PaginatedList(
|
| 855 |
+
github.Commit.Commit,
|
| 856 |
+
self.__requester,
|
| 857 |
+
"/search/commits",
|
| 858 |
+
url_parameters,
|
| 859 |
+
headers={"Accept": Consts.mediaTypeCommitSearchPreview},
|
| 860 |
+
)
|
| 861 |
+
|
| 862 |
+
def search_topics(self, query: str, **qualifiers: Any) -> PaginatedList[Topic]:
|
| 863 |
+
"""
|
| 864 |
+
:calls: `GET /search/topics <https://docs.github.com/en/rest/reference/search>`_
|
| 865 |
+
:param query: string
|
| 866 |
+
:param qualifiers: keyword dict query qualifiers
|
| 867 |
+
:rtype: :class:`PaginatedList` of :class:`github.Topic.Topic`
|
| 868 |
+
"""
|
| 869 |
+
assert isinstance(query, str), query
|
| 870 |
+
url_parameters = dict()
|
| 871 |
+
|
| 872 |
+
query_chunks = []
|
| 873 |
+
if query: # pragma no branch (Should be covered)
|
| 874 |
+
query_chunks.append(query)
|
| 875 |
+
|
| 876 |
+
for qualifier, value in qualifiers.items():
|
| 877 |
+
query_chunks.append(f"{qualifier}:{value}")
|
| 878 |
+
|
| 879 |
+
url_parameters["q"] = " ".join(query_chunks)
|
| 880 |
+
assert url_parameters["q"], "need at least one qualifier"
|
| 881 |
+
|
| 882 |
+
return PaginatedList(
|
| 883 |
+
github.Topic.Topic,
|
| 884 |
+
self.__requester,
|
| 885 |
+
"/search/topics",
|
| 886 |
+
url_parameters,
|
| 887 |
+
headers={"Accept": Consts.mediaTypeTopicsPreview},
|
| 888 |
+
)
|
| 889 |
+
|
| 890 |
+
def render_markdown(self, text: str, context: Opt[Repository] = NotSet) -> str:
|
| 891 |
+
"""
|
| 892 |
+
:calls: `POST /markdown <https://docs.github.com/en/rest/reference/markdown>`_
|
| 893 |
+
:param text: string
|
| 894 |
+
:param context: :class:`github.Repository.Repository`
|
| 895 |
+
:rtype: string
|
| 896 |
+
"""
|
| 897 |
+
assert isinstance(text, str), text
|
| 898 |
+
assert context is NotSet or isinstance(context, github.Repository.Repository), context
|
| 899 |
+
post_parameters = {"text": text}
|
| 900 |
+
if is_defined(context):
|
| 901 |
+
post_parameters["mode"] = "gfm"
|
| 902 |
+
post_parameters["context"] = context._identity
|
| 903 |
+
status, headers, data = self.__requester.requestJson("POST", "/markdown", input=post_parameters)
|
| 904 |
+
return data
|
| 905 |
+
|
| 906 |
+
def get_hook(self, name: str) -> HookDescription:
|
| 907 |
+
"""
|
| 908 |
+
:calls: `GET /hooks/{name} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 909 |
+
"""
|
| 910 |
+
assert isinstance(name, str), name
|
| 911 |
+
name = urllib.parse.quote(name)
|
| 912 |
+
headers, attributes = self.__requester.requestJsonAndCheck("GET", f"/hooks/{name}")
|
| 913 |
+
return HookDescription(self.__requester, headers, attributes)
|
| 914 |
+
|
| 915 |
+
def get_hooks(self) -> list[HookDescription]:
|
| 916 |
+
"""
|
| 917 |
+
:calls: `GET /hooks <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 918 |
+
:rtype: list of :class:`github.HookDescription.HookDescription`
|
| 919 |
+
"""
|
| 920 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", "/hooks")
|
| 921 |
+
return [HookDescription(self.__requester, headers, attributes) for attributes in data]
|
| 922 |
+
|
| 923 |
+
def get_hook_delivery(self, hook_id: int, delivery_id: int) -> HookDelivery:
|
| 924 |
+
"""
|
| 925 |
+
:calls: `GET /hooks/{hook_id}/deliveries/{delivery_id} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 926 |
+
:param hook_id: integer
|
| 927 |
+
:param delivery_id: integer
|
| 928 |
+
:rtype: :class:`HookDelivery`
|
| 929 |
+
"""
|
| 930 |
+
assert isinstance(hook_id, int), hook_id
|
| 931 |
+
assert isinstance(delivery_id, int), delivery_id
|
| 932 |
+
headers, attributes = self.__requester.requestJsonAndCheck("GET", f"/hooks/{hook_id}/deliveries/{delivery_id}")
|
| 933 |
+
return HookDelivery(self.__requester, headers, attributes)
|
| 934 |
+
|
| 935 |
+
def get_hook_deliveries(self, hook_id: int) -> list[HookDeliverySummary]:
|
| 936 |
+
"""
|
| 937 |
+
:calls: `GET /hooks/{hook_id}/deliveries <https://docs.github.com/en/rest/reference/repos#webhooks>`_
|
| 938 |
+
:param hook_id: integer
|
| 939 |
+
:rtype: list of :class:`HookDeliverySummary`
|
| 940 |
+
"""
|
| 941 |
+
assert isinstance(hook_id, int), hook_id
|
| 942 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", f"/hooks/{hook_id}/deliveries")
|
| 943 |
+
return [HookDeliverySummary(self.__requester, headers, attributes) for attributes in data]
|
| 944 |
+
|
| 945 |
+
def get_gitignore_templates(self) -> list[str]:
|
| 946 |
+
"""
|
| 947 |
+
:calls: `GET /gitignore/templates <https://docs.github.com/en/rest/reference/gitignore>`_
|
| 948 |
+
"""
|
| 949 |
+
headers, data = self.__requester.requestJsonAndCheck("GET", "/gitignore/templates")
|
| 950 |
+
return data
|
| 951 |
+
|
| 952 |
+
def get_gitignore_template(self, name: str) -> GitignoreTemplate:
|
| 953 |
+
"""
|
| 954 |
+
:calls: `GET /gitignore/templates/{name} <https://docs.github.com/en/rest/reference/gitignore>`_
|
| 955 |
+
"""
|
| 956 |
+
assert isinstance(name, str), name
|
| 957 |
+
name = urllib.parse.quote(name)
|
| 958 |
+
headers, attributes = self.__requester.requestJsonAndCheck("GET", f"/gitignore/templates/{name}")
|
| 959 |
+
return github.GitignoreTemplate.GitignoreTemplate(self.__requester, headers, attributes)
|
| 960 |
+
|
| 961 |
+
def get_emojis(self) -> dict[str, str]:
|
| 962 |
+
"""
|
| 963 |
+
:calls: `GET /emojis <https://docs.github.com/en/rest/reference/emojis>`_
|
| 964 |
+
:rtype: dictionary of type => url for emoji`
|
| 965 |
+
"""
|
| 966 |
+
headers, attributes = self.__requester.requestJsonAndCheck("GET", "/emojis")
|
| 967 |
+
return attributes
|
| 968 |
+
|
| 969 |
+
def create_from_raw_data(
|
| 970 |
+
self, klass: type[TGithubObject], raw_data: dict[str, Any], headers: dict[str, str | int] | None = None
|
| 971 |
+
) -> TGithubObject:
|
| 972 |
+
"""
|
| 973 |
+
Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, and optionally headers
|
| 974 |
+
previously obtained by :attr:`GithubObject.raw_headers`.
|
| 975 |
+
|
| 976 |
+
:param klass: the class of the object to create
|
| 977 |
+
:param raw_data: dict
|
| 978 |
+
:param headers: dict
|
| 979 |
+
:rtype: instance of class ``klass``
|
| 980 |
+
|
| 981 |
+
"""
|
| 982 |
+
if headers is None:
|
| 983 |
+
headers = {}
|
| 984 |
+
|
| 985 |
+
if issubclass(klass, CompletableGithubObject):
|
| 986 |
+
return klass(self.__requester, headers, raw_data, completed=True) # type: ignore
|
| 987 |
+
return klass(self.__requester, headers, raw_data)
|
| 988 |
+
|
| 989 |
+
def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None:
|
| 990 |
+
"""
|
| 991 |
+
Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive
|
| 992 |
+
information like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove
|
| 993 |
+
sensitive information from the object's attributes.
|
| 994 |
+
|
| 995 |
+
:param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the
|
| 996 |
+
`pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-stream-format>`_
|
| 997 |
+
:param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the
|
| 998 |
+
`pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 999 |
+
:param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the
|
| 1000 |
+
`pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 1001 |
+
stream-format>`_ :param obj: the object to pickle :param file: the file-like object to pickle to :param
|
| 1002 |
+
protocol: the
|
| 1003 |
+
`pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 1004 |
+
:param obj: the object to pickle
|
| 1005 |
+
:param file: the file-like object to pickle to
|
| 1006 |
+
:param protocol: the `pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 1007 |
+
stream-format>`_
|
| 1008 |
+
:param obj: the object to pickle
|
| 1009 |
+
:param file: the file-like object to pickle to
|
| 1010 |
+
:param protocol: the `pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 1011 |
+
:param obj: the object to pickle
|
| 1012 |
+
:param file: the file-like object to pickle to
|
| 1013 |
+
:param protocol: the `pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 1014 |
+
stream-format>`_
|
| 1015 |
+
:param obj: the object to pickle
|
| 1016 |
+
:param file: the file-like object to pickle to
|
| 1017 |
+
:param protocol: the `pickling protocol <https://python.readthedocs.io/en/latest/library/pickle.html#data-
|
| 1018 |
+
stream-format>`_
|
| 1019 |
+
|
| 1020 |
+
"""
|
| 1021 |
+
pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol)
|
| 1022 |
+
|
| 1023 |
+
def load(self, f: BinaryIO) -> Any:
|
| 1024 |
+
"""
|
| 1025 |
+
Loads (unpickles) a PyGithub object from a file-like object.
|
| 1026 |
+
|
| 1027 |
+
:param f: the file-like object to unpickle from
|
| 1028 |
+
:return: the unpickled object
|
| 1029 |
+
|
| 1030 |
+
"""
|
| 1031 |
+
return self.create_from_raw_data(*pickle.load(f))
|
| 1032 |
+
|
| 1033 |
+
def get_oauth_application(self, client_id: str, client_secret: str) -> ApplicationOAuth:
|
| 1034 |
+
return github.ApplicationOAuth.ApplicationOAuth(
|
| 1035 |
+
self.__requester,
|
| 1036 |
+
headers={},
|
| 1037 |
+
attributes={"client_id": client_id, "client_secret": client_secret},
|
| 1038 |
+
)
|
| 1039 |
+
|
| 1040 |
+
def get_app(self, slug: Opt[str] = NotSet) -> GithubApp:
|
| 1041 |
+
"""
|
| 1042 |
+
:calls: `GET /apps/{slug} <https://docs.github.com/en/rest/reference/apps>`_ or `GET /app <https://docs.github.com/en/rest/reference/apps>`_
|
| 1043 |
+
"""
|
| 1044 |
+
|
| 1045 |
+
if slug is NotSet:
|
| 1046 |
+
# with no slug given, calling /app returns the authenticated app,
|
| 1047 |
+
# including the actual /apps/{slug}
|
| 1048 |
+
warnings.warn(
|
| 1049 |
+
"Argument slug is mandatory, calling this method without the slug argument is deprecated, please use "
|
| 1050 |
+
"github.GithubIntegration(auth=github.Auth.AppAuth(...)).get_app() instead",
|
| 1051 |
+
category=DeprecationWarning,
|
| 1052 |
+
)
|
| 1053 |
+
return GithubIntegration(**self.__requester.kwargs).get_app()
|
| 1054 |
+
else:
|
| 1055 |
+
assert isinstance(slug, str), slug
|
| 1056 |
+
# with a slug given, we can lazily load the GithubApp
|
| 1057 |
+
slug = urllib.parse.quote(slug)
|
| 1058 |
+
return github.GithubApp.GithubApp(self.__requester, {}, {"url": f"/apps/{slug}"}, completed=False)
|
python_embeded/Lib/site-packages/github/Membership.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2015 Matt Babineau <mbabineau@dataxu.com> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Martijn Koster <mak-github@greenhills.co.uk> #
|
| 11 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2019 Pavan Kunisetty <nagapavan@users.noreply.github.com> #
|
| 15 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 17 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 19 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 20 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 23 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 25 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# #
|
| 27 |
+
# This file is part of PyGithub. #
|
| 28 |
+
# http://pygithub.readthedocs.io/ #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 31 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 32 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 33 |
+
# any later version. #
|
| 34 |
+
# #
|
| 35 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 36 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 37 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 38 |
+
# details. #
|
| 39 |
+
# #
|
| 40 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 41 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 42 |
+
# #
|
| 43 |
+
################################################################################
|
| 44 |
+
|
| 45 |
+
from __future__ import annotations
|
| 46 |
+
|
| 47 |
+
from typing import TYPE_CHECKING, Any
|
| 48 |
+
|
| 49 |
+
import github.NamedUser
|
| 50 |
+
import github.Organization
|
| 51 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 52 |
+
|
| 53 |
+
if TYPE_CHECKING:
|
| 54 |
+
from github.NamedUser import NamedUser
|
| 55 |
+
from github.Organization import Organization
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class Membership(CompletableGithubObject):
|
| 59 |
+
"""
|
| 60 |
+
This class represents Membership of an organization.
|
| 61 |
+
|
| 62 |
+
The reference can be found here
|
| 63 |
+
https://docs.github.com/en/rest/reference/orgs
|
| 64 |
+
|
| 65 |
+
The OpenAPI schema can be found at
|
| 66 |
+
- /components/schemas/org-membership
|
| 67 |
+
|
| 68 |
+
"""
|
| 69 |
+
|
| 70 |
+
def _initAttributes(self) -> None:
|
| 71 |
+
self._organization: Attribute[Organization] = NotSet
|
| 72 |
+
self._organization_url: Attribute[str] = NotSet
|
| 73 |
+
self._permissions: Attribute[dict[str, Any]] = NotSet
|
| 74 |
+
self._role: Attribute[str] = NotSet
|
| 75 |
+
self._state: Attribute[str] = NotSet
|
| 76 |
+
self._url: Attribute[str] = NotSet
|
| 77 |
+
self._user: Attribute[NamedUser] = NotSet
|
| 78 |
+
|
| 79 |
+
def __repr__(self) -> str:
|
| 80 |
+
return self.get__repr__({"url": self._url.value})
|
| 81 |
+
|
| 82 |
+
@property
|
| 83 |
+
def organization(self) -> Organization:
|
| 84 |
+
self._completeIfNotSet(self._organization)
|
| 85 |
+
return self._organization.value
|
| 86 |
+
|
| 87 |
+
@property
|
| 88 |
+
def organization_url(self) -> str:
|
| 89 |
+
self._completeIfNotSet(self._organization_url)
|
| 90 |
+
return self._organization_url.value
|
| 91 |
+
|
| 92 |
+
@property
|
| 93 |
+
def permissions(self) -> dict[str, Any]:
|
| 94 |
+
self._completeIfNotSet(self._permissions)
|
| 95 |
+
return self._permissions.value
|
| 96 |
+
|
| 97 |
+
@property
|
| 98 |
+
def role(self) -> str:
|
| 99 |
+
self._completeIfNotSet(self._role)
|
| 100 |
+
return self._role.value
|
| 101 |
+
|
| 102 |
+
@property
|
| 103 |
+
def state(self) -> str:
|
| 104 |
+
self._completeIfNotSet(self._state)
|
| 105 |
+
return self._state.value
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def url(self) -> str:
|
| 109 |
+
self._completeIfNotSet(self._url)
|
| 110 |
+
return self._url.value
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def user(self) -> NamedUser:
|
| 114 |
+
self._completeIfNotSet(self._user)
|
| 115 |
+
return self._user.value
|
| 116 |
+
|
| 117 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 118 |
+
if "organization" in attributes: # pragma no branch
|
| 119 |
+
self._organization = self._makeClassAttribute(github.Organization.Organization, attributes["organization"])
|
| 120 |
+
if "organization_url" in attributes: # pragma no branch
|
| 121 |
+
self._organization_url = self._makeStringAttribute(attributes["organization_url"])
|
| 122 |
+
if "permissions" in attributes: # pragma no branch
|
| 123 |
+
self._permissions = self._makeDictAttribute(attributes["permissions"])
|
| 124 |
+
if "role" in attributes: # pragma no branch
|
| 125 |
+
self._role = self._makeStringAttribute(attributes["role"])
|
| 126 |
+
if "state" in attributes: # pragma no branch
|
| 127 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 128 |
+
if "url" in attributes: # pragma no branch
|
| 129 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 130 |
+
if "user" in attributes: # pragma no branch
|
| 131 |
+
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
python_embeded/Lib/site-packages/github/MergedUpstream.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 4 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 5 |
+
# Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
|
| 6 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 7 |
+
# Copyright 2025 Mikhail f. Shiryaev <mr.felixoid@gmail.com> #
|
| 8 |
+
# #
|
| 9 |
+
# This file is part of PyGithub. #
|
| 10 |
+
# http://pygithub.readthedocs.io/ #
|
| 11 |
+
# #
|
| 12 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 13 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 14 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 15 |
+
# any later version. #
|
| 16 |
+
# #
|
| 17 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 18 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 19 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 20 |
+
# details. #
|
| 21 |
+
# #
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 23 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 24 |
+
# #
|
| 25 |
+
################################################################################
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
from typing import Any, Dict
|
| 29 |
+
|
| 30 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class MergedUpstream(NonCompletableGithubObject):
|
| 34 |
+
"""
|
| 35 |
+
This class represents a result of merge-upstream call.
|
| 36 |
+
|
| 37 |
+
The OpenAPI schema can be found at
|
| 38 |
+
- /components/schemas/merged-upstream
|
| 39 |
+
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
def _initAttributes(self) -> None:
|
| 43 |
+
self._merge_type: Attribute[str] = NotSet
|
| 44 |
+
self._base_branch: Attribute[str] = NotSet
|
| 45 |
+
self._message: Attribute[str] = NotSet
|
| 46 |
+
|
| 47 |
+
def __repr__(self) -> str:
|
| 48 |
+
return self.get__repr__({"message": self._message.value})
|
| 49 |
+
|
| 50 |
+
@property
|
| 51 |
+
def merge_type(self) -> str:
|
| 52 |
+
return self._merge_type.value
|
| 53 |
+
|
| 54 |
+
@property
|
| 55 |
+
def base_branch(self) -> str:
|
| 56 |
+
return self._base_branch.value
|
| 57 |
+
|
| 58 |
+
@property
|
| 59 |
+
def message(self) -> str:
|
| 60 |
+
return self._message.value
|
| 61 |
+
|
| 62 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 63 |
+
if "merge_type" in attributes: # pragma no branch
|
| 64 |
+
self._merge_type = self._makeStringAttribute(attributes["merge_type"])
|
| 65 |
+
if "base_branch" in attributes: # pragma no branch
|
| 66 |
+
self._base_branch = self._makeStringAttribute(attributes["base_branch"])
|
| 67 |
+
if "message" in attributes: # pragma no branch
|
| 68 |
+
self._message = self._makeStringAttribute(attributes["message"])
|
python_embeded/Lib/site-packages/github/Migration.py
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
| 12 |
+
# Copyright 2018 Shubham Singh <41840111+singh811@users.noreply.github.com> #
|
| 13 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
| 15 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 16 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 18 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 20 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 21 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 22 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2023 Mark Amery <markamery@btinternet.com> #
|
| 24 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 25 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 27 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 28 |
+
# #
|
| 29 |
+
# This file is part of PyGithub. #
|
| 30 |
+
# http://pygithub.readthedocs.io/ #
|
| 31 |
+
# #
|
| 32 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 33 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 34 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 35 |
+
# any later version. #
|
| 36 |
+
# #
|
| 37 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 38 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 39 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 40 |
+
# details. #
|
| 41 |
+
# #
|
| 42 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 43 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 44 |
+
# #
|
| 45 |
+
################################################################################
|
| 46 |
+
|
| 47 |
+
from __future__ import annotations
|
| 48 |
+
|
| 49 |
+
import urllib.parse
|
| 50 |
+
from datetime import datetime
|
| 51 |
+
from typing import Any
|
| 52 |
+
|
| 53 |
+
import github.GithubObject
|
| 54 |
+
import github.NamedUser
|
| 55 |
+
import github.PaginatedList
|
| 56 |
+
import github.Repository
|
| 57 |
+
from github import Consts
|
| 58 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class Migration(CompletableGithubObject):
|
| 62 |
+
"""
|
| 63 |
+
This class represents Migrations.
|
| 64 |
+
|
| 65 |
+
The reference can be found here
|
| 66 |
+
https://docs.github.com/en/rest/reference/migrations
|
| 67 |
+
|
| 68 |
+
The OpenAPI schema can be found at
|
| 69 |
+
- /components/schemas/migration
|
| 70 |
+
|
| 71 |
+
"""
|
| 72 |
+
|
| 73 |
+
def _initAttributes(self) -> None:
|
| 74 |
+
self._archive_url: Attribute[str] = NotSet
|
| 75 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 76 |
+
self._exclude: Attribute[list[str]] = NotSet
|
| 77 |
+
self._exclude_attachments: Attribute[bool] = NotSet
|
| 78 |
+
self._exclude_git_data: Attribute[bool] = NotSet
|
| 79 |
+
self._exclude_metadata: Attribute[bool] = NotSet
|
| 80 |
+
self._exclude_owner_projects: Attribute[bool] = NotSet
|
| 81 |
+
self._exclude_releases: Attribute[bool] = NotSet
|
| 82 |
+
self._guid: Attribute[str] = NotSet
|
| 83 |
+
self._id: Attribute[int] = NotSet
|
| 84 |
+
self._lock_repositories: Attribute[bool] = NotSet
|
| 85 |
+
self._node_id: Attribute[str] = NotSet
|
| 86 |
+
self._org_metadata_only: Attribute[bool] = NotSet
|
| 87 |
+
self._owner: Attribute[github.NamedUser.NamedUser] = NotSet
|
| 88 |
+
self._repositories: Attribute[list[github.Repository.Repository]] = NotSet
|
| 89 |
+
self._state: Attribute[str] = NotSet
|
| 90 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 91 |
+
self._url: Attribute[str] = NotSet
|
| 92 |
+
|
| 93 |
+
def __repr__(self) -> str:
|
| 94 |
+
return self.get__repr__({"state": self._state.value, "url": self._url.value})
|
| 95 |
+
|
| 96 |
+
@property
|
| 97 |
+
def archive_url(self) -> str:
|
| 98 |
+
self._completeIfNotSet(self._archive_url)
|
| 99 |
+
return self._archive_url.value
|
| 100 |
+
|
| 101 |
+
@property
|
| 102 |
+
def created_at(self) -> datetime:
|
| 103 |
+
self._completeIfNotSet(self._created_at)
|
| 104 |
+
return self._created_at.value
|
| 105 |
+
|
| 106 |
+
@property
|
| 107 |
+
def exclude(self) -> list[str]:
|
| 108 |
+
self._completeIfNotSet(self._exclude)
|
| 109 |
+
return self._exclude.value
|
| 110 |
+
|
| 111 |
+
@property
|
| 112 |
+
def exclude_attachments(self) -> bool:
|
| 113 |
+
self._completeIfNotSet(self._exclude_attachments)
|
| 114 |
+
return self._exclude_attachments.value
|
| 115 |
+
|
| 116 |
+
@property
|
| 117 |
+
def exclude_git_data(self) -> bool:
|
| 118 |
+
self._completeIfNotSet(self._exclude_git_data)
|
| 119 |
+
return self._exclude_git_data.value
|
| 120 |
+
|
| 121 |
+
@property
|
| 122 |
+
def exclude_metadata(self) -> bool:
|
| 123 |
+
self._completeIfNotSet(self._exclude_metadata)
|
| 124 |
+
return self._exclude_metadata.value
|
| 125 |
+
|
| 126 |
+
@property
|
| 127 |
+
def exclude_owner_projects(self) -> bool:
|
| 128 |
+
self._completeIfNotSet(self._exclude_owner_projects)
|
| 129 |
+
return self._exclude_owner_projects.value
|
| 130 |
+
|
| 131 |
+
@property
|
| 132 |
+
def exclude_releases(self) -> bool:
|
| 133 |
+
self._completeIfNotSet(self._exclude_releases)
|
| 134 |
+
return self._exclude_releases.value
|
| 135 |
+
|
| 136 |
+
@property
|
| 137 |
+
def guid(self) -> str:
|
| 138 |
+
self._completeIfNotSet(self._guid)
|
| 139 |
+
return self._guid.value
|
| 140 |
+
|
| 141 |
+
@property
|
| 142 |
+
def id(self) -> int:
|
| 143 |
+
return self._id.value
|
| 144 |
+
|
| 145 |
+
@property
|
| 146 |
+
def lock_repositories(self) -> bool:
|
| 147 |
+
self._completeIfNotSet(self._repositories)
|
| 148 |
+
return self._lock_repositories.value
|
| 149 |
+
|
| 150 |
+
@property
|
| 151 |
+
def node_id(self) -> str:
|
| 152 |
+
self._completeIfNotSet(self._node_id)
|
| 153 |
+
return self._node_id.value
|
| 154 |
+
|
| 155 |
+
@property
|
| 156 |
+
def org_metadata_only(self) -> bool:
|
| 157 |
+
self._completeIfNotSet(self._org_metadata_only)
|
| 158 |
+
return self._org_metadata_only.value
|
| 159 |
+
|
| 160 |
+
@property
|
| 161 |
+
def owner(self) -> github.NamedUser.NamedUser:
|
| 162 |
+
self._completeIfNotSet(self._owner)
|
| 163 |
+
return self._owner.value
|
| 164 |
+
|
| 165 |
+
@property
|
| 166 |
+
def repositories(self) -> list[github.Repository.Repository]:
|
| 167 |
+
self._completeIfNotSet(self._repositories)
|
| 168 |
+
return self._repositories.value
|
| 169 |
+
|
| 170 |
+
@property
|
| 171 |
+
def state(self) -> str:
|
| 172 |
+
self._completeIfNotSet(self._guid)
|
| 173 |
+
return self._state.value
|
| 174 |
+
|
| 175 |
+
@property
|
| 176 |
+
def updated_at(self) -> datetime:
|
| 177 |
+
self._completeIfNotSet(self._updated_at)
|
| 178 |
+
return self._updated_at.value
|
| 179 |
+
|
| 180 |
+
@property
|
| 181 |
+
def url(self) -> str:
|
| 182 |
+
self._completeIfNotSet(self._url)
|
| 183 |
+
return self._url.value
|
| 184 |
+
|
| 185 |
+
def get_status(self) -> str:
|
| 186 |
+
"""
|
| 187 |
+
:calls: `GET /user/migrations/{migration_id} <https://docs.github.com/en/rest/reference/migrations>`_
|
| 188 |
+
"""
|
| 189 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 190 |
+
"GET", self.url, headers={"Accept": Consts.mediaTypeMigrationPreview}
|
| 191 |
+
)
|
| 192 |
+
self._useAttributes(data)
|
| 193 |
+
return self.state
|
| 194 |
+
|
| 195 |
+
def get_archive_url(self) -> str:
|
| 196 |
+
"""
|
| 197 |
+
:calls: `GET /user/migrations/{migration_id}/archive <https://docs.github.com/en/rest/reference/migrations>`_
|
| 198 |
+
"""
|
| 199 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 200 |
+
"GET",
|
| 201 |
+
f"{self.url}/archive",
|
| 202 |
+
headers={"Accept": Consts.mediaTypeMigrationPreview},
|
| 203 |
+
)
|
| 204 |
+
return data["data"]
|
| 205 |
+
|
| 206 |
+
def delete(self) -> None:
|
| 207 |
+
"""
|
| 208 |
+
:calls: `DELETE /user/migrations/{migration_id}/archive <https://docs.github.com/en/rest/reference/migrations>`_
|
| 209 |
+
"""
|
| 210 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 211 |
+
"DELETE",
|
| 212 |
+
f"{self.url}/archive",
|
| 213 |
+
headers={"Accept": Consts.mediaTypeMigrationPreview},
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
def unlock_repo(self, repo_name: str) -> None:
|
| 217 |
+
"""
|
| 218 |
+
:calls: `DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock <https://docs.github.com/en/rest/reference/migrations>`_
|
| 219 |
+
"""
|
| 220 |
+
assert isinstance(repo_name, str), repo_name
|
| 221 |
+
repo_name = urllib.parse.quote(repo_name)
|
| 222 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 223 |
+
"DELETE",
|
| 224 |
+
f"{self.url}/repos/{repo_name}/lock",
|
| 225 |
+
headers={"Accept": Consts.mediaTypeMigrationPreview},
|
| 226 |
+
)
|
| 227 |
+
|
| 228 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 229 |
+
if "archive_url" in attributes: # pragma no branch
|
| 230 |
+
self._archive_url = self._makeStringAttribute(attributes["archive_url"])
|
| 231 |
+
if "created_at" in attributes:
|
| 232 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 233 |
+
if "exclude" in attributes: # pragma no branch
|
| 234 |
+
self._exclude = self._makeListOfStringsAttribute(attributes["exclude"])
|
| 235 |
+
if "exclude_attachments" in attributes:
|
| 236 |
+
self._exclude_attachments = self._makeBoolAttribute(attributes["exclude_attachments"])
|
| 237 |
+
if "exclude_git_data" in attributes: # pragma no branch
|
| 238 |
+
self._exclude_git_data = self._makeBoolAttribute(attributes["exclude_git_data"])
|
| 239 |
+
if "exclude_metadata" in attributes: # pragma no branch
|
| 240 |
+
self._exclude_metadata = self._makeBoolAttribute(attributes["exclude_metadata"])
|
| 241 |
+
if "exclude_owner_projects" in attributes: # pragma no branch
|
| 242 |
+
self._exclude_owner_projects = self._makeBoolAttribute(attributes["exclude_owner_projects"])
|
| 243 |
+
if "exclude_releases" in attributes: # pragma no branch
|
| 244 |
+
self._exclude_releases = self._makeBoolAttribute(attributes["exclude_releases"])
|
| 245 |
+
if "guid" in attributes:
|
| 246 |
+
self._guid = self._makeStringAttribute(attributes["guid"])
|
| 247 |
+
if "id" in attributes:
|
| 248 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 249 |
+
if "lock_repositories" in attributes:
|
| 250 |
+
self._lock_repositories = self._makeBoolAttribute(attributes["lock_repositories"])
|
| 251 |
+
if "node_id" in attributes: # pragma no branch
|
| 252 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 253 |
+
if "org_metadata_only" in attributes: # pragma no branch
|
| 254 |
+
self._org_metadata_only = self._makeBoolAttribute(attributes["org_metadata_only"])
|
| 255 |
+
if "owner" in attributes:
|
| 256 |
+
self._owner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
|
| 257 |
+
if "repositories" in attributes:
|
| 258 |
+
self._repositories = self._makeListOfClassesAttribute(
|
| 259 |
+
github.Repository.Repository, attributes["repositories"]
|
| 260 |
+
)
|
| 261 |
+
if "state" in attributes:
|
| 262 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 263 |
+
if "updated_at" in attributes:
|
| 264 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 265 |
+
if "url" in attributes:
|
| 266 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/Milestone.py
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 8 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2018 Michell Stuttgart <michellstut@gmail.com> #
|
| 12 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 17 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 21 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 22 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# #
|
| 25 |
+
# This file is part of PyGithub. #
|
| 26 |
+
# http://pygithub.readthedocs.io/ #
|
| 27 |
+
# #
|
| 28 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 29 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 30 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 31 |
+
# any later version. #
|
| 32 |
+
# #
|
| 33 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 34 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 35 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 36 |
+
# details. #
|
| 37 |
+
# #
|
| 38 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 39 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 40 |
+
# #
|
| 41 |
+
################################################################################
|
| 42 |
+
|
| 43 |
+
from __future__ import annotations
|
| 44 |
+
|
| 45 |
+
from datetime import date, datetime
|
| 46 |
+
from typing import Any
|
| 47 |
+
|
| 48 |
+
import github.GithubObject
|
| 49 |
+
import github.Label
|
| 50 |
+
import github.NamedUser
|
| 51 |
+
import github.PaginatedList
|
| 52 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt, is_defined
|
| 53 |
+
from github.PaginatedList import PaginatedList
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class Milestone(CompletableGithubObject):
|
| 57 |
+
"""
|
| 58 |
+
This class represents Milestones.
|
| 59 |
+
|
| 60 |
+
The reference can be found here
|
| 61 |
+
https://docs.github.com/en/rest/reference/issues#milestones
|
| 62 |
+
|
| 63 |
+
The OpenAPI schema can be found at
|
| 64 |
+
- /components/schemas/issue-event-milestone
|
| 65 |
+
- /components/schemas/milestone
|
| 66 |
+
- /components/schemas/nullable-milestone
|
| 67 |
+
|
| 68 |
+
"""
|
| 69 |
+
|
| 70 |
+
def _initAttributes(self) -> None:
|
| 71 |
+
self._closed_at: Attribute[datetime] = NotSet
|
| 72 |
+
self._closed_issues: Attribute[int] = NotSet
|
| 73 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 74 |
+
self._creator: Attribute[github.NamedUser.NamedUser] = NotSet
|
| 75 |
+
self._description: Attribute[str] = NotSet
|
| 76 |
+
self._due_on: Attribute[datetime] = NotSet
|
| 77 |
+
self._html_url: Attribute[str] = NotSet
|
| 78 |
+
self._id: Attribute[int] = NotSet
|
| 79 |
+
self._labels_url: Attribute[str] = NotSet
|
| 80 |
+
self._node_id: Attribute[str] = NotSet
|
| 81 |
+
self._number: Attribute[int] = NotSet
|
| 82 |
+
self._open_issues: Attribute[int] = NotSet
|
| 83 |
+
self._state: Attribute[str] = NotSet
|
| 84 |
+
self._title: Attribute[str] = NotSet
|
| 85 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 86 |
+
self._url: Attribute[str] = NotSet
|
| 87 |
+
|
| 88 |
+
def __repr__(self) -> str:
|
| 89 |
+
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
| 90 |
+
|
| 91 |
+
@property
|
| 92 |
+
def _identity(self) -> int:
|
| 93 |
+
return self.number
|
| 94 |
+
|
| 95 |
+
@property
|
| 96 |
+
def closed_at(self) -> datetime:
|
| 97 |
+
self._completeIfNotSet(self._closed_at)
|
| 98 |
+
return self._closed_at.value
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def closed_issues(self) -> int:
|
| 102 |
+
self._completeIfNotSet(self._closed_issues)
|
| 103 |
+
return self._closed_issues.value
|
| 104 |
+
|
| 105 |
+
@property
|
| 106 |
+
def created_at(self) -> datetime:
|
| 107 |
+
self._completeIfNotSet(self._created_at)
|
| 108 |
+
return self._created_at.value
|
| 109 |
+
|
| 110 |
+
@property
|
| 111 |
+
def creator(self) -> github.NamedUser.NamedUser:
|
| 112 |
+
self._completeIfNotSet(self._creator)
|
| 113 |
+
return self._creator.value
|
| 114 |
+
|
| 115 |
+
@property
|
| 116 |
+
def description(self) -> str:
|
| 117 |
+
self._completeIfNotSet(self._description)
|
| 118 |
+
return self._description.value
|
| 119 |
+
|
| 120 |
+
@property
|
| 121 |
+
def due_on(self) -> datetime | None:
|
| 122 |
+
self._completeIfNotSet(self._due_on)
|
| 123 |
+
return self._due_on.value
|
| 124 |
+
|
| 125 |
+
@property
|
| 126 |
+
def html_url(self) -> str:
|
| 127 |
+
self._completeIfNotSet(self._html_url)
|
| 128 |
+
return self._html_url.value
|
| 129 |
+
|
| 130 |
+
@property
|
| 131 |
+
def id(self) -> int:
|
| 132 |
+
self._completeIfNotSet(self._id)
|
| 133 |
+
return self._id.value
|
| 134 |
+
|
| 135 |
+
@property
|
| 136 |
+
def labels_url(self) -> str:
|
| 137 |
+
self._completeIfNotSet(self._labels_url)
|
| 138 |
+
return self._labels_url.value
|
| 139 |
+
|
| 140 |
+
@property
|
| 141 |
+
def node_id(self) -> str:
|
| 142 |
+
self._completeIfNotSet(self._node_id)
|
| 143 |
+
return self._node_id.value
|
| 144 |
+
|
| 145 |
+
@property
|
| 146 |
+
def number(self) -> int:
|
| 147 |
+
self._completeIfNotSet(self._number)
|
| 148 |
+
return self._number.value
|
| 149 |
+
|
| 150 |
+
@property
|
| 151 |
+
def open_issues(self) -> int:
|
| 152 |
+
self._completeIfNotSet(self._open_issues)
|
| 153 |
+
return self._open_issues.value
|
| 154 |
+
|
| 155 |
+
@property
|
| 156 |
+
def state(self) -> str:
|
| 157 |
+
self._completeIfNotSet(self._state)
|
| 158 |
+
return self._state.value
|
| 159 |
+
|
| 160 |
+
@property
|
| 161 |
+
def title(self) -> str:
|
| 162 |
+
self._completeIfNotSet(self._title)
|
| 163 |
+
return self._title.value
|
| 164 |
+
|
| 165 |
+
@property
|
| 166 |
+
def updated_at(self) -> datetime:
|
| 167 |
+
self._completeIfNotSet(self._updated_at)
|
| 168 |
+
return self._updated_at.value
|
| 169 |
+
|
| 170 |
+
@property
|
| 171 |
+
def url(self) -> str:
|
| 172 |
+
self._completeIfNotSet(self._url)
|
| 173 |
+
return self._url.value
|
| 174 |
+
|
| 175 |
+
def delete(self) -> None:
|
| 176 |
+
"""
|
| 177 |
+
:calls: `DELETE /repos/{owner}/{repo}/milestones/{number} <https://docs.github.com/en/rest/reference/issues#milestones>`_
|
| 178 |
+
"""
|
| 179 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
|
| 180 |
+
|
| 181 |
+
def edit(
|
| 182 |
+
self, title: str, state: Opt[str] = NotSet, description: Opt[str] = NotSet, due_on: Opt[date] = NotSet
|
| 183 |
+
) -> None:
|
| 184 |
+
"""
|
| 185 |
+
:calls: `PATCH /repos/{owner}/{repo}/milestones/{number} <https://docs.github.com/en/rest/reference/issues#milestones>`_
|
| 186 |
+
"""
|
| 187 |
+
assert isinstance(title, str), title
|
| 188 |
+
assert state is NotSet or isinstance(state, str), state
|
| 189 |
+
assert description is NotSet or isinstance(description, str), description
|
| 190 |
+
assert due_on is NotSet or isinstance(due_on, date), due_on
|
| 191 |
+
post_parameters = NotSet.remove_unset_items(
|
| 192 |
+
{
|
| 193 |
+
"title": title,
|
| 194 |
+
"state": state,
|
| 195 |
+
"description": description,
|
| 196 |
+
}
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
if is_defined(due_on):
|
| 200 |
+
post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
|
| 201 |
+
|
| 202 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 203 |
+
self._useAttributes(data)
|
| 204 |
+
|
| 205 |
+
def get_labels(self) -> PaginatedList[github.Label.Label]:
|
| 206 |
+
"""
|
| 207 |
+
:calls: `GET /repos/{owner}/{repo}/milestones/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 208 |
+
"""
|
| 209 |
+
return PaginatedList(github.Label.Label, self._requester, f"{self.url}/labels", None)
|
| 210 |
+
|
| 211 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 212 |
+
if "closed_at" in attributes: # pragma no branch
|
| 213 |
+
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
| 214 |
+
if "closed_issues" in attributes: # pragma no branch
|
| 215 |
+
self._closed_issues = self._makeIntAttribute(attributes["closed_issues"])
|
| 216 |
+
if "created_at" in attributes: # pragma no branch
|
| 217 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 218 |
+
if "creator" in attributes: # pragma no branch
|
| 219 |
+
self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
|
| 220 |
+
if "description" in attributes: # pragma no branch
|
| 221 |
+
self._description = self._makeStringAttribute(attributes["description"])
|
| 222 |
+
if "due_on" in attributes: # pragma no branch
|
| 223 |
+
self._due_on = self._makeDatetimeAttribute(attributes["due_on"])
|
| 224 |
+
if "html_url" in attributes: # pragma no branch
|
| 225 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 226 |
+
if "id" in attributes: # pragma no branch
|
| 227 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 228 |
+
if "labels_url" in attributes: # pragma no branch
|
| 229 |
+
self._labels_url = self._makeStringAttribute(attributes["labels_url"])
|
| 230 |
+
if "node_id" in attributes: # pragma no branch
|
| 231 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 232 |
+
if "number" in attributes: # pragma no branch
|
| 233 |
+
self._number = self._makeIntAttribute(attributes["number"])
|
| 234 |
+
if "open_issues" in attributes: # pragma no branch
|
| 235 |
+
self._open_issues = self._makeIntAttribute(attributes["open_issues"])
|
| 236 |
+
if "state" in attributes: # pragma no branch
|
| 237 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 238 |
+
if "title" in attributes: # pragma no branch
|
| 239 |
+
self._title = self._makeStringAttribute(attributes["title"])
|
| 240 |
+
if "updated_at" in attributes: # pragma no branch
|
| 241 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 242 |
+
if "url" in attributes: # pragma no branch
|
| 243 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 4 |
+
# Copyright 2023 YugoHino <henom06@gmail.com> #
|
| 5 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 6 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 7 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 8 |
+
# #
|
| 9 |
+
# This file is part of PyGithub. #
|
| 10 |
+
# http://pygithub.readthedocs.io/ #
|
| 11 |
+
# #
|
| 12 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 13 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 14 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 15 |
+
# any later version. #
|
| 16 |
+
# #
|
| 17 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 18 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 19 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 20 |
+
# details. #
|
| 21 |
+
# #
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 23 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 24 |
+
# #
|
| 25 |
+
################################################################################
|
| 26 |
+
|
| 27 |
+
from typing import Any, Dict
|
| 28 |
+
|
| 29 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class NamedEnterpriseUser(CompletableGithubObject):
|
| 33 |
+
"""
|
| 34 |
+
This class represents NamedEnterpriseUsers.
|
| 35 |
+
|
| 36 |
+
The reference can be found here
|
| 37 |
+
https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses
|
| 38 |
+
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
def _initAttributes(self) -> None:
|
| 42 |
+
self._enterprise_server_primary_emails: Attribute[list] = NotSet
|
| 43 |
+
self._enterprise_server_user: Attribute[bool] = NotSet
|
| 44 |
+
self._enterprise_server_user_ids: Attribute[list] = NotSet
|
| 45 |
+
self._github_com_enterprise_roles: Attribute[list] = NotSet
|
| 46 |
+
self._github_com_login: Attribute[str] = NotSet
|
| 47 |
+
self._github_com_member_roles: Attribute[list] = NotSet
|
| 48 |
+
self._github_com_name: Attribute[str] = NotSet
|
| 49 |
+
self._github_com_orgs_with_pending_invites: Attribute[list] = NotSet
|
| 50 |
+
self._github_com_profile: Attribute[str] = NotSet
|
| 51 |
+
self._github_com_saml_name_id: Attribute[str] = NotSet
|
| 52 |
+
self._github_com_two_factor_auth: Attribute[bool] = NotSet
|
| 53 |
+
self._github_com_user: Attribute[bool] = NotSet
|
| 54 |
+
self._github_com_verified_domain_emails: Attribute[list] = NotSet
|
| 55 |
+
self._license_type: Attribute[str] = NotSet
|
| 56 |
+
self._total_user_accounts: Attribute[int] = NotSet
|
| 57 |
+
self._visual_studio_license_status: Attribute[str] = NotSet
|
| 58 |
+
self._visual_studio_subscription_email: Attribute[str] = NotSet
|
| 59 |
+
self._visual_studio_subscription_user: Attribute[bool] = NotSet
|
| 60 |
+
|
| 61 |
+
def __repr__(self) -> str:
|
| 62 |
+
return self.get__repr__({"login": self._github_com_login.value})
|
| 63 |
+
|
| 64 |
+
@property
|
| 65 |
+
def enterprise_server_primary_emails(self) -> list:
|
| 66 |
+
self._completeIfNotSet(self._enterprise_server_primary_emails)
|
| 67 |
+
return self._enterprise_server_primary_emails.value
|
| 68 |
+
|
| 69 |
+
@property
|
| 70 |
+
def enterprise_server_user(self) -> bool:
|
| 71 |
+
self._completeIfNotSet(self._enterprise_server_user)
|
| 72 |
+
return self._enterprise_server_user.value
|
| 73 |
+
|
| 74 |
+
@property
|
| 75 |
+
def enterprise_server_user_ids(self) -> list:
|
| 76 |
+
self._completeIfNotSet(self._enterprise_server_user_ids)
|
| 77 |
+
return self._enterprise_server_user_ids.value
|
| 78 |
+
|
| 79 |
+
@property
|
| 80 |
+
def github_com_enterprise_roles(self) -> list:
|
| 81 |
+
self._completeIfNotSet(self._github_com_enterprise_roles)
|
| 82 |
+
return self._github_com_enterprise_roles.value
|
| 83 |
+
|
| 84 |
+
@property
|
| 85 |
+
def github_com_login(self) -> str:
|
| 86 |
+
self._completeIfNotSet(self._github_com_login)
|
| 87 |
+
return self._github_com_login.value
|
| 88 |
+
|
| 89 |
+
@property
|
| 90 |
+
def github_com_member_roles(self) -> list:
|
| 91 |
+
self._completeIfNotSet(self._github_com_member_roles)
|
| 92 |
+
return self._github_com_member_roles.value
|
| 93 |
+
|
| 94 |
+
@property
|
| 95 |
+
def github_com_name(self) -> str:
|
| 96 |
+
self._completeIfNotSet(self._github_com_name)
|
| 97 |
+
return self._github_com_name.value
|
| 98 |
+
|
| 99 |
+
@property
|
| 100 |
+
def github_com_orgs_with_pending_invites(self) -> list:
|
| 101 |
+
self._completeIfNotSet(self._github_com_orgs_with_pending_invites)
|
| 102 |
+
return self._github_com_orgs_with_pending_invites.value
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def github_com_profile(self) -> str:
|
| 106 |
+
self._completeIfNotSet(self._github_com_profile)
|
| 107 |
+
return self._github_com_profile.value
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def github_com_saml_name_id(self) -> str:
|
| 111 |
+
self._completeIfNotSet(self._github_com_saml_name_id)
|
| 112 |
+
return self._github_com_saml_name_id.value
|
| 113 |
+
|
| 114 |
+
@property
|
| 115 |
+
def github_com_two_factor_auth(self) -> bool:
|
| 116 |
+
self._completeIfNotSet(self._github_com_two_factor_auth)
|
| 117 |
+
return self._github_com_two_factor_auth.value
|
| 118 |
+
|
| 119 |
+
@property
|
| 120 |
+
def github_com_user(self) -> bool:
|
| 121 |
+
self._completeIfNotSet(self._github_com_user)
|
| 122 |
+
return self._github_com_user.value
|
| 123 |
+
|
| 124 |
+
@property
|
| 125 |
+
def github_com_verified_domain_emails(self) -> list:
|
| 126 |
+
self._completeIfNotSet(self._github_com_verified_domain_emails)
|
| 127 |
+
return self._github_com_verified_domain_emails.value
|
| 128 |
+
|
| 129 |
+
@property
|
| 130 |
+
def license_type(self) -> str:
|
| 131 |
+
self._completeIfNotSet(self._license_type)
|
| 132 |
+
return self._license_type.value
|
| 133 |
+
|
| 134 |
+
@property
|
| 135 |
+
def total_user_accounts(self) -> int:
|
| 136 |
+
self._completeIfNotSet(self._total_user_accounts)
|
| 137 |
+
return self._total_user_accounts.value
|
| 138 |
+
|
| 139 |
+
@property
|
| 140 |
+
def visual_studio_license_status(self) -> str:
|
| 141 |
+
self._completeIfNotSet(self._visual_studio_license_status)
|
| 142 |
+
return self._visual_studio_license_status.value
|
| 143 |
+
|
| 144 |
+
@property
|
| 145 |
+
def visual_studio_subscription_email(self) -> str:
|
| 146 |
+
self._completeIfNotSet(self._visual_studio_subscription_email)
|
| 147 |
+
return self._visual_studio_subscription_email.value
|
| 148 |
+
|
| 149 |
+
@property
|
| 150 |
+
def visual_studio_subscription_user(self) -> bool:
|
| 151 |
+
self._completeIfNotSet(self._visual_studio_subscription_user)
|
| 152 |
+
return self._visual_studio_subscription_user.value
|
| 153 |
+
|
| 154 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 155 |
+
if "enterprise_server_primary_emails" in attributes: # pragma no branch
|
| 156 |
+
self._enterprise_server_primary_emails = self._makeListOfStringsAttribute(
|
| 157 |
+
attributes["enterprise_server_primary_emails"]
|
| 158 |
+
)
|
| 159 |
+
if "enterprise_server_user" in attributes: # pragma no branch
|
| 160 |
+
self._enterprise_server_user = self._makeBoolAttribute(attributes["enterprise_server_user"])
|
| 161 |
+
if "enterprise_server_user_ids" in attributes: # pragma no branch
|
| 162 |
+
self._enterprise_server_user_ids = self._makeListOfStringsAttribute(
|
| 163 |
+
attributes["enterprise_server_user_ids"]
|
| 164 |
+
)
|
| 165 |
+
if "github_com_enterprise_roles" in attributes: # pragma no branch
|
| 166 |
+
self._github_com_enterprise_roles = self._makeListOfStringsAttribute(
|
| 167 |
+
attributes["github_com_enterprise_roles"]
|
| 168 |
+
)
|
| 169 |
+
if "github_com_login" in attributes: # pragma no branch
|
| 170 |
+
self._github_com_login = self._makeStringAttribute(attributes["github_com_login"])
|
| 171 |
+
if "github_com_member_roles" in attributes: # pragma no branch
|
| 172 |
+
self._github_com_member_roles = self._makeListOfStringsAttribute(attributes["github_com_member_roles"])
|
| 173 |
+
if "github_com_name" in attributes: # pragma no branch
|
| 174 |
+
self._github_com_name = self._makeStringAttribute(attributes["github_com_name"])
|
| 175 |
+
if "github_com_orgs_with_pending_invites" in attributes: # pragma no branch
|
| 176 |
+
self._github_com_orgs_with_pending_invites = self._makeListOfStringsAttribute(
|
| 177 |
+
attributes["github_com_orgs_with_pending_invites"]
|
| 178 |
+
)
|
| 179 |
+
if "github_com_profile" in attributes: # pragma no branch
|
| 180 |
+
self._github_com_profile = self._makeStringAttribute(attributes["github_com_profile"])
|
| 181 |
+
if "github_com_saml_name_id" in attributes: # pragma no branch
|
| 182 |
+
self._github_com_saml_name_id = self._makeStringAttribute(attributes["github_com_saml_name_id"])
|
| 183 |
+
if "github_com_two_factor_auth" in attributes: # pragma no branch
|
| 184 |
+
self._github_com_two_factor_auth = self._makeBoolAttribute(attributes["github_com_two_factor_auth"])
|
| 185 |
+
if "github_com_user" in attributes: # pragma no branch
|
| 186 |
+
self._github_com_user = self._makeBoolAttribute(attributes["github_com_user"])
|
| 187 |
+
if "github_com_verified_domain_emails" in attributes: # pragma no branch
|
| 188 |
+
self._github_com_verified_domain_emails = self._makeListOfStringsAttribute(
|
| 189 |
+
attributes["github_com_verified_domain_emails"]
|
| 190 |
+
)
|
| 191 |
+
if "license_type" in attributes: # pragma no branch
|
| 192 |
+
self._license_type = self._makeStringAttribute(attributes["license_type"])
|
| 193 |
+
if "total_user_accounts" in attributes: # pragma no branch
|
| 194 |
+
self._total_user_accounts = self._makeIntAttribute(attributes["total_user_accounts"])
|
| 195 |
+
if "visual_studio_license_status" in attributes: # pragma no branch
|
| 196 |
+
self._visual_studio_license_status = self._makeStringAttribute(attributes["visual_studio_license_status"])
|
| 197 |
+
if "visual_studio_subscription_email" in attributes: # pragma no branch
|
| 198 |
+
self._visual_studio_subscription_email = self._makeStringAttribute(
|
| 199 |
+
attributes["visual_studio_subscription_email"]
|
| 200 |
+
)
|
| 201 |
+
if "visual_studio_subscription_user" in attributes: # pragma no branch
|
| 202 |
+
self._visual_studio_subscription_user = self._makeBoolAttribute(
|
| 203 |
+
attributes["visual_studio_subscription_user"]
|
| 204 |
+
)
|
python_embeded/Lib/site-packages/github/NamedUser.py
ADDED
|
@@ -0,0 +1,693 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
| 4 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 5 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 6 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 12 |
+
# Copyright 2018 Bruce Richardson <itsbruce@workshy.org> #
|
| 13 |
+
# Copyright 2018 Iraquitan Cordeiro Filho <iraquitanfilho@gmail.com> #
|
| 14 |
+
# Copyright 2018 Riccardo Pittau <elfosardo@users.noreply.github.com> #
|
| 15 |
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2018 Victor Granic <vmg@boreal321.com> #
|
| 17 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 18 |
+
# Copyright 2018 namc <namratachaudhary@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 20 |
+
# Copyright 2019 Pavan Kunisetty <nagapavan@users.noreply.github.com> #
|
| 21 |
+
# Copyright 2019 Shibasis Patel <smartshibasish@gmail.com> #
|
| 22 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 23 |
+
# Copyright 2019 Surya Teja <94suryateja@gmail.com> #
|
| 24 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 25 |
+
# Copyright 2020 Anuj Bansal <bansalanuj1996@gmail.com> #
|
| 26 |
+
# Copyright 2020 Daniel Haas <thisisdhaas@gmail.com> #
|
| 27 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 28 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 29 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 30 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 31 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 32 |
+
# Copyright 2023 Mark Amery <markamery@btinternet.com> #
|
| 33 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 34 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 35 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 36 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 37 |
+
# #
|
| 38 |
+
# This file is part of PyGithub. #
|
| 39 |
+
# http://pygithub.readthedocs.io/ #
|
| 40 |
+
# #
|
| 41 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 42 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 43 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 44 |
+
# any later version. #
|
| 45 |
+
# #
|
| 46 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 47 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 48 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 49 |
+
# details. #
|
| 50 |
+
# #
|
| 51 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 52 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 53 |
+
# #
|
| 54 |
+
################################################################################
|
| 55 |
+
|
| 56 |
+
from __future__ import annotations
|
| 57 |
+
|
| 58 |
+
import urllib.parse
|
| 59 |
+
from datetime import datetime
|
| 60 |
+
from typing import TYPE_CHECKING, Any
|
| 61 |
+
|
| 62 |
+
import github.Event
|
| 63 |
+
import github.Gist
|
| 64 |
+
import github.GithubObject
|
| 65 |
+
import github.Organization
|
| 66 |
+
import github.PaginatedList
|
| 67 |
+
import github.Permissions
|
| 68 |
+
import github.Plan
|
| 69 |
+
import github.Repository
|
| 70 |
+
from github import Consts
|
| 71 |
+
from github.GithubObject import Attribute, NotSet, Opt, is_defined
|
| 72 |
+
from github.PaginatedList import PaginatedList
|
| 73 |
+
|
| 74 |
+
if TYPE_CHECKING:
|
| 75 |
+
from github.Event import Event
|
| 76 |
+
from github.Gist import Gist
|
| 77 |
+
from github.Membership import Membership
|
| 78 |
+
from github.Organization import Organization
|
| 79 |
+
from github.Permissions import Permissions
|
| 80 |
+
from github.Plan import Plan
|
| 81 |
+
from github.Project import Project
|
| 82 |
+
from github.Repository import Repository
|
| 83 |
+
from github.UserKey import UserKey
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class NamedUser(github.GithubObject.CompletableGithubObject):
|
| 87 |
+
"""
|
| 88 |
+
This class represents NamedUsers.
|
| 89 |
+
|
| 90 |
+
The reference can be found here
|
| 91 |
+
https://docs.github.com/en/rest/reference/users#get-a-user
|
| 92 |
+
|
| 93 |
+
The OpenAPI schema can be found at
|
| 94 |
+
- /components/schemas/actor
|
| 95 |
+
- /components/schemas/collaborator
|
| 96 |
+
- /components/schemas/contributor
|
| 97 |
+
- /components/schemas/nullable-simple-user
|
| 98 |
+
- /components/schemas/public-user
|
| 99 |
+
- /components/schemas/simple-user
|
| 100 |
+
- /components/schemas/user-search-result-item
|
| 101 |
+
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
def _initAttributes(self) -> None:
|
| 105 |
+
self._avatar_url: Attribute[str] = NotSet
|
| 106 |
+
self._bio: Attribute[str | None] = NotSet
|
| 107 |
+
self._blog: Attribute[str | None] = NotSet
|
| 108 |
+
self._collaborators: Attribute[int] = NotSet
|
| 109 |
+
self._company: Attribute[str | None] = NotSet
|
| 110 |
+
self._contributions: Attribute[int] = NotSet
|
| 111 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 112 |
+
self._disk_usage: Attribute[int] = NotSet
|
| 113 |
+
self._display_login: Attribute[str] = NotSet
|
| 114 |
+
self._email: Attribute[str | None] = NotSet
|
| 115 |
+
self._events_url: Attribute[str] = NotSet
|
| 116 |
+
self._followers: Attribute[int] = NotSet
|
| 117 |
+
self._followers_url: Attribute[str] = NotSet
|
| 118 |
+
self._following: Attribute[int] = NotSet
|
| 119 |
+
self._following_url: Attribute[str] = NotSet
|
| 120 |
+
self._gists_url: Attribute[str] = NotSet
|
| 121 |
+
self._gravatar_id: Attribute[str | None] = NotSet
|
| 122 |
+
self._hireable: Attribute[bool | None] = NotSet
|
| 123 |
+
self._html_url: Attribute[str] = NotSet
|
| 124 |
+
self._id: Attribute[int] = NotSet
|
| 125 |
+
self._invitation_teams_url: Attribute[str] = NotSet
|
| 126 |
+
self._inviter: Attribute[NamedUser] = NotSet
|
| 127 |
+
self._location: Attribute[str | None] = NotSet
|
| 128 |
+
self._login: Attribute[str] = NotSet
|
| 129 |
+
self._name: Attribute[str] = NotSet
|
| 130 |
+
self._node_id: Attribute[str] = NotSet
|
| 131 |
+
self._notification_email: Attribute[str] = NotSet
|
| 132 |
+
self._organizations_url: Attribute[str] = NotSet
|
| 133 |
+
self._owned_private_repos: Attribute[int] = NotSet
|
| 134 |
+
self._permissions: Attribute[Permissions] = NotSet
|
| 135 |
+
self._plan: Attribute[Plan] = NotSet
|
| 136 |
+
self._private_gists: Attribute[int] = NotSet
|
| 137 |
+
self._public_gists: Attribute[int] = NotSet
|
| 138 |
+
self._public_repos: Attribute[int] = NotSet
|
| 139 |
+
self._received_events_url: Attribute[str] = NotSet
|
| 140 |
+
self._repos_url: Attribute[str] = NotSet
|
| 141 |
+
self._role: Attribute[str] = NotSet
|
| 142 |
+
self._role_name: Attribute[str] = NotSet
|
| 143 |
+
self._score: Attribute[float] = NotSet
|
| 144 |
+
self._site_admin: Attribute[bool] = NotSet
|
| 145 |
+
self._starred_at: Attribute[str] = NotSet
|
| 146 |
+
self._starred_url: Attribute[str] = NotSet
|
| 147 |
+
self._subscriptions_url: Attribute[str] = NotSet
|
| 148 |
+
self._suspended_at: Attribute[datetime | None] = NotSet
|
| 149 |
+
self._team_count: Attribute[int] = NotSet
|
| 150 |
+
self._text_matches: Attribute[dict[str, Any]] = NotSet
|
| 151 |
+
self._total_private_repos: Attribute[int] = NotSet
|
| 152 |
+
self._twitter_username: Attribute[str | None] = NotSet
|
| 153 |
+
self._type: Attribute[str] = NotSet
|
| 154 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 155 |
+
self._url: Attribute[str] = NotSet
|
| 156 |
+
self._user_view_type: Attribute[str] = NotSet
|
| 157 |
+
|
| 158 |
+
def __eq__(self, other: Any) -> bool:
|
| 159 |
+
return isinstance(other, type(self)) and self.login == other.login and self.id == other.id
|
| 160 |
+
|
| 161 |
+
def __hash__(self) -> int:
|
| 162 |
+
return hash((self.id, self.login))
|
| 163 |
+
|
| 164 |
+
def __repr__(self) -> str:
|
| 165 |
+
return self.get__repr__({"login": self._login.value})
|
| 166 |
+
|
| 167 |
+
@property
|
| 168 |
+
def _identity(self) -> str:
|
| 169 |
+
return self.login
|
| 170 |
+
|
| 171 |
+
@property
|
| 172 |
+
def avatar_url(self) -> str:
|
| 173 |
+
self._completeIfNotSet(self._avatar_url)
|
| 174 |
+
return self._avatar_url.value
|
| 175 |
+
|
| 176 |
+
@property
|
| 177 |
+
def bio(self) -> str | None:
|
| 178 |
+
self._completeIfNotSet(self._bio)
|
| 179 |
+
return self._bio.value
|
| 180 |
+
|
| 181 |
+
@property
|
| 182 |
+
def blog(self) -> str | None:
|
| 183 |
+
self._completeIfNotSet(self._blog)
|
| 184 |
+
return self._blog.value
|
| 185 |
+
|
| 186 |
+
@property
|
| 187 |
+
def collaborators(self) -> int | None:
|
| 188 |
+
self._completeIfNotSet(self._collaborators)
|
| 189 |
+
return self._collaborators.value
|
| 190 |
+
|
| 191 |
+
@property
|
| 192 |
+
def company(self) -> str | None:
|
| 193 |
+
self._completeIfNotSet(self._company)
|
| 194 |
+
return self._company.value
|
| 195 |
+
|
| 196 |
+
@property
|
| 197 |
+
def contributions(self) -> int:
|
| 198 |
+
self._completeIfNotSet(self._contributions)
|
| 199 |
+
return self._contributions.value
|
| 200 |
+
|
| 201 |
+
@property
|
| 202 |
+
def created_at(self) -> datetime:
|
| 203 |
+
self._completeIfNotSet(self._created_at)
|
| 204 |
+
return self._created_at.value
|
| 205 |
+
|
| 206 |
+
@property
|
| 207 |
+
def disk_usage(self) -> int:
|
| 208 |
+
self._completeIfNotSet(self._disk_usage)
|
| 209 |
+
return self._disk_usage.value
|
| 210 |
+
|
| 211 |
+
@property
|
| 212 |
+
def display_login(self) -> str:
|
| 213 |
+
return self._display_login.value
|
| 214 |
+
|
| 215 |
+
@property
|
| 216 |
+
def email(self) -> str | None:
|
| 217 |
+
self._completeIfNotSet(self._email)
|
| 218 |
+
return self._email.value
|
| 219 |
+
|
| 220 |
+
@property
|
| 221 |
+
def events_url(self) -> str:
|
| 222 |
+
self._completeIfNotSet(self._events_url)
|
| 223 |
+
return self._events_url.value
|
| 224 |
+
|
| 225 |
+
@property
|
| 226 |
+
def followers(self) -> int:
|
| 227 |
+
self._completeIfNotSet(self._followers)
|
| 228 |
+
return self._followers.value
|
| 229 |
+
|
| 230 |
+
@property
|
| 231 |
+
def followers_url(self) -> str:
|
| 232 |
+
self._completeIfNotSet(self._followers_url)
|
| 233 |
+
return self._followers_url.value
|
| 234 |
+
|
| 235 |
+
@property
|
| 236 |
+
def following(self) -> int:
|
| 237 |
+
self._completeIfNotSet(self._following)
|
| 238 |
+
return self._following.value
|
| 239 |
+
|
| 240 |
+
@property
|
| 241 |
+
def following_url(self) -> str:
|
| 242 |
+
self._completeIfNotSet(self._following_url)
|
| 243 |
+
return self._following_url.value
|
| 244 |
+
|
| 245 |
+
@property
|
| 246 |
+
def gists_url(self) -> str:
|
| 247 |
+
self._completeIfNotSet(self._gists_url)
|
| 248 |
+
return self._gists_url.value
|
| 249 |
+
|
| 250 |
+
@property
|
| 251 |
+
def gravatar_id(self) -> str | None:
|
| 252 |
+
self._completeIfNotSet(self._gravatar_id)
|
| 253 |
+
return self._gravatar_id.value
|
| 254 |
+
|
| 255 |
+
@property
|
| 256 |
+
def hireable(self) -> bool | None:
|
| 257 |
+
self._completeIfNotSet(self._hireable)
|
| 258 |
+
return self._hireable.value
|
| 259 |
+
|
| 260 |
+
@property
|
| 261 |
+
def html_url(self) -> str:
|
| 262 |
+
self._completeIfNotSet(self._html_url)
|
| 263 |
+
return self._html_url.value
|
| 264 |
+
|
| 265 |
+
@property
|
| 266 |
+
def id(self) -> int:
|
| 267 |
+
self._completeIfNotSet(self._id)
|
| 268 |
+
return self._id.value
|
| 269 |
+
|
| 270 |
+
@property
|
| 271 |
+
def invitation_teams_url(self) -> str:
|
| 272 |
+
self._completeIfNotSet(self._invitation_teams_url)
|
| 273 |
+
return self._invitation_teams_url.value
|
| 274 |
+
|
| 275 |
+
@property
|
| 276 |
+
def inviter(self) -> NamedUser:
|
| 277 |
+
self._completeIfNotSet(self._inviter)
|
| 278 |
+
return self._inviter.value
|
| 279 |
+
|
| 280 |
+
@property
|
| 281 |
+
def location(self) -> str | None:
|
| 282 |
+
self._completeIfNotSet(self._location)
|
| 283 |
+
return self._location.value
|
| 284 |
+
|
| 285 |
+
@property
|
| 286 |
+
def login(self) -> str:
|
| 287 |
+
self._completeIfNotSet(self._login)
|
| 288 |
+
return self._login.value
|
| 289 |
+
|
| 290 |
+
@property
|
| 291 |
+
def name(self) -> str | None:
|
| 292 |
+
self._completeIfNotSet(self._name)
|
| 293 |
+
return self._name.value
|
| 294 |
+
|
| 295 |
+
@property
|
| 296 |
+
def node_id(self) -> str:
|
| 297 |
+
self._completeIfNotSet(self._node_id)
|
| 298 |
+
return self._node_id.value
|
| 299 |
+
|
| 300 |
+
@property
|
| 301 |
+
def notification_email(self) -> str:
|
| 302 |
+
return self._notification_email.value
|
| 303 |
+
|
| 304 |
+
@property
|
| 305 |
+
def organizations_url(self) -> str:
|
| 306 |
+
self._completeIfNotSet(self._organizations_url)
|
| 307 |
+
return self._organizations_url.value
|
| 308 |
+
|
| 309 |
+
@property
|
| 310 |
+
def owned_private_repos(self) -> int | None:
|
| 311 |
+
self._completeIfNotSet(self._owned_private_repos)
|
| 312 |
+
return self._owned_private_repos.value
|
| 313 |
+
|
| 314 |
+
@property
|
| 315 |
+
def permissions(self) -> Permissions:
|
| 316 |
+
self._completeIfNotSet(self._permissions)
|
| 317 |
+
return self._permissions.value
|
| 318 |
+
|
| 319 |
+
@property
|
| 320 |
+
def plan(self) -> Plan | None:
|
| 321 |
+
self._completeIfNotSet(self._plan)
|
| 322 |
+
return self._plan.value
|
| 323 |
+
|
| 324 |
+
@property
|
| 325 |
+
def private_gists(self) -> int | None:
|
| 326 |
+
self._completeIfNotSet(self._private_gists)
|
| 327 |
+
return self._private_gists.value
|
| 328 |
+
|
| 329 |
+
@property
|
| 330 |
+
def public_gists(self) -> int:
|
| 331 |
+
self._completeIfNotSet(self._public_gists)
|
| 332 |
+
return self._public_gists.value
|
| 333 |
+
|
| 334 |
+
@property
|
| 335 |
+
def public_repos(self) -> int:
|
| 336 |
+
self._completeIfNotSet(self._public_repos)
|
| 337 |
+
return self._public_repos.value
|
| 338 |
+
|
| 339 |
+
@property
|
| 340 |
+
def received_events_url(self) -> str:
|
| 341 |
+
self._completeIfNotSet(self._received_events_url)
|
| 342 |
+
return self._received_events_url.value
|
| 343 |
+
|
| 344 |
+
@property
|
| 345 |
+
def repos_url(self) -> str:
|
| 346 |
+
self._completeIfNotSet(self._repos_url)
|
| 347 |
+
return self._repos_url.value
|
| 348 |
+
|
| 349 |
+
@property
|
| 350 |
+
def role(self) -> str:
|
| 351 |
+
self._completeIfNotSet(self._role)
|
| 352 |
+
return self._role.value
|
| 353 |
+
|
| 354 |
+
@property
|
| 355 |
+
def role_name(self) -> str:
|
| 356 |
+
return self._role_name.value
|
| 357 |
+
|
| 358 |
+
@property
|
| 359 |
+
def score(self) -> float:
|
| 360 |
+
return self._score.value
|
| 361 |
+
|
| 362 |
+
@property
|
| 363 |
+
def site_admin(self) -> bool:
|
| 364 |
+
self._completeIfNotSet(self._site_admin)
|
| 365 |
+
return self._site_admin.value
|
| 366 |
+
|
| 367 |
+
@property
|
| 368 |
+
def starred_at(self) -> str:
|
| 369 |
+
return self._starred_at.value
|
| 370 |
+
|
| 371 |
+
@property
|
| 372 |
+
def starred_url(self) -> str:
|
| 373 |
+
self._completeIfNotSet(self._starred_url)
|
| 374 |
+
return self._starred_url.value
|
| 375 |
+
|
| 376 |
+
@property
|
| 377 |
+
def subscriptions_url(self) -> str:
|
| 378 |
+
self._completeIfNotSet(self._subscriptions_url)
|
| 379 |
+
return self._subscriptions_url.value
|
| 380 |
+
|
| 381 |
+
@property
|
| 382 |
+
def suspended_at(self) -> datetime | None:
|
| 383 |
+
self._completeIfNotSet(self._suspended_at)
|
| 384 |
+
return self._suspended_at.value
|
| 385 |
+
|
| 386 |
+
@property
|
| 387 |
+
def team_count(self) -> int:
|
| 388 |
+
self._completeIfNotSet(self._team_count)
|
| 389 |
+
return self._team_count.value
|
| 390 |
+
|
| 391 |
+
@property
|
| 392 |
+
def text_matches(self) -> dict[str, Any]:
|
| 393 |
+
return self._text_matches.value
|
| 394 |
+
|
| 395 |
+
@property
|
| 396 |
+
def total_private_repos(self) -> int | None:
|
| 397 |
+
self._completeIfNotSet(self._total_private_repos)
|
| 398 |
+
return self._total_private_repos.value
|
| 399 |
+
|
| 400 |
+
@property
|
| 401 |
+
def twitter_username(self) -> str | None:
|
| 402 |
+
self._completeIfNotSet(self._twitter_username)
|
| 403 |
+
return self._twitter_username.value
|
| 404 |
+
|
| 405 |
+
@property
|
| 406 |
+
def type(self) -> str:
|
| 407 |
+
self._completeIfNotSet(self._type)
|
| 408 |
+
return self._type.value
|
| 409 |
+
|
| 410 |
+
@property
|
| 411 |
+
def updated_at(self) -> datetime:
|
| 412 |
+
self._completeIfNotSet(self._updated_at)
|
| 413 |
+
return self._updated_at.value
|
| 414 |
+
|
| 415 |
+
@property
|
| 416 |
+
def url(self) -> str:
|
| 417 |
+
self._completeIfNotSet(self._url)
|
| 418 |
+
return self._url.value
|
| 419 |
+
|
| 420 |
+
@property
|
| 421 |
+
def user_view_type(self) -> str:
|
| 422 |
+
return self._user_view_type.value
|
| 423 |
+
|
| 424 |
+
def get_events(self) -> PaginatedList[Event]:
|
| 425 |
+
"""
|
| 426 |
+
:calls: `GET /users/{user}/events <https://docs.github.com/en/rest/reference/activity#events>`_
|
| 427 |
+
"""
|
| 428 |
+
return github.PaginatedList.PaginatedList(github.Event.Event, self._requester, f"{self.url}/events", None)
|
| 429 |
+
|
| 430 |
+
def get_followers(self) -> PaginatedList[NamedUser]:
|
| 431 |
+
"""
|
| 432 |
+
:calls: `GET /users/{user}/followers <https://docs.github.com/en/rest/reference/users#followers>`_
|
| 433 |
+
"""
|
| 434 |
+
return github.PaginatedList.PaginatedList(NamedUser, self._requester, f"{self.url}/followers", None)
|
| 435 |
+
|
| 436 |
+
def get_following(self) -> PaginatedList[NamedUser]:
|
| 437 |
+
"""
|
| 438 |
+
:calls: `GET /users/{user}/following <https://docs.github.com/en/rest/reference/users#followers>`_
|
| 439 |
+
"""
|
| 440 |
+
return github.PaginatedList.PaginatedList(NamedUser, self._requester, f"{self.url}/following", None)
|
| 441 |
+
|
| 442 |
+
def get_gists(self, since: Opt[datetime] = NotSet) -> PaginatedList[Gist]:
|
| 443 |
+
"""
|
| 444 |
+
:calls: `GET /users/{user}/gists <https://docs.github.com/en/rest/reference/gists>`_
|
| 445 |
+
"""
|
| 446 |
+
assert since is NotSet or isinstance(since, datetime), since
|
| 447 |
+
url_parameters = dict()
|
| 448 |
+
if is_defined(since):
|
| 449 |
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 450 |
+
return github.PaginatedList.PaginatedList(
|
| 451 |
+
github.Gist.Gist, self._requester, f"{self.url}/gists", url_parameters
|
| 452 |
+
)
|
| 453 |
+
|
| 454 |
+
def get_keys(self) -> PaginatedList[UserKey]:
|
| 455 |
+
"""
|
| 456 |
+
:calls: `GET /users/{user}/keys <https://docs.github.com/en/rest/reference/users#create-a-public-ssh-key-for-the-authenticated-user>`_
|
| 457 |
+
"""
|
| 458 |
+
return github.PaginatedList.PaginatedList(github.UserKey.UserKey, self._requester, f"{self.url}/keys", None)
|
| 459 |
+
|
| 460 |
+
def get_orgs(self) -> PaginatedList[Organization]:
|
| 461 |
+
"""
|
| 462 |
+
:calls: `GET /users/{user}/orgs <https://docs.github.com/en/rest/reference/orgs>`_
|
| 463 |
+
"""
|
| 464 |
+
return github.PaginatedList.PaginatedList(
|
| 465 |
+
github.Organization.Organization, self._requester, f"{self.url}/orgs", None
|
| 466 |
+
)
|
| 467 |
+
|
| 468 |
+
def get_projects(self, state: str = "open") -> PaginatedList[Project]:
|
| 469 |
+
"""
|
| 470 |
+
:calls: `GET /users/{user}/projects <https://docs.github.com/en/rest/reference/projects#list-user-projects>`_
|
| 471 |
+
"""
|
| 472 |
+
assert isinstance(state, str), state
|
| 473 |
+
url_parameters = {"state": state}
|
| 474 |
+
return github.PaginatedList.PaginatedList(
|
| 475 |
+
github.Project.Project,
|
| 476 |
+
self._requester,
|
| 477 |
+
f"{self.url}/projects",
|
| 478 |
+
url_parameters,
|
| 479 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 480 |
+
)
|
| 481 |
+
|
| 482 |
+
def get_public_events(self) -> PaginatedList[Event]:
|
| 483 |
+
"""
|
| 484 |
+
:calls: `GET /users/{user}/events/public <https://docs.github.com/en/rest/reference/activity#events>`_
|
| 485 |
+
"""
|
| 486 |
+
return github.PaginatedList.PaginatedList(
|
| 487 |
+
github.Event.Event, self._requester, f"{self.url}/events/public", None
|
| 488 |
+
)
|
| 489 |
+
|
| 490 |
+
def get_public_received_events(self) -> PaginatedList[Event]:
|
| 491 |
+
"""
|
| 492 |
+
:calls: `GET /users/{user}/received_events/public <https://docs.github.com/en/rest/reference/activity#events>`_
|
| 493 |
+
"""
|
| 494 |
+
return github.PaginatedList.PaginatedList(
|
| 495 |
+
github.Event.Event,
|
| 496 |
+
self._requester,
|
| 497 |
+
f"{self.url}/received_events/public",
|
| 498 |
+
None,
|
| 499 |
+
)
|
| 500 |
+
|
| 501 |
+
def get_received_events(self) -> PaginatedList[Event]:
|
| 502 |
+
"""
|
| 503 |
+
:calls: `GET /users/{user}/received_events <https://docs.github.com/en/rest/reference/activity#events>`_
|
| 504 |
+
"""
|
| 505 |
+
return github.PaginatedList.PaginatedList(
|
| 506 |
+
github.Event.Event, self._requester, f"{self.url}/received_events", None
|
| 507 |
+
)
|
| 508 |
+
|
| 509 |
+
def get_repo(self, name: str) -> Repository:
|
| 510 |
+
"""
|
| 511 |
+
:calls: `GET /repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/repos>`_
|
| 512 |
+
"""
|
| 513 |
+
assert isinstance(name, str), name
|
| 514 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"/repos/{self.login}/{name}")
|
| 515 |
+
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
| 516 |
+
|
| 517 |
+
def get_repos(
|
| 518 |
+
self,
|
| 519 |
+
type: Opt[str] = NotSet,
|
| 520 |
+
sort: Opt[str] = NotSet,
|
| 521 |
+
direction: Opt[str] = NotSet,
|
| 522 |
+
) -> PaginatedList[Repository]:
|
| 523 |
+
"""
|
| 524 |
+
:calls: `GET /users/{user}/repos <https://docs.github.com/en/rest/reference/repos>`_
|
| 525 |
+
"""
|
| 526 |
+
assert type is NotSet or isinstance(type, str), type
|
| 527 |
+
assert sort is NotSet or isinstance(sort, str), sort
|
| 528 |
+
assert direction is NotSet or isinstance(direction, str), direction
|
| 529 |
+
url_parameters = dict()
|
| 530 |
+
if type is not NotSet:
|
| 531 |
+
url_parameters["type"] = type
|
| 532 |
+
if sort is not NotSet:
|
| 533 |
+
url_parameters["sort"] = sort
|
| 534 |
+
if direction is not NotSet:
|
| 535 |
+
url_parameters["direction"] = direction
|
| 536 |
+
return github.PaginatedList.PaginatedList(
|
| 537 |
+
github.Repository.Repository,
|
| 538 |
+
self._requester,
|
| 539 |
+
f"{self.url}/repos",
|
| 540 |
+
url_parameters,
|
| 541 |
+
)
|
| 542 |
+
|
| 543 |
+
def get_starred(self) -> PaginatedList[Repository]:
|
| 544 |
+
"""
|
| 545 |
+
:calls: `GET /users/{user}/starred <https://docs.github.com/en/rest/reference/activity#starring>`_
|
| 546 |
+
"""
|
| 547 |
+
return github.PaginatedList.PaginatedList(
|
| 548 |
+
github.Repository.Repository, self._requester, f"{self.url}/starred", None
|
| 549 |
+
)
|
| 550 |
+
|
| 551 |
+
def get_subscriptions(self) -> PaginatedList[Repository]:
|
| 552 |
+
"""
|
| 553 |
+
:calls: `GET /users/{user}/subscriptions <https://docs.github.com/en/rest/reference/activity#watching>`_
|
| 554 |
+
"""
|
| 555 |
+
return github.PaginatedList.PaginatedList(
|
| 556 |
+
github.Repository.Repository,
|
| 557 |
+
self._requester,
|
| 558 |
+
f"{self.url}/subscriptions",
|
| 559 |
+
None,
|
| 560 |
+
)
|
| 561 |
+
|
| 562 |
+
def get_watched(self) -> PaginatedList[Repository]:
|
| 563 |
+
"""
|
| 564 |
+
:calls: `GET /users/{user}/watched <https://docs.github.com/en/rest/reference/activity#starring>`_
|
| 565 |
+
"""
|
| 566 |
+
return github.PaginatedList.PaginatedList(
|
| 567 |
+
github.Repository.Repository, self._requester, f"{self.url}/watched", None
|
| 568 |
+
)
|
| 569 |
+
|
| 570 |
+
def has_in_following(self, following: NamedUser) -> bool:
|
| 571 |
+
"""
|
| 572 |
+
:calls: `GET /users/{user}/following/{target_user} <https://docs.github.com/en/rest/reference/users#check-if-a-user-follows-another-user>`_
|
| 573 |
+
"""
|
| 574 |
+
assert isinstance(following, github.NamedUser.NamedUser), following
|
| 575 |
+
status, headers, data = self._requester.requestJson("GET", f"{self.url}/following/{following._identity}")
|
| 576 |
+
return status == 204
|
| 577 |
+
|
| 578 |
+
def get_organization_membership(self, org: str | Organization) -> Membership:
|
| 579 |
+
"""
|
| 580 |
+
:calls: `GET /orgs/{org}/memberships/{username} <https://docs.github.com/en/rest/reference/orgs#check-organization-membership-for-a-user>`_
|
| 581 |
+
"""
|
| 582 |
+
assert isinstance(org, str) or isinstance(org, github.Organization.Organization), org
|
| 583 |
+
if isinstance(org, github.Organization.Organization):
|
| 584 |
+
org = org.login # type: ignore
|
| 585 |
+
org = urllib.parse.quote(org)
|
| 586 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"/orgs/{org}/memberships/{self.login}")
|
| 587 |
+
return github.Membership.Membership(self._requester, headers, data, completed=True)
|
| 588 |
+
|
| 589 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 590 |
+
if "avatar_url" in attributes: # pragma no branch
|
| 591 |
+
self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
|
| 592 |
+
if "bio" in attributes: # pragma no branch
|
| 593 |
+
self._bio = self._makeStringAttribute(attributes["bio"])
|
| 594 |
+
if "blog" in attributes: # pragma no branch
|
| 595 |
+
self._blog = self._makeStringAttribute(attributes["blog"])
|
| 596 |
+
if "collaborators" in attributes: # pragma no branch
|
| 597 |
+
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
|
| 598 |
+
if "company" in attributes: # pragma no branch
|
| 599 |
+
self._company = self._makeStringAttribute(attributes["company"])
|
| 600 |
+
if "contributions" in attributes: # pragma no branch
|
| 601 |
+
self._contributions = self._makeIntAttribute(attributes["contributions"])
|
| 602 |
+
if "created_at" in attributes: # pragma no branch
|
| 603 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 604 |
+
if "disk_usage" in attributes: # pragma no branch
|
| 605 |
+
self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
|
| 606 |
+
if "display_login" in attributes: # pragma no branch
|
| 607 |
+
self._display_login = self._makeStringAttribute(attributes["display_login"])
|
| 608 |
+
if "email" in attributes: # pragma no branch
|
| 609 |
+
self._email = self._makeStringAttribute(attributes["email"])
|
| 610 |
+
if "events_url" in attributes: # pragma no branch
|
| 611 |
+
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
| 612 |
+
if "followers" in attributes: # pragma no branch
|
| 613 |
+
self._followers = self._makeIntAttribute(attributes["followers"])
|
| 614 |
+
if "followers_url" in attributes: # pragma no branch
|
| 615 |
+
self._followers_url = self._makeStringAttribute(attributes["followers_url"])
|
| 616 |
+
if "following" in attributes: # pragma no branch
|
| 617 |
+
self._following = self._makeIntAttribute(attributes["following"])
|
| 618 |
+
if "following_url" in attributes: # pragma no branch
|
| 619 |
+
self._following_url = self._makeStringAttribute(attributes["following_url"])
|
| 620 |
+
if "gists_url" in attributes: # pragma no branch
|
| 621 |
+
self._gists_url = self._makeStringAttribute(attributes["gists_url"])
|
| 622 |
+
if "gravatar_id" in attributes: # pragma no branch
|
| 623 |
+
self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
|
| 624 |
+
if "hireable" in attributes: # pragma no branch
|
| 625 |
+
self._hireable = self._makeBoolAttribute(attributes["hireable"])
|
| 626 |
+
if "html_url" in attributes: # pragma no branch
|
| 627 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 628 |
+
if "id" in attributes: # pragma no branch
|
| 629 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 630 |
+
if "invitation_teams_url" in attributes: # pragma no branch
|
| 631 |
+
self._invitation_teams_url = self._makeStringAttribute(attributes["invitation_teams_url"])
|
| 632 |
+
if "inviter" in attributes: # pragma no branch
|
| 633 |
+
self._inviter = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["inviter"])
|
| 634 |
+
if "location" in attributes: # pragma no branch
|
| 635 |
+
self._location = self._makeStringAttribute(attributes["location"])
|
| 636 |
+
if "login" in attributes: # pragma no branch
|
| 637 |
+
self._login = self._makeStringAttribute(attributes["login"])
|
| 638 |
+
if "name" in attributes: # pragma no branch
|
| 639 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 640 |
+
if "node_id" in attributes: # pragma no branch
|
| 641 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 642 |
+
if "notification_email" in attributes: # pragma no branch
|
| 643 |
+
self._notification_email = self._makeStringAttribute(attributes["notification_email"])
|
| 644 |
+
if "organizations_url" in attributes: # pragma no branch
|
| 645 |
+
self._organizations_url = self._makeStringAttribute(attributes["organizations_url"])
|
| 646 |
+
if "owned_private_repos" in attributes: # pragma no branch
|
| 647 |
+
self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
|
| 648 |
+
if "permissions" in attributes: # pragma no branch
|
| 649 |
+
self._permissions = self._makeClassAttribute(github.Permissions.Permissions, attributes["permissions"])
|
| 650 |
+
if "plan" in attributes: # pragma no branch
|
| 651 |
+
self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
|
| 652 |
+
if "private_gists" in attributes: # pragma no branch
|
| 653 |
+
self._private_gists = self._makeIntAttribute(attributes["private_gists"])
|
| 654 |
+
if "public_gists" in attributes: # pragma no branch
|
| 655 |
+
self._public_gists = self._makeIntAttribute(attributes["public_gists"])
|
| 656 |
+
if "public_repos" in attributes: # pragma no branch
|
| 657 |
+
self._public_repos = self._makeIntAttribute(attributes["public_repos"])
|
| 658 |
+
if "received_events_url" in attributes: # pragma no branch
|
| 659 |
+
self._received_events_url = self._makeStringAttribute(attributes["received_events_url"])
|
| 660 |
+
if "repos_url" in attributes: # pragma no branch
|
| 661 |
+
self._repos_url = self._makeStringAttribute(attributes["repos_url"])
|
| 662 |
+
if "role" in attributes: # pragma no branch
|
| 663 |
+
self._role = self._makeStringAttribute(attributes["role"])
|
| 664 |
+
if "role_name" in attributes: # pragma no branch
|
| 665 |
+
self._role_name = self._makeStringAttribute(attributes["role_name"])
|
| 666 |
+
if "score" in attributes: # pragma no branch
|
| 667 |
+
self._score = self._makeFloatAttribute(attributes["score"])
|
| 668 |
+
if "site_admin" in attributes: # pragma no branch
|
| 669 |
+
self._site_admin = self._makeBoolAttribute(attributes["site_admin"])
|
| 670 |
+
if "starred_at" in attributes: # pragma no branch
|
| 671 |
+
self._starred_at = self._makeStringAttribute(attributes["starred_at"])
|
| 672 |
+
if "starred_url" in attributes: # pragma no branch
|
| 673 |
+
self._starred_url = self._makeStringAttribute(attributes["starred_url"])
|
| 674 |
+
if "subscriptions_url" in attributes: # pragma no branch
|
| 675 |
+
self._subscriptions_url = self._makeStringAttribute(attributes["subscriptions_url"])
|
| 676 |
+
if "suspended_at" in attributes: # pragma no branch
|
| 677 |
+
self._suspended_at = self._makeDatetimeAttribute(attributes["suspended_at"])
|
| 678 |
+
if "team_count" in attributes:
|
| 679 |
+
self._team_count = self._makeIntAttribute(attributes["team_count"])
|
| 680 |
+
if "text_matches" in attributes: # pragma no branch
|
| 681 |
+
self._text_matches = self._makeDictAttribute(attributes["text_matches"])
|
| 682 |
+
if "total_private_repos" in attributes: # pragma no branch
|
| 683 |
+
self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
|
| 684 |
+
if "twitter_username" in attributes: # pragma no branch
|
| 685 |
+
self._twitter_username = self._makeStringAttribute(attributes["twitter_username"])
|
| 686 |
+
if "type" in attributes: # pragma no branch
|
| 687 |
+
self._type = self._makeStringAttribute(attributes["type"])
|
| 688 |
+
if "updated_at" in attributes: # pragma no branch
|
| 689 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 690 |
+
if "url" in attributes: # pragma no branch
|
| 691 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 692 |
+
if "user_view_type" in attributes: # pragma no branch
|
| 693 |
+
self._user_view_type = self._makeStringAttribute(attributes["user_view_type"])
|
python_embeded/Lib/site-packages/github/Notification.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 4 |
+
# Copyright 2013 Peter Golm <golm.peter@gmail.com> #
|
| 5 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 6 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Alice GIRARD <bouhahah@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Olof-Joachim Frahm (欧雅福) <olof@macrolet.net> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
|
| 16 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 18 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 20 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 21 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 22 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 24 |
+
# Copyright 2024 Matthias Bilger <matthias@bilger.info> #
|
| 25 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# #
|
| 27 |
+
# This file is part of PyGithub. #
|
| 28 |
+
# http://pygithub.readthedocs.io/ #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 31 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 32 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 33 |
+
# any later version. #
|
| 34 |
+
# #
|
| 35 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 36 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 37 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 38 |
+
# details. #
|
| 39 |
+
# #
|
| 40 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 41 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 42 |
+
# #
|
| 43 |
+
################################################################################
|
| 44 |
+
|
| 45 |
+
from __future__ import annotations
|
| 46 |
+
|
| 47 |
+
from datetime import datetime
|
| 48 |
+
from typing import Any
|
| 49 |
+
|
| 50 |
+
import github.GithubObject
|
| 51 |
+
import github.Issue
|
| 52 |
+
import github.NotificationSubject
|
| 53 |
+
import github.PullRequest
|
| 54 |
+
import github.Repository
|
| 55 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class Notification(CompletableGithubObject):
|
| 59 |
+
"""
|
| 60 |
+
This class represents Notifications.
|
| 61 |
+
|
| 62 |
+
The reference can be found here
|
| 63 |
+
https://docs.github.com/en/rest/reference/activity#notifications
|
| 64 |
+
|
| 65 |
+
The OpenAPI schema can be found at
|
| 66 |
+
- /components/schemas/thread
|
| 67 |
+
|
| 68 |
+
"""
|
| 69 |
+
|
| 70 |
+
def _initAttributes(self) -> None:
|
| 71 |
+
self._id: Attribute[str] = NotSet
|
| 72 |
+
self._last_read_at: Attribute[datetime] = NotSet
|
| 73 |
+
self._reason: Attribute[str] = NotSet
|
| 74 |
+
self._repository: Attribute[github.Repository.Repository] = NotSet
|
| 75 |
+
self._subject: Attribute[github.NotificationSubject.NotificationSubject] = NotSet
|
| 76 |
+
self._subscription_url: Attribute[str] = NotSet
|
| 77 |
+
self._unread: Attribute[bool] = NotSet
|
| 78 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 79 |
+
self._url: Attribute[str] = NotSet
|
| 80 |
+
|
| 81 |
+
def __repr__(self) -> str:
|
| 82 |
+
return self.get__repr__({"id": self._id.value, "subject": self._subject.value})
|
| 83 |
+
|
| 84 |
+
@property
|
| 85 |
+
def id(self) -> str:
|
| 86 |
+
self._completeIfNotSet(self._id)
|
| 87 |
+
return self._id.value
|
| 88 |
+
|
| 89 |
+
@property
|
| 90 |
+
def last_read_at(self) -> datetime:
|
| 91 |
+
self._completeIfNotSet(self._last_read_at)
|
| 92 |
+
return self._last_read_at.value
|
| 93 |
+
|
| 94 |
+
@property
|
| 95 |
+
def reason(self) -> str:
|
| 96 |
+
self._completeIfNotSet(self._reason)
|
| 97 |
+
return self._reason.value
|
| 98 |
+
|
| 99 |
+
@property
|
| 100 |
+
def repository(self) -> github.Repository.Repository:
|
| 101 |
+
self._completeIfNotSet(self._repository)
|
| 102 |
+
return self._repository.value
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def subject(self) -> github.NotificationSubject.NotificationSubject:
|
| 106 |
+
self._completeIfNotSet(self._subject)
|
| 107 |
+
return self._subject.value
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def subscription_url(self) -> str:
|
| 111 |
+
self._completeIfNotSet(self._subscription_url)
|
| 112 |
+
return self._subscription_url.value
|
| 113 |
+
|
| 114 |
+
@property
|
| 115 |
+
def unread(self) -> bool:
|
| 116 |
+
self._completeIfNotSet(self._unread)
|
| 117 |
+
return self._unread.value
|
| 118 |
+
|
| 119 |
+
@property
|
| 120 |
+
def updated_at(self) -> datetime:
|
| 121 |
+
self._completeIfNotSet(self._updated_at)
|
| 122 |
+
return self._updated_at.value
|
| 123 |
+
|
| 124 |
+
@property
|
| 125 |
+
def url(self) -> str:
|
| 126 |
+
self._completeIfNotSet(self._url)
|
| 127 |
+
return self._url.value
|
| 128 |
+
|
| 129 |
+
def mark_as_read(self) -> None:
|
| 130 |
+
"""
|
| 131 |
+
:calls: `PATCH /notifications/threads/{id} <https://docs.github.com/en/rest/reference/activity#notifications>`_
|
| 132 |
+
"""
|
| 133 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 134 |
+
"PATCH",
|
| 135 |
+
self.url,
|
| 136 |
+
)
|
| 137 |
+
|
| 138 |
+
def mark_as_done(self) -> None:
|
| 139 |
+
"""
|
| 140 |
+
:calls: `DELETE /notifications/threads/{id} <https://docs.github.com/en/rest/reference/activity#notifications>`_
|
| 141 |
+
"""
|
| 142 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 143 |
+
"DELETE",
|
| 144 |
+
self.url,
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
def get_pull_request(self) -> github.PullRequest.PullRequest:
|
| 148 |
+
headers, data = self._requester.requestJsonAndCheck("GET", self.subject.url)
|
| 149 |
+
return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
|
| 150 |
+
|
| 151 |
+
def get_issue(self) -> github.Issue.Issue:
|
| 152 |
+
headers, data = self._requester.requestJsonAndCheck("GET", self.subject.url)
|
| 153 |
+
return github.Issue.Issue(self._requester, headers, data, completed=True)
|
| 154 |
+
|
| 155 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 156 |
+
if "id" in attributes: # pragma no branch
|
| 157 |
+
self._id = self._makeStringAttribute(attributes["id"])
|
| 158 |
+
if "last_read_at" in attributes: # pragma no branch
|
| 159 |
+
self._last_read_at = self._makeDatetimeAttribute(attributes["last_read_at"])
|
| 160 |
+
if "reason" in attributes: # pragma no branch
|
| 161 |
+
self._reason = self._makeStringAttribute(attributes["reason"])
|
| 162 |
+
if "repository" in attributes: # pragma no branch
|
| 163 |
+
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
|
| 164 |
+
if "subject" in attributes: # pragma no branch
|
| 165 |
+
self._subject = self._makeClassAttribute(
|
| 166 |
+
github.NotificationSubject.NotificationSubject, attributes["subject"]
|
| 167 |
+
)
|
| 168 |
+
if "subscription_url" in attributes: # pragma no branch
|
| 169 |
+
self._subscription_url = self._makeStringAttribute(attributes["subscription_url"])
|
| 170 |
+
if "unread" in attributes: # pragma no branch
|
| 171 |
+
self._unread = self._makeBoolAttribute(attributes["unread"])
|
| 172 |
+
if "updated_at" in attributes: # pragma no branch
|
| 173 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 174 |
+
if "url" in attributes: # pragma no branch
|
| 175 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/NotificationSubject.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 16 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 20 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# #
|
| 24 |
+
# This file is part of PyGithub. #
|
| 25 |
+
# http://pygithub.readthedocs.io/ #
|
| 26 |
+
# #
|
| 27 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 28 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 29 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 30 |
+
# any later version. #
|
| 31 |
+
# #
|
| 32 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 33 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 34 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 35 |
+
# details. #
|
| 36 |
+
# #
|
| 37 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 38 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 39 |
+
# #
|
| 40 |
+
################################################################################
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
from typing import Any, Dict
|
| 44 |
+
|
| 45 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class NotificationSubject(NonCompletableGithubObject):
|
| 49 |
+
"""
|
| 50 |
+
This class represents Subjects of Notifications.
|
| 51 |
+
|
| 52 |
+
The reference can be found here
|
| 53 |
+
https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user
|
| 54 |
+
|
| 55 |
+
The OpenAPI schema can be found at
|
| 56 |
+
- /components/schemas/thread/properties/subject
|
| 57 |
+
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
def _initAttributes(self) -> None:
|
| 61 |
+
self._latest_comment_url: Attribute[str] = NotSet
|
| 62 |
+
self._title: Attribute[str] = NotSet
|
| 63 |
+
self._type: Attribute[str] = NotSet
|
| 64 |
+
self._url: Attribute[str] = NotSet
|
| 65 |
+
|
| 66 |
+
def __repr__(self) -> str:
|
| 67 |
+
return self.get__repr__({"title": self._title.value})
|
| 68 |
+
|
| 69 |
+
@property
|
| 70 |
+
def latest_comment_url(self) -> str:
|
| 71 |
+
return self._latest_comment_url.value
|
| 72 |
+
|
| 73 |
+
@property
|
| 74 |
+
def title(self) -> str:
|
| 75 |
+
return self._title.value
|
| 76 |
+
|
| 77 |
+
@property
|
| 78 |
+
def type(self) -> str:
|
| 79 |
+
return self._type.value
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def url(self) -> str:
|
| 83 |
+
return self._url.value
|
| 84 |
+
|
| 85 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 86 |
+
if "latest_comment_url" in attributes: # pragma no branch
|
| 87 |
+
self._latest_comment_url = self._makeStringAttribute(attributes["latest_comment_url"])
|
| 88 |
+
if "title" in attributes: # pragma no branch
|
| 89 |
+
self._title = self._makeStringAttribute(attributes["title"])
|
| 90 |
+
if "type" in attributes: # pragma no branch
|
| 91 |
+
self._type = self._makeStringAttribute(attributes["type"])
|
| 92 |
+
if "url" in attributes: # pragma no branch
|
| 93 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/Organization.py
ADDED
|
@@ -0,0 +1,1997 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
| 4 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 5 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 6 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 9 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 10 |
+
# Copyright 2015 Sebastien Besson <seb.besson@gmail.com> #
|
| 11 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 12 |
+
# Copyright 2016 Matthew Neal <meneal@matthews-mbp.raleigh.ibm.com> #
|
| 13 |
+
# Copyright 2016 Michael Pereira <pereira.m@gmail.com> #
|
| 14 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 15 |
+
# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com> #
|
| 16 |
+
# Copyright 2018 Anton Nguyen <afnguyen85@gmail.com> #
|
| 17 |
+
# Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com> #
|
| 18 |
+
# Copyright 2018 Jasper van Wanrooy <jasper@vanwanrooy.net> #
|
| 19 |
+
# Copyright 2018 Raihaan <31362124+res0nance@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2018 Shubham Singh <41840111+singh811@users.noreply.github.com> #
|
| 21 |
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
| 22 |
+
# Copyright 2018 Tim Boring <tboring@hearst.com> #
|
| 23 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 24 |
+
# Copyright 2018 Yossarian King <yggy@blackbirdinteractive.com> #
|
| 25 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 26 |
+
# Copyright 2019 Brian Choy <byceee@gmail.com> #
|
| 27 |
+
# Copyright 2019 Geoffroy Jabouley <gjabouley@invensense.com> #
|
| 28 |
+
# Copyright 2019 Pascal Bach <pasci.bach@gmail.com> #
|
| 29 |
+
# Copyright 2019 Raihaan <31362124+res0nance@users.noreply.github.com> #
|
| 30 |
+
# Copyright 2019 Shibasis Patel <smartshibasish@gmail.com> #
|
| 31 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 32 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 33 |
+
# Copyright 2019 ebrown <brownierin@users.noreply.github.com> #
|
| 34 |
+
# Copyright 2020 Anuj Bansal <bansalanuj1996@gmail.com> #
|
| 35 |
+
# Copyright 2020 Glenn McDonald <testworksau@users.noreply.github.com> #
|
| 36 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 37 |
+
# Copyright 2020 latacora-daniel <71085674+latacora-daniel@users.noreply.github.com>#
|
| 38 |
+
# Copyright 2020 ton-katsu <sakamoto.yoshihisa@gmail.com> #
|
| 39 |
+
# Copyright 2021 James Simpson <jsimpso@users.noreply.github.com> #
|
| 40 |
+
# Copyright 2021 Marina Peresypkina <mi9onev@gmail.com> #
|
| 41 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 42 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 43 |
+
# Copyright 2021 Tanner <51724788+lightningboltemoji@users.noreply.github.com> #
|
| 44 |
+
# Copyright 2022 KimSia Sim <245021+simkimsia@users.noreply.github.com> #
|
| 45 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 46 |
+
# Copyright 2023 Felipe Peter <mr-peipei@web.de> #
|
| 47 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 48 |
+
# Copyright 2023 Jonathan Greg <31892308+jmgreg31@users.noreply.github.com> #
|
| 49 |
+
# Copyright 2023 Jonathan Leitschuh <jonathan.leitschuh@gmail.com> #
|
| 50 |
+
# Copyright 2023 Mark Amery <markamery@btinternet.com> #
|
| 51 |
+
# Copyright 2023 Mauricio Alejandro Martínez Pacheco <mauricio.martinez@premise.com>#
|
| 52 |
+
# Copyright 2023 Mauricio Alejandro Martínez Pacheco <n_othing@hotmail.com> #
|
| 53 |
+
# Copyright 2023 Oliver Mannion <125105+tekumara@users.noreply.github.com> #
|
| 54 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 55 |
+
# Copyright 2024 Andrii Kezikov <cheshirez@gmail.com> #
|
| 56 |
+
# Copyright 2024 Bill Napier <napier@pobox.com> #
|
| 57 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 58 |
+
# Copyright 2024 Jacky Lam <jacky.lam@r2studiohk.com> #
|
| 59 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 60 |
+
# Copyright 2024 Mohamed Mostafa <112487260+mohy01@users.noreply.github.com> #
|
| 61 |
+
# Copyright 2024 Oskar Jansson <56458534+janssonoskar@users.noreply.github.com>#
|
| 62 |
+
# Copyright 2024 Pasha Fateev <pasha@autokitteh.com> #
|
| 63 |
+
# Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
|
| 64 |
+
# Copyright 2024 Thomas Crowley <15927917+thomascrowley@users.noreply.github.com>#
|
| 65 |
+
# Copyright 2025 Bill Napier <napier@pobox.com> #
|
| 66 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 67 |
+
# #
|
| 68 |
+
# This file is part of PyGithub. #
|
| 69 |
+
# http://pygithub.readthedocs.io/ #
|
| 70 |
+
# #
|
| 71 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 72 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 73 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 74 |
+
# any later version. #
|
| 75 |
+
# #
|
| 76 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 77 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 78 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 79 |
+
# details. #
|
| 80 |
+
# #
|
| 81 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 82 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 83 |
+
# #
|
| 84 |
+
################################################################################
|
| 85 |
+
|
| 86 |
+
from __future__ import annotations
|
| 87 |
+
|
| 88 |
+
import urllib.parse
|
| 89 |
+
from datetime import datetime
|
| 90 |
+
from typing import TYPE_CHECKING, Any
|
| 91 |
+
|
| 92 |
+
import github.CodeSecurityConfig
|
| 93 |
+
import github.CodeSecurityConfigRepository
|
| 94 |
+
import github.Copilot
|
| 95 |
+
import github.DefaultCodeSecurityConfig
|
| 96 |
+
import github.Event
|
| 97 |
+
import github.GithubObject
|
| 98 |
+
import github.HookDelivery
|
| 99 |
+
import github.NamedUser
|
| 100 |
+
import github.OrganizationCustomProperty
|
| 101 |
+
import github.OrganizationDependabotAlert
|
| 102 |
+
import github.OrganizationSecret
|
| 103 |
+
import github.OrganizationVariable
|
| 104 |
+
import github.Plan
|
| 105 |
+
import github.Project
|
| 106 |
+
import github.Repository
|
| 107 |
+
import github.Team
|
| 108 |
+
from github import Consts
|
| 109 |
+
from github.GithubObject import (
|
| 110 |
+
Attribute,
|
| 111 |
+
CompletableGithubObject,
|
| 112 |
+
NotSet,
|
| 113 |
+
Opt,
|
| 114 |
+
is_defined,
|
| 115 |
+
is_optional,
|
| 116 |
+
is_optional_list,
|
| 117 |
+
is_undefined,
|
| 118 |
+
)
|
| 119 |
+
from github.PaginatedList import PaginatedList
|
| 120 |
+
|
| 121 |
+
if TYPE_CHECKING:
|
| 122 |
+
from github.CodeSecurityConfig import CodeSecurityConfig
|
| 123 |
+
from github.CodeSecurityConfigRepository import CodeSecurityConfigRepository
|
| 124 |
+
from github.Copilot import Copilot
|
| 125 |
+
from github.DefaultCodeSecurityConfig import DefaultCodeSecurityConfig
|
| 126 |
+
from github.Event import Event
|
| 127 |
+
from github.Hook import Hook
|
| 128 |
+
from github.Installation import Installation
|
| 129 |
+
from github.Issue import Issue
|
| 130 |
+
from github.Label import Label
|
| 131 |
+
from github.Migration import Migration
|
| 132 |
+
from github.NamedUser import NamedUser
|
| 133 |
+
from github.OrganizationCustomProperty import (
|
| 134 |
+
CustomProperty,
|
| 135 |
+
OrganizationCustomProperty,
|
| 136 |
+
RepositoryCustomPropertyValues,
|
| 137 |
+
)
|
| 138 |
+
from github.OrganizationDependabotAlert import OrganizationDependabotAlert
|
| 139 |
+
from github.OrganizationSecret import OrganizationSecret
|
| 140 |
+
from github.OrganizationVariable import OrganizationVariable
|
| 141 |
+
from github.Plan import Plan
|
| 142 |
+
from github.Project import Project
|
| 143 |
+
from github.PublicKey import PublicKey
|
| 144 |
+
from github.Repository import Repository
|
| 145 |
+
from github.Team import Team
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
class Organization(CompletableGithubObject):
|
| 149 |
+
"""
|
| 150 |
+
This class represents Organizations.
|
| 151 |
+
|
| 152 |
+
The reference can be found here
|
| 153 |
+
https://docs.github.com/en/rest/reference/orgs
|
| 154 |
+
|
| 155 |
+
The OpenAPI schema can be found at
|
| 156 |
+
- /components/schemas/actor
|
| 157 |
+
- /components/schemas/organization-full
|
| 158 |
+
- /components/schemas/organization-simple
|
| 159 |
+
- /components/schemas/team-organization
|
| 160 |
+
|
| 161 |
+
"""
|
| 162 |
+
|
| 163 |
+
def _initAttributes(self) -> None:
|
| 164 |
+
self._advanced_security_enabled_for_new_repositories: Attribute[bool] = NotSet
|
| 165 |
+
self._archived_at: Attribute[datetime] = NotSet
|
| 166 |
+
self._avatar_url: Attribute[str] = NotSet
|
| 167 |
+
self._billing_email: Attribute[str] = NotSet
|
| 168 |
+
self._blog: Attribute[str | None] = NotSet
|
| 169 |
+
self._collaborators: Attribute[int] = NotSet
|
| 170 |
+
self._company: Attribute[str] = NotSet
|
| 171 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 172 |
+
self._default_repository_permission: Attribute[str] = NotSet
|
| 173 |
+
self._dependabot_alerts_enabled_for_new_repositories: Attribute[bool] = NotSet
|
| 174 |
+
self._dependabot_security_updates_enabled_for_new_repositories: Attribute[bool] = NotSet
|
| 175 |
+
self._dependency_graph_enabled_for_new_repositories: Attribute[bool] = NotSet
|
| 176 |
+
self._description: Attribute[str] = NotSet
|
| 177 |
+
self._disk_usage: Attribute[int] = NotSet
|
| 178 |
+
self._display_login: Attribute[str] = NotSet
|
| 179 |
+
self._email: Attribute[str] = NotSet
|
| 180 |
+
self._events_url: Attribute[str] = NotSet
|
| 181 |
+
self._followers: Attribute[int] = NotSet
|
| 182 |
+
self._following: Attribute[int] = NotSet
|
| 183 |
+
self._gravatar_id: Attribute[str] = NotSet
|
| 184 |
+
self._has_organization_projects: Attribute[bool] = NotSet
|
| 185 |
+
self._has_repository_projects: Attribute[bool] = NotSet
|
| 186 |
+
self._hooks_url: Attribute[str] = NotSet
|
| 187 |
+
self._html_url: Attribute[str] = NotSet
|
| 188 |
+
self._id: Attribute[int] = NotSet
|
| 189 |
+
self._is_verified: Attribute[bool] = NotSet
|
| 190 |
+
self._issues_url: Attribute[str] = NotSet
|
| 191 |
+
self._location: Attribute[str] = NotSet
|
| 192 |
+
self._login: Attribute[str] = NotSet
|
| 193 |
+
self._members_allowed_repository_creation_type: Attribute[str] = NotSet
|
| 194 |
+
self._members_can_create_internal_repositories: Attribute[bool] = NotSet
|
| 195 |
+
self._members_can_create_pages: Attribute[bool] = NotSet
|
| 196 |
+
self._members_can_create_private_pages: Attribute[bool] = NotSet
|
| 197 |
+
self._members_can_create_private_repositories: Attribute[bool] = NotSet
|
| 198 |
+
self._members_can_create_public_pages: Attribute[bool] = NotSet
|
| 199 |
+
self._members_can_create_public_repositories: Attribute[bool] = NotSet
|
| 200 |
+
self._members_can_create_repositories: Attribute[bool] = NotSet
|
| 201 |
+
self._members_can_fork_private_repositories: Attribute[bool] = NotSet
|
| 202 |
+
self._members_url: Attribute[str] = NotSet
|
| 203 |
+
self._name: Attribute[str] = NotSet
|
| 204 |
+
self._node_id: Attribute[str] = NotSet
|
| 205 |
+
self._owned_private_repos: Attribute[int] = NotSet
|
| 206 |
+
self._plan: Attribute[Plan] = NotSet
|
| 207 |
+
self._private_gists: Attribute[int] = NotSet
|
| 208 |
+
self._public_gists: Attribute[int] = NotSet
|
| 209 |
+
self._public_members_url: Attribute[str] = NotSet
|
| 210 |
+
self._public_repos: Attribute[int] = NotSet
|
| 211 |
+
self._repos_url: Attribute[str] = NotSet
|
| 212 |
+
self._secret_scanning_enabled_for_new_repositories: Attribute[bool] = NotSet
|
| 213 |
+
self._secret_scanning_push_protection_custom_link: Attribute[str] = NotSet
|
| 214 |
+
self._secret_scanning_push_protection_custom_link_enabled: Attribute[bool] = NotSet
|
| 215 |
+
self._secret_scanning_push_protection_enabled_for_new_repositories: Attribute[bool] = NotSet
|
| 216 |
+
self._total_private_repos: Attribute[int] = NotSet
|
| 217 |
+
self._twitter_username: Attribute[str] = NotSet
|
| 218 |
+
self._two_factor_requirement_enabled: Attribute[bool] = NotSet
|
| 219 |
+
self._type: Attribute[str] = NotSet
|
| 220 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 221 |
+
self._url: Attribute[str] = NotSet
|
| 222 |
+
self._web_commit_signoff_required: Attribute[bool] = NotSet
|
| 223 |
+
|
| 224 |
+
def __repr__(self) -> str:
|
| 225 |
+
return self.get__repr__({"login": self._login.value})
|
| 226 |
+
|
| 227 |
+
@property
|
| 228 |
+
def advanced_security_enabled_for_new_repositories(self) -> bool:
|
| 229 |
+
self._completeIfNotSet(self._advanced_security_enabled_for_new_repositories)
|
| 230 |
+
return self._advanced_security_enabled_for_new_repositories.value
|
| 231 |
+
|
| 232 |
+
@property
|
| 233 |
+
def archived_at(self) -> datetime:
|
| 234 |
+
self._completeIfNotSet(self._archived_at)
|
| 235 |
+
return self._archived_at.value
|
| 236 |
+
|
| 237 |
+
@property
|
| 238 |
+
def avatar_url(self) -> str:
|
| 239 |
+
self._completeIfNotSet(self._avatar_url)
|
| 240 |
+
return self._avatar_url.value
|
| 241 |
+
|
| 242 |
+
@property
|
| 243 |
+
def billing_email(self) -> str:
|
| 244 |
+
self._completeIfNotSet(self._billing_email)
|
| 245 |
+
return self._billing_email.value
|
| 246 |
+
|
| 247 |
+
@property
|
| 248 |
+
def blog(self) -> str | None:
|
| 249 |
+
self._completeIfNotSet(self._blog)
|
| 250 |
+
return self._blog.value
|
| 251 |
+
|
| 252 |
+
@property
|
| 253 |
+
def collaborators(self) -> int:
|
| 254 |
+
self._completeIfNotSet(self._collaborators)
|
| 255 |
+
return self._collaborators.value
|
| 256 |
+
|
| 257 |
+
@property
|
| 258 |
+
def company(self) -> str | None:
|
| 259 |
+
self._completeIfNotSet(self._company)
|
| 260 |
+
return self._company.value
|
| 261 |
+
|
| 262 |
+
@property
|
| 263 |
+
def created_at(self) -> datetime:
|
| 264 |
+
self._completeIfNotSet(self._created_at)
|
| 265 |
+
return self._created_at.value
|
| 266 |
+
|
| 267 |
+
@property
|
| 268 |
+
def default_repository_permission(self) -> str:
|
| 269 |
+
self._completeIfNotSet(self._default_repository_permission)
|
| 270 |
+
return self._default_repository_permission.value
|
| 271 |
+
|
| 272 |
+
@property
|
| 273 |
+
def dependabot_alerts_enabled_for_new_repositories(self) -> bool:
|
| 274 |
+
self._completeIfNotSet(self._dependabot_alerts_enabled_for_new_repositories)
|
| 275 |
+
return self._dependabot_alerts_enabled_for_new_repositories.value
|
| 276 |
+
|
| 277 |
+
@property
|
| 278 |
+
def dependabot_security_updates_enabled_for_new_repositories(self) -> bool:
|
| 279 |
+
self._completeIfNotSet(self._dependabot_security_updates_enabled_for_new_repositories)
|
| 280 |
+
return self._dependabot_security_updates_enabled_for_new_repositories.value
|
| 281 |
+
|
| 282 |
+
@property
|
| 283 |
+
def dependency_graph_enabled_for_new_repositories(self) -> bool:
|
| 284 |
+
self._completeIfNotSet(self._dependency_graph_enabled_for_new_repositories)
|
| 285 |
+
return self._dependency_graph_enabled_for_new_repositories.value
|
| 286 |
+
|
| 287 |
+
@property
|
| 288 |
+
def description(self) -> str:
|
| 289 |
+
self._completeIfNotSet(self._description)
|
| 290 |
+
return self._description.value
|
| 291 |
+
|
| 292 |
+
@property
|
| 293 |
+
def disk_usage(self) -> int:
|
| 294 |
+
self._completeIfNotSet(self._disk_usage)
|
| 295 |
+
return self._disk_usage.value
|
| 296 |
+
|
| 297 |
+
@property
|
| 298 |
+
def display_login(self) -> str:
|
| 299 |
+
self._completeIfNotSet(self._display_login)
|
| 300 |
+
return self._display_login.value
|
| 301 |
+
|
| 302 |
+
@property
|
| 303 |
+
def email(self) -> str | None:
|
| 304 |
+
self._completeIfNotSet(self._email)
|
| 305 |
+
return self._email.value
|
| 306 |
+
|
| 307 |
+
@property
|
| 308 |
+
def events_url(self) -> str:
|
| 309 |
+
self._completeIfNotSet(self._events_url)
|
| 310 |
+
return self._events_url.value
|
| 311 |
+
|
| 312 |
+
@property
|
| 313 |
+
def followers(self) -> int:
|
| 314 |
+
self._completeIfNotSet(self._followers)
|
| 315 |
+
return self._followers.value
|
| 316 |
+
|
| 317 |
+
@property
|
| 318 |
+
def following(self) -> int:
|
| 319 |
+
self._completeIfNotSet(self._following)
|
| 320 |
+
return self._following.value
|
| 321 |
+
|
| 322 |
+
@property
|
| 323 |
+
def gravatar_id(self) -> str:
|
| 324 |
+
self._completeIfNotSet(self._gravatar_id)
|
| 325 |
+
return self._gravatar_id.value
|
| 326 |
+
|
| 327 |
+
@property
|
| 328 |
+
def has_organization_projects(self) -> bool:
|
| 329 |
+
self._completeIfNotSet(self._has_organization_projects)
|
| 330 |
+
return self._has_organization_projects.value
|
| 331 |
+
|
| 332 |
+
@property
|
| 333 |
+
def has_repository_projects(self) -> bool:
|
| 334 |
+
self._completeIfNotSet(self._has_repository_projects)
|
| 335 |
+
return self._has_repository_projects.value
|
| 336 |
+
|
| 337 |
+
@property
|
| 338 |
+
def hooks_url(self) -> str:
|
| 339 |
+
self._completeIfNotSet(self._hooks_url)
|
| 340 |
+
return self._hooks_url.value
|
| 341 |
+
|
| 342 |
+
@property
|
| 343 |
+
def html_url(self) -> str:
|
| 344 |
+
self._completeIfNotSet(self._html_url)
|
| 345 |
+
return self._html_url.value
|
| 346 |
+
|
| 347 |
+
@property
|
| 348 |
+
def id(self) -> int:
|
| 349 |
+
self._completeIfNotSet(self._id)
|
| 350 |
+
return self._id.value
|
| 351 |
+
|
| 352 |
+
@property
|
| 353 |
+
def is_verified(self) -> bool:
|
| 354 |
+
self._completeIfNotSet(self._is_verified)
|
| 355 |
+
return self._is_verified.value
|
| 356 |
+
|
| 357 |
+
@property
|
| 358 |
+
def issues_url(self) -> str:
|
| 359 |
+
self._completeIfNotSet(self._issues_url)
|
| 360 |
+
return self._issues_url.value
|
| 361 |
+
|
| 362 |
+
@property
|
| 363 |
+
def location(self) -> str:
|
| 364 |
+
self._completeIfNotSet(self._location)
|
| 365 |
+
return self._location.value
|
| 366 |
+
|
| 367 |
+
@property
|
| 368 |
+
def login(self) -> str:
|
| 369 |
+
self._completeIfNotSet(self._login)
|
| 370 |
+
return self._login.value
|
| 371 |
+
|
| 372 |
+
@property
|
| 373 |
+
def members_allowed_repository_creation_type(self) -> str:
|
| 374 |
+
self._completeIfNotSet(self._members_allowed_repository_creation_type)
|
| 375 |
+
return self._members_allowed_repository_creation_type.value
|
| 376 |
+
|
| 377 |
+
@property
|
| 378 |
+
def members_can_create_internal_repositories(self) -> bool:
|
| 379 |
+
self._completeIfNotSet(self._members_can_create_internal_repositories)
|
| 380 |
+
return self._members_can_create_internal_repositories.value
|
| 381 |
+
|
| 382 |
+
@property
|
| 383 |
+
def members_can_create_pages(self) -> bool:
|
| 384 |
+
self._completeIfNotSet(self._members_can_create_pages)
|
| 385 |
+
return self._members_can_create_pages.value
|
| 386 |
+
|
| 387 |
+
@property
|
| 388 |
+
def members_can_create_private_pages(self) -> bool:
|
| 389 |
+
self._completeIfNotSet(self._members_can_create_private_pages)
|
| 390 |
+
return self._members_can_create_private_pages.value
|
| 391 |
+
|
| 392 |
+
@property
|
| 393 |
+
def members_can_create_private_repositories(self) -> bool:
|
| 394 |
+
self._completeIfNotSet(self._members_can_create_private_repositories)
|
| 395 |
+
return self._members_can_create_private_repositories.value
|
| 396 |
+
|
| 397 |
+
@property
|
| 398 |
+
def members_can_create_public_pages(self) -> bool:
|
| 399 |
+
self._completeIfNotSet(self._members_can_create_public_pages)
|
| 400 |
+
return self._members_can_create_public_pages.value
|
| 401 |
+
|
| 402 |
+
@property
|
| 403 |
+
def members_can_create_public_repositories(self) -> bool:
|
| 404 |
+
self._completeIfNotSet(self._members_can_create_public_repositories)
|
| 405 |
+
return self._members_can_create_public_repositories.value
|
| 406 |
+
|
| 407 |
+
@property
|
| 408 |
+
def members_can_create_repositories(self) -> bool:
|
| 409 |
+
self._completeIfNotSet(self._members_can_create_repositories)
|
| 410 |
+
return self._members_can_create_repositories.value
|
| 411 |
+
|
| 412 |
+
@property
|
| 413 |
+
def members_can_fork_private_repositories(self) -> bool:
|
| 414 |
+
self._completeIfNotSet(self._members_can_fork_private_repositories)
|
| 415 |
+
return self._members_can_fork_private_repositories.value
|
| 416 |
+
|
| 417 |
+
@property
|
| 418 |
+
def members_url(self) -> str:
|
| 419 |
+
self._completeIfNotSet(self._members_url)
|
| 420 |
+
return self._members_url.value
|
| 421 |
+
|
| 422 |
+
@property
|
| 423 |
+
def name(self) -> str | None:
|
| 424 |
+
self._completeIfNotSet(self._name)
|
| 425 |
+
return self._name.value
|
| 426 |
+
|
| 427 |
+
@property
|
| 428 |
+
def node_id(self) -> str:
|
| 429 |
+
self._completeIfNotSet(self._node_id)
|
| 430 |
+
return self._node_id.value
|
| 431 |
+
|
| 432 |
+
@property
|
| 433 |
+
def owned_private_repos(self) -> int:
|
| 434 |
+
self._completeIfNotSet(self._owned_private_repos)
|
| 435 |
+
return self._owned_private_repos.value
|
| 436 |
+
|
| 437 |
+
@property
|
| 438 |
+
def plan(self) -> Plan:
|
| 439 |
+
self._completeIfNotSet(self._plan)
|
| 440 |
+
return self._plan.value
|
| 441 |
+
|
| 442 |
+
@property
|
| 443 |
+
def private_gists(self) -> int:
|
| 444 |
+
self._completeIfNotSet(self._private_gists)
|
| 445 |
+
return self._private_gists.value
|
| 446 |
+
|
| 447 |
+
@property
|
| 448 |
+
def public_gists(self) -> int:
|
| 449 |
+
self._completeIfNotSet(self._public_gists)
|
| 450 |
+
return self._public_gists.value
|
| 451 |
+
|
| 452 |
+
@property
|
| 453 |
+
def public_members_url(self) -> str:
|
| 454 |
+
self._completeIfNotSet(self._public_members_url)
|
| 455 |
+
return self._public_members_url.value
|
| 456 |
+
|
| 457 |
+
@property
|
| 458 |
+
def public_repos(self) -> int:
|
| 459 |
+
self._completeIfNotSet(self._public_repos)
|
| 460 |
+
return self._public_repos.value
|
| 461 |
+
|
| 462 |
+
@property
|
| 463 |
+
def repos_url(self) -> str:
|
| 464 |
+
self._completeIfNotSet(self._repos_url)
|
| 465 |
+
return self._repos_url.value
|
| 466 |
+
|
| 467 |
+
@property
|
| 468 |
+
def secret_scanning_enabled_for_new_repositories(self) -> bool:
|
| 469 |
+
self._completeIfNotSet(self._secret_scanning_enabled_for_new_repositories)
|
| 470 |
+
return self._secret_scanning_enabled_for_new_repositories.value
|
| 471 |
+
|
| 472 |
+
@property
|
| 473 |
+
def secret_scanning_push_protection_custom_link(self) -> str:
|
| 474 |
+
self._completeIfNotSet(self._secret_scanning_push_protection_custom_link)
|
| 475 |
+
return self._secret_scanning_push_protection_custom_link.value
|
| 476 |
+
|
| 477 |
+
@property
|
| 478 |
+
def secret_scanning_push_protection_custom_link_enabled(self) -> bool:
|
| 479 |
+
self._completeIfNotSet(self._secret_scanning_push_protection_custom_link_enabled)
|
| 480 |
+
return self._secret_scanning_push_protection_custom_link_enabled.value
|
| 481 |
+
|
| 482 |
+
@property
|
| 483 |
+
def secret_scanning_push_protection_enabled_for_new_repositories(self) -> bool:
|
| 484 |
+
self._completeIfNotSet(self._secret_scanning_push_protection_enabled_for_new_repositories)
|
| 485 |
+
return self._secret_scanning_push_protection_enabled_for_new_repositories.value
|
| 486 |
+
|
| 487 |
+
@property
|
| 488 |
+
def total_private_repos(self) -> int:
|
| 489 |
+
self._completeIfNotSet(self._total_private_repos)
|
| 490 |
+
return self._total_private_repos.value
|
| 491 |
+
|
| 492 |
+
@property
|
| 493 |
+
def twitter_username(self) -> str:
|
| 494 |
+
self._completeIfNotSet(self._twitter_username)
|
| 495 |
+
return self._twitter_username.value
|
| 496 |
+
|
| 497 |
+
@property
|
| 498 |
+
def two_factor_requirement_enabled(self) -> bool:
|
| 499 |
+
self._completeIfNotSet(self._two_factor_requirement_enabled)
|
| 500 |
+
return self._two_factor_requirement_enabled.value
|
| 501 |
+
|
| 502 |
+
@property
|
| 503 |
+
def type(self) -> str:
|
| 504 |
+
self._completeIfNotSet(self._type)
|
| 505 |
+
return self._type.value
|
| 506 |
+
|
| 507 |
+
@property
|
| 508 |
+
def updated_at(self) -> datetime:
|
| 509 |
+
self._completeIfNotSet(self._updated_at)
|
| 510 |
+
return self._updated_at.value
|
| 511 |
+
|
| 512 |
+
@property
|
| 513 |
+
def url(self) -> str:
|
| 514 |
+
self._completeIfNotSet(self._url)
|
| 515 |
+
return self._url.value
|
| 516 |
+
|
| 517 |
+
@property
|
| 518 |
+
def web_commit_signoff_required(self) -> bool:
|
| 519 |
+
self._completeIfNotSet(self._web_commit_signoff_required)
|
| 520 |
+
return self._web_commit_signoff_required.value
|
| 521 |
+
|
| 522 |
+
def add_to_members(self, member: NamedUser, role: Opt[str] = NotSet) -> None:
|
| 523 |
+
"""
|
| 524 |
+
:calls: `PUT /orgs/{org}/memberships/{user} <https://docs.github.com/en/rest/reference/orgs#update-an-organization-membership-for-the-authenticated-user>`_
|
| 525 |
+
"""
|
| 526 |
+
assert is_optional(role, str), role
|
| 527 |
+
assert isinstance(member, github.NamedUser.NamedUser), member
|
| 528 |
+
put_parameters = NotSet.remove_unset_items({"role": role})
|
| 529 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 530 |
+
"PUT", f"{self.url}/memberships/{member._identity}", input=put_parameters
|
| 531 |
+
)
|
| 532 |
+
|
| 533 |
+
def add_to_public_members(self, public_member: NamedUser) -> None:
|
| 534 |
+
"""
|
| 535 |
+
:calls: `PUT /orgs/{org}/public_members/{user} <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 536 |
+
"""
|
| 537 |
+
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
| 538 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 539 |
+
"PUT", f"{self.url}/public_members/{public_member._identity}"
|
| 540 |
+
)
|
| 541 |
+
|
| 542 |
+
def create_fork(
|
| 543 |
+
self,
|
| 544 |
+
repo: Repository,
|
| 545 |
+
name: Opt[str] = NotSet,
|
| 546 |
+
default_branch_only: Opt[bool] = NotSet,
|
| 547 |
+
) -> Repository:
|
| 548 |
+
"""
|
| 549 |
+
:calls: `POST /repos/{owner}/{repo}/forks <https://docs.github.com/en/rest/reference/repos#forks>`_
|
| 550 |
+
"""
|
| 551 |
+
assert isinstance(repo, github.Repository.Repository), repo
|
| 552 |
+
return repo.create_fork(
|
| 553 |
+
self,
|
| 554 |
+
name=name,
|
| 555 |
+
default_branch_only=default_branch_only,
|
| 556 |
+
)
|
| 557 |
+
|
| 558 |
+
def create_repo_from_template(
|
| 559 |
+
self,
|
| 560 |
+
name: str,
|
| 561 |
+
repo: Repository,
|
| 562 |
+
description: Opt[str] = NotSet,
|
| 563 |
+
include_all_branches: Opt[bool] = NotSet,
|
| 564 |
+
private: Opt[bool] = NotSet,
|
| 565 |
+
) -> Repository:
|
| 566 |
+
"""self.name
|
| 567 |
+
:calls: `POST /repos/{template_owner}/{template_repo}/generate <https://docs.github.com/en/rest/reference/repos#create-a-repository-using-a-template>`_
|
| 568 |
+
"""
|
| 569 |
+
assert isinstance(name, str), name
|
| 570 |
+
assert isinstance(repo, github.Repository.Repository), repo
|
| 571 |
+
assert is_optional(description, str), description
|
| 572 |
+
assert is_optional(include_all_branches, bool), include_all_branches
|
| 573 |
+
assert is_optional(private, bool), private
|
| 574 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 575 |
+
{
|
| 576 |
+
"name": name,
|
| 577 |
+
"owner": self.login,
|
| 578 |
+
"description": description,
|
| 579 |
+
"include_all_branches": include_all_branches,
|
| 580 |
+
"private": private,
|
| 581 |
+
}
|
| 582 |
+
)
|
| 583 |
+
|
| 584 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 585 |
+
"POST",
|
| 586 |
+
f"/repos/{repo.owner.login}/{repo.name}/generate",
|
| 587 |
+
input=post_parameters,
|
| 588 |
+
headers={"Accept": "application/vnd.github.v3+json"},
|
| 589 |
+
)
|
| 590 |
+
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
| 591 |
+
|
| 592 |
+
def create_hook(
|
| 593 |
+
self,
|
| 594 |
+
name: str,
|
| 595 |
+
config: dict[str, str],
|
| 596 |
+
events: Opt[list[str]] = NotSet,
|
| 597 |
+
active: Opt[bool] = NotSet,
|
| 598 |
+
) -> Hook:
|
| 599 |
+
"""
|
| 600 |
+
:calls: `POST /orgs/{owner}/hooks <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
|
| 601 |
+
:param name: string
|
| 602 |
+
:param config: dict
|
| 603 |
+
:param events: list of string
|
| 604 |
+
:param active: bool
|
| 605 |
+
:rtype: :class:`github.Hook.Hook`
|
| 606 |
+
"""
|
| 607 |
+
assert isinstance(name, str), name
|
| 608 |
+
assert isinstance(config, dict), config
|
| 609 |
+
assert is_optional_list(events, str), events
|
| 610 |
+
assert is_optional(active, bool), active
|
| 611 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 612 |
+
{
|
| 613 |
+
"name": name,
|
| 614 |
+
"config": config,
|
| 615 |
+
"events": events,
|
| 616 |
+
"active": active,
|
| 617 |
+
}
|
| 618 |
+
)
|
| 619 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/hooks", input=post_parameters)
|
| 620 |
+
return github.Hook.Hook(self._requester, headers, data, completed=True)
|
| 621 |
+
|
| 622 |
+
def create_project(self, name: str, body: Opt[str] = NotSet) -> github.Project.Project:
|
| 623 |
+
"""
|
| 624 |
+
:calls: `POST /orgs/{org}/projects <https://docs.github.com/en/rest/reference/projects#create-an-organization-project>`_
|
| 625 |
+
"""
|
| 626 |
+
assert isinstance(name, str), name
|
| 627 |
+
assert is_optional(body, str), body
|
| 628 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items({"name": name, "body": body})
|
| 629 |
+
|
| 630 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 631 |
+
"POST",
|
| 632 |
+
f"{self.url}/projects",
|
| 633 |
+
input=post_parameters,
|
| 634 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 635 |
+
)
|
| 636 |
+
return github.Project.Project(self._requester, headers, data, completed=True)
|
| 637 |
+
|
| 638 |
+
def create_repo(
|
| 639 |
+
self,
|
| 640 |
+
name: str,
|
| 641 |
+
description: Opt[str] = NotSet,
|
| 642 |
+
homepage: Opt[str] = NotSet,
|
| 643 |
+
private: Opt[bool] = NotSet,
|
| 644 |
+
visibility: Opt[str] = NotSet,
|
| 645 |
+
has_issues: Opt[bool] = NotSet,
|
| 646 |
+
has_wiki: Opt[bool] = NotSet,
|
| 647 |
+
has_downloads: Opt[bool] = NotSet,
|
| 648 |
+
has_projects: Opt[bool] = NotSet,
|
| 649 |
+
team_id: Opt[int] = NotSet,
|
| 650 |
+
auto_init: Opt[bool] = NotSet,
|
| 651 |
+
license_template: Opt[str] = NotSet,
|
| 652 |
+
gitignore_template: Opt[str] = NotSet,
|
| 653 |
+
allow_squash_merge: Opt[bool] = NotSet,
|
| 654 |
+
allow_merge_commit: Opt[bool] = NotSet,
|
| 655 |
+
allow_rebase_merge: Opt[bool] = NotSet,
|
| 656 |
+
delete_branch_on_merge: Opt[bool] = NotSet,
|
| 657 |
+
allow_update_branch: Opt[bool] = NotSet,
|
| 658 |
+
is_template: Opt[bool] = NotSet,
|
| 659 |
+
allow_auto_merge: Opt[bool] = NotSet,
|
| 660 |
+
use_squash_pr_title_as_default: Opt[bool] = NotSet,
|
| 661 |
+
squash_merge_commit_title: Opt[str] = NotSet,
|
| 662 |
+
squash_merge_commit_message: Opt[str] = NotSet,
|
| 663 |
+
merge_commit_title: Opt[str] = NotSet,
|
| 664 |
+
merge_commit_message: Opt[str] = NotSet,
|
| 665 |
+
custom_properties: Opt[dict[str, Any]] = NotSet,
|
| 666 |
+
) -> github.Repository.Repository:
|
| 667 |
+
"""
|
| 668 |
+
:calls: `POST /orgs/{org}/repos <https://docs.github.com/en/rest/reference/repos>`_
|
| 669 |
+
"""
|
| 670 |
+
assert isinstance(name, str), name
|
| 671 |
+
assert is_optional(description, str), description
|
| 672 |
+
assert is_optional(homepage, str), homepage
|
| 673 |
+
assert is_optional(private, bool), private
|
| 674 |
+
assert is_optional(visibility, str), visibility
|
| 675 |
+
assert is_optional(has_issues, bool), has_issues
|
| 676 |
+
assert is_optional(has_wiki, bool), has_wiki
|
| 677 |
+
assert is_optional(has_downloads, bool), has_downloads
|
| 678 |
+
assert is_optional(has_projects, bool), has_projects
|
| 679 |
+
assert is_optional(team_id, int), team_id
|
| 680 |
+
assert is_optional(auto_init, bool), auto_init
|
| 681 |
+
assert is_optional(license_template, str), license_template
|
| 682 |
+
assert is_optional(gitignore_template, str), gitignore_template
|
| 683 |
+
assert is_optional(allow_squash_merge, bool), allow_squash_merge
|
| 684 |
+
assert is_optional(allow_merge_commit, bool), allow_merge_commit
|
| 685 |
+
assert is_optional(allow_rebase_merge, bool), allow_rebase_merge
|
| 686 |
+
assert is_optional(delete_branch_on_merge, bool), delete_branch_on_merge
|
| 687 |
+
assert is_optional(allow_update_branch, bool), allow_update_branch
|
| 688 |
+
assert is_optional(is_template, bool), is_template
|
| 689 |
+
assert is_optional(allow_auto_merge, bool), allow_auto_merge
|
| 690 |
+
assert is_optional(use_squash_pr_title_as_default, bool), use_squash_pr_title_as_default
|
| 691 |
+
assert squash_merge_commit_title in ["PR_TITLE", "COMMIT_OR_PR_TITLE", NotSet], squash_merge_commit_title
|
| 692 |
+
assert squash_merge_commit_message in [
|
| 693 |
+
"PR_BODY",
|
| 694 |
+
"COMMIT_MESSAGES",
|
| 695 |
+
"BLANK",
|
| 696 |
+
NotSet,
|
| 697 |
+
], squash_merge_commit_message
|
| 698 |
+
assert merge_commit_title in ["PR_TITLE", "MERGE_MESSAGE", NotSet], merge_commit_title
|
| 699 |
+
assert merge_commit_message in ["PR_TITLE", "PR_BODY", "BLANK", NotSet], merge_commit_message
|
| 700 |
+
assert is_optional(custom_properties, dict), custom_properties
|
| 701 |
+
post_parameters = NotSet.remove_unset_items(
|
| 702 |
+
{
|
| 703 |
+
"name": name,
|
| 704 |
+
"description": description,
|
| 705 |
+
"homepage": homepage,
|
| 706 |
+
"private": private,
|
| 707 |
+
"visibility": visibility,
|
| 708 |
+
"has_issues": has_issues,
|
| 709 |
+
"has_wiki": has_wiki,
|
| 710 |
+
"has_downloads": has_downloads,
|
| 711 |
+
"has_projects": has_projects,
|
| 712 |
+
"team_id": team_id,
|
| 713 |
+
"auto_init": auto_init,
|
| 714 |
+
"license_template": license_template,
|
| 715 |
+
"gitignore_template": gitignore_template,
|
| 716 |
+
"allow_squash_merge": allow_squash_merge,
|
| 717 |
+
"allow_merge_commit": allow_merge_commit,
|
| 718 |
+
"allow_rebase_merge": allow_rebase_merge,
|
| 719 |
+
"delete_branch_on_merge": delete_branch_on_merge,
|
| 720 |
+
"allow_update_branch": allow_update_branch,
|
| 721 |
+
"is_template": is_template,
|
| 722 |
+
"allow_auto_merge": allow_auto_merge,
|
| 723 |
+
"use_squash_pr_title_as_default": use_squash_pr_title_as_default,
|
| 724 |
+
"squash_merge_commit_title": squash_merge_commit_title,
|
| 725 |
+
"squash_merge_commit_message": squash_merge_commit_message,
|
| 726 |
+
"merge_commit_title": merge_commit_title,
|
| 727 |
+
"merge_commit_message": merge_commit_message,
|
| 728 |
+
"custom_properties": custom_properties,
|
| 729 |
+
}
|
| 730 |
+
)
|
| 731 |
+
|
| 732 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 733 |
+
"POST",
|
| 734 |
+
f"{self.url}/repos",
|
| 735 |
+
input=post_parameters,
|
| 736 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 737 |
+
)
|
| 738 |
+
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
| 739 |
+
|
| 740 |
+
def create_secret(
|
| 741 |
+
self,
|
| 742 |
+
secret_name: str,
|
| 743 |
+
unencrypted_value: str,
|
| 744 |
+
visibility: str = "all",
|
| 745 |
+
selected_repositories: Opt[list[github.Repository.Repository]] = NotSet,
|
| 746 |
+
secret_type: str = "actions",
|
| 747 |
+
) -> github.OrganizationSecret.OrganizationSecret:
|
| 748 |
+
"""
|
| 749 |
+
:param secret_name: string name of the secret
|
| 750 |
+
:param unencrypted_value: string plain text value of the secret
|
| 751 |
+
:param visibility: string options all or selected
|
| 752 |
+
:param selected_repositories: list of repositrories that the secret will be available in
|
| 753 |
+
:param secret_type: string options actions or dependabot
|
| 754 |
+
|
| 755 |
+
:calls: `PUT /orgs/{org}/{secret_type}/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#create-or-update-an-organization-secret>`_
|
| 756 |
+
"""
|
| 757 |
+
assert isinstance(secret_name, str), secret_name
|
| 758 |
+
assert isinstance(unencrypted_value, str), unencrypted_value
|
| 759 |
+
assert isinstance(visibility, str), visibility
|
| 760 |
+
assert is_optional_list(selected_repositories, github.Repository.Repository), selected_repositories
|
| 761 |
+
assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
|
| 762 |
+
|
| 763 |
+
if visibility == "selected":
|
| 764 |
+
assert isinstance(selected_repositories, list) and all(
|
| 765 |
+
isinstance(element, github.Repository.Repository) for element in selected_repositories
|
| 766 |
+
), selected_repositories
|
| 767 |
+
else:
|
| 768 |
+
assert selected_repositories is NotSet
|
| 769 |
+
|
| 770 |
+
public_key = self.get_public_key(secret_type=secret_type)
|
| 771 |
+
payload = public_key.encrypt(unencrypted_value)
|
| 772 |
+
put_parameters: dict[str, Any] = {
|
| 773 |
+
"key_id": public_key.key_id,
|
| 774 |
+
"encrypted_value": payload,
|
| 775 |
+
"visibility": visibility,
|
| 776 |
+
}
|
| 777 |
+
if is_defined(selected_repositories):
|
| 778 |
+
# Dependbot and Actions endpoint expects different types
|
| 779 |
+
# https://docs.github.com/en/rest/dependabot/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
|
| 780 |
+
# https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
|
| 781 |
+
if secret_type == "actions":
|
| 782 |
+
put_parameters["selected_repository_ids"] = [element.id for element in selected_repositories]
|
| 783 |
+
if secret_type == "dependabot":
|
| 784 |
+
put_parameters["selected_repository_ids"] = [str(element.id) for element in selected_repositories]
|
| 785 |
+
|
| 786 |
+
self._requester.requestJsonAndCheck(
|
| 787 |
+
"PUT", f"{self.url}/{secret_type}/secrets/{urllib.parse.quote(secret_name)}", input=put_parameters
|
| 788 |
+
)
|
| 789 |
+
|
| 790 |
+
return github.OrganizationSecret.OrganizationSecret(
|
| 791 |
+
requester=self._requester,
|
| 792 |
+
headers={},
|
| 793 |
+
attributes={
|
| 794 |
+
"name": secret_name,
|
| 795 |
+
"visibility": visibility,
|
| 796 |
+
"selected_repositories_url": f"{self.url}/{secret_type}/secrets/{urllib.parse.quote(secret_name)}/repositories",
|
| 797 |
+
"url": f"{self.url}/{secret_type}/secrets/{urllib.parse.quote(secret_name)}",
|
| 798 |
+
},
|
| 799 |
+
completed=False,
|
| 800 |
+
)
|
| 801 |
+
|
| 802 |
+
def get_secrets(self, secret_type: str = "actions") -> PaginatedList[OrganizationSecret]:
|
| 803 |
+
"""
|
| 804 |
+
Gets all organization secrets :param secret_type: string options actions or dependabot :rtype:
|
| 805 |
+
|
| 806 |
+
:class:`PaginatedList` of :class:`github.OrganizationSecret.OrganizationSecret`
|
| 807 |
+
|
| 808 |
+
"""
|
| 809 |
+
assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
|
| 810 |
+
return PaginatedList(
|
| 811 |
+
github.OrganizationSecret.OrganizationSecret,
|
| 812 |
+
self._requester,
|
| 813 |
+
f"{self.url}/{secret_type}/secrets",
|
| 814 |
+
None,
|
| 815 |
+
list_item="secrets",
|
| 816 |
+
)
|
| 817 |
+
|
| 818 |
+
def get_secret(self, secret_name: str, secret_type: str = "actions") -> OrganizationSecret:
|
| 819 |
+
"""
|
| 820 |
+
:calls: 'GET /orgs/{org}/{secret_type}/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#get-an-organization-secret>`_
|
| 821 |
+
:param secret_name: string
|
| 822 |
+
:param secret_type: string options actions or dependabot
|
| 823 |
+
:rtype: github.OrganizationSecret.OrganizationSecret
|
| 824 |
+
"""
|
| 825 |
+
assert isinstance(secret_name, str), secret_name
|
| 826 |
+
assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
|
| 827 |
+
return github.OrganizationSecret.OrganizationSecret(
|
| 828 |
+
requester=self._requester,
|
| 829 |
+
headers={},
|
| 830 |
+
attributes={"url": f"{self.url}/{secret_type}/secrets/{urllib.parse.quote(secret_name)}"},
|
| 831 |
+
completed=False,
|
| 832 |
+
)
|
| 833 |
+
|
| 834 |
+
def create_team(
|
| 835 |
+
self,
|
| 836 |
+
name: str,
|
| 837 |
+
repo_names: Opt[list[Repository]] = NotSet,
|
| 838 |
+
permission: Opt[str] = NotSet,
|
| 839 |
+
privacy: Opt[str] = NotSet,
|
| 840 |
+
description: Opt[str] = NotSet,
|
| 841 |
+
parent_team_id: Opt[int] = NotSet,
|
| 842 |
+
maintainers: Opt[list[int]] = NotSet,
|
| 843 |
+
notification_setting: Opt[str] = NotSet,
|
| 844 |
+
) -> Team:
|
| 845 |
+
"""
|
| 846 |
+
:calls: `POST /orgs/{org}/teams <https://docs.github.com/en/rest/reference/teams#list-teams>`_
|
| 847 |
+
:param name: string
|
| 848 |
+
:param repo_names: list of :class:`github.Repository.Repository`
|
| 849 |
+
:param permission: string
|
| 850 |
+
:param privacy: string
|
| 851 |
+
:param description: string
|
| 852 |
+
:param parent_team_id: integer
|
| 853 |
+
:param maintainers: list of: integer
|
| 854 |
+
:param notification_setting: string
|
| 855 |
+
:rtype: :class:`github.Team.Team`
|
| 856 |
+
"""
|
| 857 |
+
assert isinstance(name, str), name
|
| 858 |
+
assert is_optional_list(repo_names, github.Repository.Repository), repo_names
|
| 859 |
+
assert is_optional_list(maintainers, int), maintainers
|
| 860 |
+
assert is_optional(parent_team_id, int), parent_team_id
|
| 861 |
+
assert is_optional(permission, str), permission
|
| 862 |
+
assert is_optional(privacy, str), privacy
|
| 863 |
+
assert is_optional(description, str), description
|
| 864 |
+
assert notification_setting in ["notifications_enabled", "notifications_disabled", NotSet], notification_setting
|
| 865 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 866 |
+
{
|
| 867 |
+
"name": name,
|
| 868 |
+
"permission": permission,
|
| 869 |
+
"privacy": privacy,
|
| 870 |
+
"description": description,
|
| 871 |
+
"parent_team_id": parent_team_id,
|
| 872 |
+
"maintainers": maintainers,
|
| 873 |
+
"notification_setting": notification_setting,
|
| 874 |
+
}
|
| 875 |
+
)
|
| 876 |
+
if is_defined(repo_names):
|
| 877 |
+
post_parameters["repo_names"] = [element._identity for element in repo_names]
|
| 878 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/teams", input=post_parameters)
|
| 879 |
+
return github.Team.Team(self._requester, headers, data, completed=True)
|
| 880 |
+
|
| 881 |
+
def create_variable(
|
| 882 |
+
self,
|
| 883 |
+
variable_name: str,
|
| 884 |
+
value: str,
|
| 885 |
+
visibility: str = "all",
|
| 886 |
+
selected_repositories: github.GithubObject.Opt[list[github.Repository.Repository]] = NotSet,
|
| 887 |
+
) -> github.OrganizationVariable.OrganizationVariable:
|
| 888 |
+
"""
|
| 889 |
+
:calls: `POST /orgs/{org}/actions/variables/ <https://docs.github.com/en/rest/actions/variables#create-an-organization-variable>`_
|
| 890 |
+
:param variable_name: string
|
| 891 |
+
:param value: string
|
| 892 |
+
:param visibility: string
|
| 893 |
+
:param selected_repositories: list of :class:`github.Repository.Repository`
|
| 894 |
+
:rtype: github.OrganizationVariable.OrganizationVariable
|
| 895 |
+
"""
|
| 896 |
+
assert isinstance(variable_name, str), variable_name
|
| 897 |
+
assert isinstance(value, str), value
|
| 898 |
+
assert isinstance(visibility, str), visibility
|
| 899 |
+
if visibility == "selected":
|
| 900 |
+
assert isinstance(selected_repositories, list) and all(
|
| 901 |
+
isinstance(element, github.Repository.Repository) for element in selected_repositories
|
| 902 |
+
), selected_repositories
|
| 903 |
+
else:
|
| 904 |
+
assert selected_repositories is NotSet
|
| 905 |
+
|
| 906 |
+
post_parameters: dict[str, Any] = {
|
| 907 |
+
"name": variable_name,
|
| 908 |
+
"value": value,
|
| 909 |
+
"visibility": visibility,
|
| 910 |
+
}
|
| 911 |
+
if is_defined(selected_repositories):
|
| 912 |
+
post_parameters["selected_repository_ids"] = [element.id for element in selected_repositories]
|
| 913 |
+
|
| 914 |
+
self._requester.requestJsonAndCheck("POST", f"{self.url}/actions/variables", input=post_parameters)
|
| 915 |
+
|
| 916 |
+
return github.OrganizationVariable.OrganizationVariable(
|
| 917 |
+
requester=self._requester,
|
| 918 |
+
headers={},
|
| 919 |
+
attributes={
|
| 920 |
+
"name": variable_name,
|
| 921 |
+
"visibility": visibility,
|
| 922 |
+
"value": value,
|
| 923 |
+
"selected_repositories_url": f"{self.url}/actions/variables/{urllib.parse.quote(variable_name)}/repositories",
|
| 924 |
+
"url": self.url,
|
| 925 |
+
},
|
| 926 |
+
completed=False,
|
| 927 |
+
)
|
| 928 |
+
|
| 929 |
+
def get_variables(self) -> PaginatedList[OrganizationVariable]:
|
| 930 |
+
"""
|
| 931 |
+
Gets all organization variables :rtype: :class:`PaginatedList` of
|
| 932 |
+
:class:`github.OrganizationVariable.OrganizationVariable`
|
| 933 |
+
"""
|
| 934 |
+
return PaginatedList(
|
| 935 |
+
github.OrganizationVariable.OrganizationVariable,
|
| 936 |
+
self._requester,
|
| 937 |
+
f"{self.url}/actions/variables",
|
| 938 |
+
None,
|
| 939 |
+
list_item="variables",
|
| 940 |
+
)
|
| 941 |
+
|
| 942 |
+
def get_variable(self, variable_name: str) -> OrganizationVariable:
|
| 943 |
+
"""
|
| 944 |
+
:calls: 'GET /orgs/{org}/actions/variables/{variable_name} <https://docs.github.com/en/rest/actions/variables#get-an-organization-variable>`_
|
| 945 |
+
:param variable_name: string
|
| 946 |
+
:rtype: github.OrganizationVariable.OrganizationVariable
|
| 947 |
+
"""
|
| 948 |
+
assert isinstance(variable_name, str), variable_name
|
| 949 |
+
return github.OrganizationVariable.OrganizationVariable(
|
| 950 |
+
requester=self._requester,
|
| 951 |
+
headers={},
|
| 952 |
+
attributes={"url": f"{self.url}/actions/variables/{urllib.parse.quote(variable_name)}"},
|
| 953 |
+
completed=False,
|
| 954 |
+
)
|
| 955 |
+
|
| 956 |
+
def delete_hook(self, id: int) -> None:
|
| 957 |
+
"""
|
| 958 |
+
:calls: `DELETE /orgs/{owner}/hooks/{id} <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
|
| 959 |
+
:param id: integer
|
| 960 |
+
:rtype: None`
|
| 961 |
+
"""
|
| 962 |
+
assert isinstance(id, int), id
|
| 963 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/hooks/{id}")
|
| 964 |
+
|
| 965 |
+
def edit(
|
| 966 |
+
self,
|
| 967 |
+
billing_email: Opt[str] = NotSet,
|
| 968 |
+
blog: Opt[str] = NotSet,
|
| 969 |
+
company: Opt[str] = NotSet,
|
| 970 |
+
description: Opt[str] = NotSet,
|
| 971 |
+
email: Opt[str] = NotSet,
|
| 972 |
+
location: Opt[str] = NotSet,
|
| 973 |
+
name: Opt[str] = NotSet,
|
| 974 |
+
) -> None:
|
| 975 |
+
"""
|
| 976 |
+
:calls: `PATCH /orgs/{org} <https://docs.github.com/en/rest/reference/orgs>`_
|
| 977 |
+
"""
|
| 978 |
+
assert is_optional(billing_email, str), billing_email
|
| 979 |
+
assert is_optional(blog, str), blog
|
| 980 |
+
assert is_optional(company, str), company
|
| 981 |
+
assert is_optional(description, str), description
|
| 982 |
+
assert is_optional(email, str), email
|
| 983 |
+
assert is_optional(location, str), location
|
| 984 |
+
assert is_optional(name, str), name
|
| 985 |
+
post_parameters = NotSet.remove_unset_items(
|
| 986 |
+
{
|
| 987 |
+
"billing_email": billing_email,
|
| 988 |
+
"blog": blog,
|
| 989 |
+
"company": company,
|
| 990 |
+
"description": description,
|
| 991 |
+
"email": email,
|
| 992 |
+
"location": location,
|
| 993 |
+
"name": name,
|
| 994 |
+
}
|
| 995 |
+
)
|
| 996 |
+
|
| 997 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 998 |
+
self._useAttributes(data)
|
| 999 |
+
|
| 1000 |
+
def edit_hook(
|
| 1001 |
+
self,
|
| 1002 |
+
id: int,
|
| 1003 |
+
name: str,
|
| 1004 |
+
config: dict[str, str],
|
| 1005 |
+
events: Opt[list[str]] = NotSet,
|
| 1006 |
+
active: Opt[bool] = NotSet,
|
| 1007 |
+
) -> Hook:
|
| 1008 |
+
"""
|
| 1009 |
+
:calls: `PATCH /orgs/{owner}/hooks/{id} <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
|
| 1010 |
+
"""
|
| 1011 |
+
assert isinstance(id, int), id
|
| 1012 |
+
assert isinstance(name, str), name
|
| 1013 |
+
assert isinstance(config, dict), config
|
| 1014 |
+
assert is_optional_list(events, str), events
|
| 1015 |
+
assert is_optional(active, bool), active
|
| 1016 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 1017 |
+
{"name": name, "config": config, "events": events, "active": active}
|
| 1018 |
+
)
|
| 1019 |
+
|
| 1020 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", f"{self.url}/hooks/{id}", input=post_parameters)
|
| 1021 |
+
return github.Hook.Hook(self._requester, headers, data, completed=True)
|
| 1022 |
+
|
| 1023 |
+
def get_events(self) -> PaginatedList[Event]:
|
| 1024 |
+
"""
|
| 1025 |
+
:calls: `GET /orgs/{org}/events <https://docs.github.com/en/rest/reference/activity#events>`_
|
| 1026 |
+
:rtype: :class:`PaginatedList` of :class:`github.Event.Event`
|
| 1027 |
+
"""
|
| 1028 |
+
return PaginatedList(github.Event.Event, self._requester, f"{self.url}/events", None)
|
| 1029 |
+
|
| 1030 |
+
def get_hook(self, id: int) -> github.Hook.Hook:
|
| 1031 |
+
"""
|
| 1032 |
+
:calls: `GET /orgs/{owner}/hooks/{id} <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
|
| 1033 |
+
"""
|
| 1034 |
+
assert isinstance(id, int), id
|
| 1035 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/hooks/{id}")
|
| 1036 |
+
return github.Hook.Hook(self._requester, headers, data, completed=True)
|
| 1037 |
+
|
| 1038 |
+
def get_hooks(self) -> PaginatedList[Hook]:
|
| 1039 |
+
"""
|
| 1040 |
+
:calls: `GET /orgs/{owner}/hooks <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
|
| 1041 |
+
"""
|
| 1042 |
+
return PaginatedList(github.Hook.Hook, self._requester, f"{self.url}/hooks", None)
|
| 1043 |
+
|
| 1044 |
+
def get_hook_delivery(self, hook_id: int, delivery_id: int) -> github.HookDelivery.HookDelivery:
|
| 1045 |
+
"""
|
| 1046 |
+
:calls: `GET /orgs/{owner}/hooks/{hook_id}/deliveries/{delivery_id} <https://docs.github.com/en/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook>`_
|
| 1047 |
+
:param hook_id: integer
|
| 1048 |
+
:param delivery_id: integer
|
| 1049 |
+
:rtype: :class:`github.HookDelivery.HookDelivery`
|
| 1050 |
+
"""
|
| 1051 |
+
assert isinstance(hook_id, int), hook_id
|
| 1052 |
+
assert isinstance(delivery_id, int), delivery_id
|
| 1053 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1054 |
+
"GET", f"{self.url}/hooks/{hook_id}/deliveries/{delivery_id}"
|
| 1055 |
+
)
|
| 1056 |
+
return github.HookDelivery.HookDelivery(self._requester, headers, data)
|
| 1057 |
+
|
| 1058 |
+
def get_hook_deliveries(self, hook_id: int) -> PaginatedList[github.HookDelivery.HookDeliverySummary]:
|
| 1059 |
+
"""
|
| 1060 |
+
:calls: `GET /orgs/{owner}/hooks/{hook_id}/deliveries <https://docs.github.com/en/rest/reference/orgs#list-deliveries-for-an-organization-webhook>`_
|
| 1061 |
+
:param hook_id: integer
|
| 1062 |
+
:rtype: :class:`PaginatedList` of :class:`github.HookDelivery.HookDeliverySummary`
|
| 1063 |
+
"""
|
| 1064 |
+
assert isinstance(hook_id, int), hook_id
|
| 1065 |
+
return PaginatedList(
|
| 1066 |
+
github.HookDelivery.HookDeliverySummary,
|
| 1067 |
+
self._requester,
|
| 1068 |
+
f"{self.url}/hooks/{hook_id}/deliveries",
|
| 1069 |
+
None,
|
| 1070 |
+
)
|
| 1071 |
+
|
| 1072 |
+
def get_issues(
|
| 1073 |
+
self,
|
| 1074 |
+
filter: Opt[str] = NotSet,
|
| 1075 |
+
state: Opt[str] = NotSet,
|
| 1076 |
+
labels: Opt[list[Label]] = NotSet,
|
| 1077 |
+
sort: Opt[str] = NotSet,
|
| 1078 |
+
direction: Opt[str] = NotSet,
|
| 1079 |
+
since: Opt[datetime] = NotSet,
|
| 1080 |
+
) -> PaginatedList[Issue]:
|
| 1081 |
+
"""
|
| 1082 |
+
:calls: `GET /orgs/{org}/issues <https://docs.github.com/en/rest/reference/issues>`_
|
| 1083 |
+
:rtype: :class:`PaginatedList` of :class:`github.Issue.Issue`
|
| 1084 |
+
:param filter: string
|
| 1085 |
+
:param state: string
|
| 1086 |
+
:param labels: list of :class:`github.Label.Label`
|
| 1087 |
+
:param sort: string
|
| 1088 |
+
:param direction: string
|
| 1089 |
+
:param since: datetime
|
| 1090 |
+
:rtype: :class:`PaginatedList` of :class:`github.Issue.Issue`
|
| 1091 |
+
"""
|
| 1092 |
+
assert is_optional(filter, str), filter
|
| 1093 |
+
assert is_optional(state, str), state
|
| 1094 |
+
assert is_optional_list(labels, github.Label.Label), labels
|
| 1095 |
+
assert is_optional(sort, str), sort
|
| 1096 |
+
assert is_optional(direction, str), direction
|
| 1097 |
+
assert is_optional(since, datetime), since
|
| 1098 |
+
url_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 1099 |
+
{"filter": filter, "state": state, "sort": sort, "direction": direction}
|
| 1100 |
+
)
|
| 1101 |
+
if is_defined(labels):
|
| 1102 |
+
url_parameters["labels"] = ",".join(label.name for label in labels)
|
| 1103 |
+
if is_defined(since):
|
| 1104 |
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 1105 |
+
return PaginatedList(github.Issue.Issue, self._requester, f"{self.url}/issues", url_parameters)
|
| 1106 |
+
|
| 1107 |
+
def get_members(
|
| 1108 |
+
self,
|
| 1109 |
+
filter_: Opt[str] = NotSet,
|
| 1110 |
+
role: Opt[str] = NotSet,
|
| 1111 |
+
) -> PaginatedList[NamedUser]:
|
| 1112 |
+
"""
|
| 1113 |
+
:calls: `GET /orgs/{org}/members <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1114 |
+
"""
|
| 1115 |
+
assert is_optional(filter_, str), filter_
|
| 1116 |
+
assert is_optional(role, str), role
|
| 1117 |
+
|
| 1118 |
+
url_parameters = NotSet.remove_unset_items({"filter": filter_, "role": role})
|
| 1119 |
+
|
| 1120 |
+
return PaginatedList(
|
| 1121 |
+
github.NamedUser.NamedUser,
|
| 1122 |
+
self._requester,
|
| 1123 |
+
f"{self.url}/members",
|
| 1124 |
+
url_parameters,
|
| 1125 |
+
)
|
| 1126 |
+
|
| 1127 |
+
def get_projects(self, state: Opt[str] = NotSet) -> PaginatedList[Project]:
|
| 1128 |
+
"""
|
| 1129 |
+
:calls: `GET /orgs/{org}/projects <https://docs.github.com/en/rest/reference/projects#list-organization-projects>`_
|
| 1130 |
+
"""
|
| 1131 |
+
|
| 1132 |
+
url_parameters = NotSet.remove_unset_items({"state": state})
|
| 1133 |
+
|
| 1134 |
+
return PaginatedList(
|
| 1135 |
+
github.Project.Project,
|
| 1136 |
+
self._requester,
|
| 1137 |
+
f"{self.url}/projects",
|
| 1138 |
+
url_parameters,
|
| 1139 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 1140 |
+
)
|
| 1141 |
+
|
| 1142 |
+
def get_public_members(self) -> PaginatedList[NamedUser]:
|
| 1143 |
+
"""
|
| 1144 |
+
:calls: `GET /orgs/{org}/public_members <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1145 |
+
:rtype: :class:`PaginatedList` of :class:`github.NamedUser.NamedUser`
|
| 1146 |
+
"""
|
| 1147 |
+
return PaginatedList(
|
| 1148 |
+
github.NamedUser.NamedUser,
|
| 1149 |
+
self._requester,
|
| 1150 |
+
f"{self.url}/public_members",
|
| 1151 |
+
None,
|
| 1152 |
+
)
|
| 1153 |
+
|
| 1154 |
+
def get_outside_collaborators(self, filter_: Opt[str] = NotSet) -> PaginatedList[NamedUser]:
|
| 1155 |
+
"""
|
| 1156 |
+
:calls: `GET /orgs/{org}/outside_collaborators <https://docs.github.com/en/rest/reference/orgs#outside-collaborators>`_
|
| 1157 |
+
"""
|
| 1158 |
+
assert is_optional(filter_, str), filter_
|
| 1159 |
+
|
| 1160 |
+
url_parameters = NotSet.remove_unset_items({"filter": filter_})
|
| 1161 |
+
return PaginatedList(
|
| 1162 |
+
github.NamedUser.NamedUser,
|
| 1163 |
+
self._requester,
|
| 1164 |
+
f"{self.url}/outside_collaborators",
|
| 1165 |
+
url_parameters,
|
| 1166 |
+
)
|
| 1167 |
+
|
| 1168 |
+
def remove_outside_collaborator(self, collaborator: NamedUser) -> None:
|
| 1169 |
+
"""
|
| 1170 |
+
:calls: `DELETE /orgs/{org}/outside_collaborators/{username} <https://docs.github.com/en/rest/reference/orgs#outside-collaborators>`_
|
| 1171 |
+
:param collaborator: :class:`github.NamedUser.NamedUser`
|
| 1172 |
+
:rtype: None
|
| 1173 |
+
"""
|
| 1174 |
+
assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator
|
| 1175 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1176 |
+
"DELETE", f"{self.url}/outside_collaborators/{collaborator._identity}"
|
| 1177 |
+
)
|
| 1178 |
+
|
| 1179 |
+
def convert_to_outside_collaborator(self, member: NamedUser) -> None:
|
| 1180 |
+
"""
|
| 1181 |
+
:calls: `PUT /orgs/{org}/outside_collaborators/{username} <https://docs.github.com/en/rest/reference/orgs#outside-collaborators>`_
|
| 1182 |
+
:param member: :class:`github.NamedUser.NamedUser`
|
| 1183 |
+
:rtype: None
|
| 1184 |
+
"""
|
| 1185 |
+
assert isinstance(member, github.NamedUser.NamedUser), member
|
| 1186 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1187 |
+
"PUT", f"{self.url}/outside_collaborators/{member._identity}"
|
| 1188 |
+
)
|
| 1189 |
+
|
| 1190 |
+
def get_public_key(self, secret_type: str = "actions") -> PublicKey:
|
| 1191 |
+
"""
|
| 1192 |
+
:calls: `GET /orgs/{org}/{secret_type}/secrets/public-key <https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key>`_
|
| 1193 |
+
:param secret_type: string options actions or dependabot
|
| 1194 |
+
:rtype: :class:`github.PublicKey.PublicKey`
|
| 1195 |
+
"""
|
| 1196 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/{secret_type}/secrets/public-key")
|
| 1197 |
+
return github.PublicKey.PublicKey(self._requester, headers, data, completed=True)
|
| 1198 |
+
|
| 1199 |
+
def get_copilot(self) -> Copilot:
|
| 1200 |
+
"""
|
| 1201 |
+
:calls: Various Copilot-related endpoints for this organization :rtype: :class:`github.Copilot.Copilot`
|
| 1202 |
+
"""
|
| 1203 |
+
return github.Copilot.Copilot(self._requester, self.login)
|
| 1204 |
+
|
| 1205 |
+
def get_repo(self, name: str) -> Repository:
|
| 1206 |
+
"""
|
| 1207 |
+
:calls: `GET /repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/repos>`_
|
| 1208 |
+
:param name: string
|
| 1209 |
+
:rtype: :class:`github.Repository.Repository`
|
| 1210 |
+
"""
|
| 1211 |
+
assert isinstance(name, str), name
|
| 1212 |
+
name = urllib.parse.quote(name)
|
| 1213 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1214 |
+
"GET",
|
| 1215 |
+
f"/repos/{self.login}/{name}",
|
| 1216 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 1217 |
+
)
|
| 1218 |
+
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
| 1219 |
+
|
| 1220 |
+
def get_repos(
|
| 1221 |
+
self,
|
| 1222 |
+
type: Opt[str] = NotSet,
|
| 1223 |
+
sort: Opt[str] = NotSet,
|
| 1224 |
+
direction: Opt[str] = NotSet,
|
| 1225 |
+
) -> PaginatedList[Repository]:
|
| 1226 |
+
"""
|
| 1227 |
+
:calls: `GET /orgs/{org}/repos <https://docs.github.com/en/rest/reference/repos>`_
|
| 1228 |
+
:param type: string ('all', 'public', 'private', 'forks', 'sources', 'member')
|
| 1229 |
+
:param sort: string ('created', 'updated', 'pushed', 'full_name')
|
| 1230 |
+
:param direction: string ('asc', desc')
|
| 1231 |
+
"""
|
| 1232 |
+
assert is_optional(type, str), type
|
| 1233 |
+
assert is_optional(sort, str), sort
|
| 1234 |
+
assert is_optional(direction, str), direction
|
| 1235 |
+
|
| 1236 |
+
url_parameters = NotSet.remove_unset_items({"type": type, "sort": sort, "direction": direction})
|
| 1237 |
+
|
| 1238 |
+
return PaginatedList(
|
| 1239 |
+
github.Repository.Repository,
|
| 1240 |
+
self._requester,
|
| 1241 |
+
f"{self.url}/repos",
|
| 1242 |
+
url_parameters,
|
| 1243 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 1244 |
+
)
|
| 1245 |
+
|
| 1246 |
+
def get_team(self, id: int) -> Team:
|
| 1247 |
+
"""
|
| 1248 |
+
:calls: `GET /teams/{id} <https://docs.github.com/en/rest/reference/teams>`_
|
| 1249 |
+
"""
|
| 1250 |
+
assert isinstance(id, int), id
|
| 1251 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"/teams/{id}")
|
| 1252 |
+
return github.Team.Team(self._requester, headers, data, completed=True)
|
| 1253 |
+
|
| 1254 |
+
def get_team_by_slug(self, slug: str) -> Team:
|
| 1255 |
+
"""
|
| 1256 |
+
:calls: `GET /orgs/{org}/teams/{team_slug} <https://docs.github.com/en/rest/reference/teams#get-a-team-by-name>`_
|
| 1257 |
+
"""
|
| 1258 |
+
assert isinstance(slug, str), slug
|
| 1259 |
+
slug = urllib.parse.quote(slug)
|
| 1260 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/teams/{slug}")
|
| 1261 |
+
return github.Team.Team(self._requester, headers, data, completed=True)
|
| 1262 |
+
|
| 1263 |
+
def get_teams(self) -> PaginatedList[Team]:
|
| 1264 |
+
"""
|
| 1265 |
+
:calls: `GET /orgs/{org}/teams <https://docs.github.com/en/rest/reference/teams#list-teams>`_
|
| 1266 |
+
"""
|
| 1267 |
+
return PaginatedList(github.Team.Team, self._requester, f"{self.url}/teams", None)
|
| 1268 |
+
|
| 1269 |
+
def invitations(self) -> PaginatedList[NamedUser]:
|
| 1270 |
+
"""
|
| 1271 |
+
:calls: `GET /orgs/{org}/invitations <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1272 |
+
"""
|
| 1273 |
+
return PaginatedList(
|
| 1274 |
+
github.NamedUser.NamedUser,
|
| 1275 |
+
self._requester,
|
| 1276 |
+
f"{self.url}/invitations",
|
| 1277 |
+
None,
|
| 1278 |
+
headers={"Accept": Consts.mediaTypeOrganizationInvitationPreview},
|
| 1279 |
+
)
|
| 1280 |
+
|
| 1281 |
+
def invite_user(
|
| 1282 |
+
self,
|
| 1283 |
+
user: Opt[NamedUser] = NotSet,
|
| 1284 |
+
email: Opt[str] = NotSet,
|
| 1285 |
+
role: Opt[str] = NotSet,
|
| 1286 |
+
teams: Opt[list[Team]] = NotSet,
|
| 1287 |
+
) -> None:
|
| 1288 |
+
"""
|
| 1289 |
+
:calls: `POST /orgs/{org}/invitations <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1290 |
+
:param user: :class:`github.NamedUser.NamedUser`
|
| 1291 |
+
:param email: string
|
| 1292 |
+
:param role: string
|
| 1293 |
+
:param teams: array of :class:`github.Team.Team`
|
| 1294 |
+
:rtype: None
|
| 1295 |
+
"""
|
| 1296 |
+
assert is_optional(user, github.NamedUser.NamedUser), user
|
| 1297 |
+
assert is_optional(email, str), email
|
| 1298 |
+
assert is_defined(email) != is_defined(user), "specify only one of email or user"
|
| 1299 |
+
|
| 1300 |
+
assert is_undefined(role) or role in ["admin", "direct_member", "billing_manager"], role
|
| 1301 |
+
assert is_optional_list(teams, github.Team.Team), teams
|
| 1302 |
+
|
| 1303 |
+
parameters: dict[str, Any] = NotSet.remove_unset_items({"email": email, "role": role})
|
| 1304 |
+
|
| 1305 |
+
if is_defined(user):
|
| 1306 |
+
parameters["invitee_id"] = user.id
|
| 1307 |
+
if is_defined(teams):
|
| 1308 |
+
parameters["team_ids"] = [t.id for t in teams]
|
| 1309 |
+
|
| 1310 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1311 |
+
"POST",
|
| 1312 |
+
f"{self.url}/invitations",
|
| 1313 |
+
headers={"Accept": Consts.mediaTypeOrganizationInvitationPreview},
|
| 1314 |
+
input=parameters,
|
| 1315 |
+
)
|
| 1316 |
+
|
| 1317 |
+
def cancel_invitation(self, invitee: NamedUser) -> bool:
|
| 1318 |
+
"""
|
| 1319 |
+
:calls: `DELETE /orgs/{org}/invitations/{invitation_id} <https://docs.github.com/en/rest/reference/orgs#cancel-an-organization-invitation>`_
|
| 1320 |
+
:param invitee: :class:`github.NamedUser.NamedUser`
|
| 1321 |
+
:rtype: None
|
| 1322 |
+
"""
|
| 1323 |
+
assert isinstance(invitee, github.NamedUser.NamedUser), invitee
|
| 1324 |
+
status, headers, data = self._requester.requestJson("DELETE", f"{self.url}/invitations/{invitee.id}")
|
| 1325 |
+
return status == 204
|
| 1326 |
+
|
| 1327 |
+
def has_in_members(self, member: NamedUser) -> bool:
|
| 1328 |
+
"""
|
| 1329 |
+
:calls: `GET /orgs/{org}/members/{user} <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1330 |
+
:param member: :class:`github.NamedUser.NamedUser`
|
| 1331 |
+
:rtype: bool
|
| 1332 |
+
"""
|
| 1333 |
+
assert isinstance(member, github.NamedUser.NamedUser), member
|
| 1334 |
+
status, headers, data = self._requester.requestJson("GET", f"{self.url}/members/{member._identity}")
|
| 1335 |
+
if status == 302:
|
| 1336 |
+
status, headers, data = self._requester.requestJson("GET", headers["location"])
|
| 1337 |
+
return status == 204
|
| 1338 |
+
|
| 1339 |
+
def has_in_public_members(self, public_member: NamedUser) -> bool:
|
| 1340 |
+
"""
|
| 1341 |
+
:calls: `GET /orgs/{org}/public_members/{user} <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1342 |
+
:param public_member: :class:`github.NamedUser.NamedUser`
|
| 1343 |
+
:rtype: bool
|
| 1344 |
+
"""
|
| 1345 |
+
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
| 1346 |
+
status, headers, data = self._requester.requestJson(
|
| 1347 |
+
"GET", f"{self.url}/public_members/{public_member._identity}"
|
| 1348 |
+
)
|
| 1349 |
+
return status == 204
|
| 1350 |
+
|
| 1351 |
+
def remove_from_membership(self, member: NamedUser) -> None:
|
| 1352 |
+
"""
|
| 1353 |
+
:calls: `DELETE /orgs/{org}/memberships/{user} <https://docs.github.com/en/rest/reference/orgs#remove-an-organization-member>`_
|
| 1354 |
+
:param member: :class:`github.NamedUser.NamedUser`
|
| 1355 |
+
:rtype: None
|
| 1356 |
+
"""
|
| 1357 |
+
assert isinstance(member, github.NamedUser.NamedUser), member
|
| 1358 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/memberships/{member._identity}")
|
| 1359 |
+
|
| 1360 |
+
def remove_from_members(self, member: NamedUser) -> None:
|
| 1361 |
+
"""
|
| 1362 |
+
:calls: `DELETE /orgs/{org}/members/{user} <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1363 |
+
:param member: :class:`github.NamedUser.NamedUser`
|
| 1364 |
+
:rtype: None
|
| 1365 |
+
"""
|
| 1366 |
+
assert isinstance(member, github.NamedUser.NamedUser), member
|
| 1367 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/members/{member._identity}")
|
| 1368 |
+
|
| 1369 |
+
def remove_from_public_members(self, public_member: NamedUser) -> None:
|
| 1370 |
+
"""
|
| 1371 |
+
:calls: `DELETE /orgs/{org}/public_members/{user} <https://docs.github.com/en/rest/reference/orgs#members>`_
|
| 1372 |
+
:param public_member: :class:`github.NamedUser.NamedUser`
|
| 1373 |
+
:rtype: None
|
| 1374 |
+
"""
|
| 1375 |
+
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
| 1376 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1377 |
+
"DELETE", f"{self.url}/public_members/{public_member._identity}"
|
| 1378 |
+
)
|
| 1379 |
+
|
| 1380 |
+
def create_migration(
|
| 1381 |
+
self,
|
| 1382 |
+
repos: list[str],
|
| 1383 |
+
lock_repositories: Opt[bool] = NotSet,
|
| 1384 |
+
exclude_attachments: Opt[bool] = NotSet,
|
| 1385 |
+
) -> Migration:
|
| 1386 |
+
"""
|
| 1387 |
+
:calls: `POST /orgs/{org}/migrations <https://docs.github.com/en/rest/reference/migrations#list-organization-migrations>`_
|
| 1388 |
+
:param repos: list or tuple of str
|
| 1389 |
+
:param lock_repositories: bool
|
| 1390 |
+
:param exclude_attachments: bool
|
| 1391 |
+
:rtype: :class:`github.Migration.Migration`
|
| 1392 |
+
"""
|
| 1393 |
+
assert isinstance(repos, (list, tuple)), repos
|
| 1394 |
+
assert all(isinstance(repo, str) for repo in repos), repos
|
| 1395 |
+
assert is_optional(lock_repositories, bool), lock_repositories
|
| 1396 |
+
assert is_optional(exclude_attachments, bool), exclude_attachments
|
| 1397 |
+
post_parameters = NotSet.remove_unset_items(
|
| 1398 |
+
{
|
| 1399 |
+
"repositories": repos,
|
| 1400 |
+
"lock_repositories": lock_repositories,
|
| 1401 |
+
"exclude_attachments": exclude_attachments,
|
| 1402 |
+
}
|
| 1403 |
+
)
|
| 1404 |
+
|
| 1405 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1406 |
+
"POST",
|
| 1407 |
+
f"/orgs/{self.login}/migrations",
|
| 1408 |
+
input=post_parameters,
|
| 1409 |
+
headers={"Accept": Consts.mediaTypeMigrationPreview},
|
| 1410 |
+
)
|
| 1411 |
+
return github.Migration.Migration(self._requester, headers, data, completed=True)
|
| 1412 |
+
|
| 1413 |
+
def get_migrations(self) -> PaginatedList[Migration]:
|
| 1414 |
+
"""
|
| 1415 |
+
:calls: `GET /orgs/{org}/migrations <https://docs.github.com/en/rest/reference/migrations#list-organization-migrations>`_
|
| 1416 |
+
:rtype: :class:`PaginatedList` of :class:`github.Migration.Migration`
|
| 1417 |
+
"""
|
| 1418 |
+
return PaginatedList(
|
| 1419 |
+
github.Migration.Migration,
|
| 1420 |
+
self._requester,
|
| 1421 |
+
f"/orgs/{self.login}/migrations",
|
| 1422 |
+
None,
|
| 1423 |
+
headers={"Accept": Consts.mediaTypeMigrationPreview},
|
| 1424 |
+
)
|
| 1425 |
+
|
| 1426 |
+
def get_installations(self) -> PaginatedList[Installation]:
|
| 1427 |
+
"""
|
| 1428 |
+
:calls: `GET /orgs/{org}/installations <https://docs.github.com/en/rest/reference/orgs#list-app-installations-for-an-organization>`_
|
| 1429 |
+
:rtype: :class:`PaginatedList` of :class:`github.Installation.Installation`
|
| 1430 |
+
"""
|
| 1431 |
+
|
| 1432 |
+
return PaginatedList(
|
| 1433 |
+
github.Installation.Installation,
|
| 1434 |
+
self._requester,
|
| 1435 |
+
f"{self.url}/installations",
|
| 1436 |
+
None,
|
| 1437 |
+
headers=None,
|
| 1438 |
+
list_item="installations",
|
| 1439 |
+
)
|
| 1440 |
+
|
| 1441 |
+
def get_dependabot_alerts(
|
| 1442 |
+
self,
|
| 1443 |
+
state: Opt[str] = NotSet,
|
| 1444 |
+
severity: Opt[str] = NotSet,
|
| 1445 |
+
ecosystem: Opt[str] = NotSet,
|
| 1446 |
+
package: Opt[str] = NotSet,
|
| 1447 |
+
scope: Opt[str] = NotSet,
|
| 1448 |
+
sort: Opt[str] = NotSet,
|
| 1449 |
+
direction: Opt[str] = NotSet,
|
| 1450 |
+
) -> PaginatedList[OrganizationDependabotAlert]:
|
| 1451 |
+
"""
|
| 1452 |
+
:calls: `GET /orgs/{org}/dependabot/alerts <https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization>`_
|
| 1453 |
+
:param state: Optional string
|
| 1454 |
+
:param severity: Optional string
|
| 1455 |
+
:param ecosystem: Optional string
|
| 1456 |
+
:param package: Optional string
|
| 1457 |
+
:param scope: Optional string
|
| 1458 |
+
:param sort: Optional string
|
| 1459 |
+
:param direction: Optional string
|
| 1460 |
+
:rtype: :class:`PaginatedList` of :class:`github.DependabotAlert.DependabotAlert`
|
| 1461 |
+
"""
|
| 1462 |
+
allowed_states = ["auto_dismissed", "dismissed", "fixed", "open"]
|
| 1463 |
+
allowed_severities = ["low", "medium", "high", "critical"]
|
| 1464 |
+
allowed_ecosystems = ["composer", "go", "maven", "npm", "nuget", "pip", "pub", "rubygems", "rust"]
|
| 1465 |
+
allowed_scopes = ["development", "runtime"]
|
| 1466 |
+
allowed_sorts = ["created", "updated"]
|
| 1467 |
+
allowed_directions = ["asc", "desc"]
|
| 1468 |
+
assert state in allowed_states + [NotSet], f"State can be one of {', '.join(allowed_states)}"
|
| 1469 |
+
assert severity in allowed_severities + [NotSet], f"Severity can be one of {', '.join(allowed_severities)}"
|
| 1470 |
+
assert ecosystem in allowed_ecosystems + [NotSet], f"Ecosystem can be one of {', '.join(allowed_ecosystems)}"
|
| 1471 |
+
assert scope in allowed_scopes + [NotSet], f"Scope can be one of {', '.join(allowed_scopes)}"
|
| 1472 |
+
assert sort in allowed_sorts + [NotSet], f"Sort can be one of {', '.join(allowed_sorts)}"
|
| 1473 |
+
assert direction in allowed_directions + [NotSet], f"Direction can be one of {', '.join(allowed_directions)}"
|
| 1474 |
+
url_parameters = NotSet.remove_unset_items(
|
| 1475 |
+
{
|
| 1476 |
+
"state": state,
|
| 1477 |
+
"severity": severity,
|
| 1478 |
+
"ecosystem": ecosystem,
|
| 1479 |
+
"package": package,
|
| 1480 |
+
"scope": scope,
|
| 1481 |
+
"sort": sort,
|
| 1482 |
+
"direction": direction,
|
| 1483 |
+
}
|
| 1484 |
+
)
|
| 1485 |
+
return PaginatedList(
|
| 1486 |
+
github.OrganizationDependabotAlert.OrganizationDependabotAlert,
|
| 1487 |
+
self._requester,
|
| 1488 |
+
f"{self.url}/dependabot/alerts",
|
| 1489 |
+
url_parameters,
|
| 1490 |
+
)
|
| 1491 |
+
|
| 1492 |
+
def get_custom_properties(self) -> PaginatedList[OrganizationCustomProperty]:
|
| 1493 |
+
"""
|
| 1494 |
+
:calls: `GET /orgs/{org}/properties/schema <https://docs.github.com/en/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization>`_
|
| 1495 |
+
:rtype: :class:`PaginatedList` of :class:`github.OrganizationCustomProperty.OrganizationCustomProperty`
|
| 1496 |
+
"""
|
| 1497 |
+
return PaginatedList(
|
| 1498 |
+
contentClass=github.OrganizationCustomProperty.OrganizationCustomProperty,
|
| 1499 |
+
requester=self._requester,
|
| 1500 |
+
firstUrl=f"{self.url}/properties/schema",
|
| 1501 |
+
firstParams=None,
|
| 1502 |
+
)
|
| 1503 |
+
|
| 1504 |
+
def get_custom_property(self, property_name: str) -> OrganizationCustomProperty:
|
| 1505 |
+
"""
|
| 1506 |
+
:calls: `GET /orgs/{org}/properties/schema/{property_name} <https://docs.github.com/en/rest/orgs/custom-properties#get-a-custom-property-for-an-organization>`_
|
| 1507 |
+
:param property_name: string
|
| 1508 |
+
:rtype: :class:`github.OrganizationCustomProperty.OrganizationCustomProperty`
|
| 1509 |
+
"""
|
| 1510 |
+
assert isinstance(property_name, str), property_name
|
| 1511 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1512 |
+
"GET", f"{self.url}/properties/schema/{urllib.parse.quote(property_name)}"
|
| 1513 |
+
)
|
| 1514 |
+
return github.OrganizationCustomProperty.OrganizationCustomProperty(
|
| 1515 |
+
requester=self._requester,
|
| 1516 |
+
headers=headers,
|
| 1517 |
+
attributes=data,
|
| 1518 |
+
)
|
| 1519 |
+
|
| 1520 |
+
def create_custom_properties(self, properties: list[CustomProperty]) -> list[OrganizationCustomProperty]:
|
| 1521 |
+
"""
|
| 1522 |
+
Create or update custom properties for an organization
|
| 1523 |
+
:calls: `PATCH /orgs/{org}/properties/schema <https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization>`_
|
| 1524 |
+
:param properties: list of :class:`github.OrganizationCustomProperty.CustomProperty`
|
| 1525 |
+
:rtype: list of :class:`github.OrganizationCustomProperty.OrganizationCustomProperty`
|
| 1526 |
+
"""
|
| 1527 |
+
assert isinstance(properties, list), properties
|
| 1528 |
+
assert all(isinstance(p, github.OrganizationCustomProperty.CustomProperty) for p in properties), properties
|
| 1529 |
+
patch_parameters = {"properties": [p.to_dict() for p in properties]}
|
| 1530 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1531 |
+
"PATCH", f"{self.url}/properties/schema", input=patch_parameters
|
| 1532 |
+
)
|
| 1533 |
+
return [
|
| 1534 |
+
github.OrganizationCustomProperty.OrganizationCustomProperty(
|
| 1535 |
+
requester=self._requester, headers=headers, attributes=property
|
| 1536 |
+
)
|
| 1537 |
+
for property in data
|
| 1538 |
+
]
|
| 1539 |
+
|
| 1540 |
+
def create_custom_property(self, property: CustomProperty) -> OrganizationCustomProperty:
|
| 1541 |
+
"""
|
| 1542 |
+
Create or update a custom property for an organization
|
| 1543 |
+
:calls: `PUT /orgs/{org}/properties/schema/{property_name} <https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization>`_
|
| 1544 |
+
:param property: :class:`github.OrganizationCustomProperty.CustomProperty`
|
| 1545 |
+
:rtype: :class:`github.OrganizationCustomProperty.OrganizationCustomProperty`
|
| 1546 |
+
"""
|
| 1547 |
+
assert isinstance(property, github.OrganizationCustomProperty.CustomProperty), property
|
| 1548 |
+
assert property.values_editable_by is NotSet
|
| 1549 |
+
|
| 1550 |
+
post_parameters = property.to_dict()
|
| 1551 |
+
property_name = post_parameters.pop("property_name")
|
| 1552 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1553 |
+
"PUT", f"{self.url}/properties/schema/{property_name}", input=post_parameters
|
| 1554 |
+
)
|
| 1555 |
+
return github.OrganizationCustomProperty.OrganizationCustomProperty(
|
| 1556 |
+
requester=self._requester, headers=headers, attributes=data
|
| 1557 |
+
)
|
| 1558 |
+
|
| 1559 |
+
def remove_custom_property(self, property_name: str) -> None:
|
| 1560 |
+
"""
|
| 1561 |
+
:calls: `DELETE /orgs/{org}/properties/schema/{property_name} <https://docs.github.com/en/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization>`_
|
| 1562 |
+
:param property_name: string
|
| 1563 |
+
:rtype: None
|
| 1564 |
+
"""
|
| 1565 |
+
assert isinstance(property_name, str), property_name
|
| 1566 |
+
self._requester.requestJsonAndCheck("DELETE", f"{self.url}/properties/schema/{property_name}")
|
| 1567 |
+
|
| 1568 |
+
def list_custom_property_values(
|
| 1569 |
+
self, repository_query: Opt[str] = NotSet
|
| 1570 |
+
) -> PaginatedList[RepositoryCustomPropertyValues]:
|
| 1571 |
+
"""
|
| 1572 |
+
:calls: `GET /orgs/{org}/properties <https://docs.github.com/en/rest/orgs/custom-properties#list-custom-property-values-for-an-organization>`_
|
| 1573 |
+
:rtype: :class:`PaginatedList` of dict
|
| 1574 |
+
"""
|
| 1575 |
+
return PaginatedList(
|
| 1576 |
+
contentClass=github.OrganizationCustomProperty.RepositoryCustomPropertyValues,
|
| 1577 |
+
requester=self._requester,
|
| 1578 |
+
firstUrl=f"{self.url}/properties/values",
|
| 1579 |
+
firstParams=NotSet.remove_unset_items({"repository_query": repository_query}),
|
| 1580 |
+
)
|
| 1581 |
+
|
| 1582 |
+
def create_custom_property_values(
|
| 1583 |
+
self, repository_names: list[str], properties: dict[str, str | list | None]
|
| 1584 |
+
) -> None:
|
| 1585 |
+
"""
|
| 1586 |
+
Create or update custom property values for organization repositories
|
| 1587 |
+
:calls: `PATCH /orgs/{org}/properties <https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories>`_
|
| 1588 |
+
:param repository_names: list of strings
|
| 1589 |
+
:param properties: dict of string to string, list or None
|
| 1590 |
+
:rtype: None
|
| 1591 |
+
"""
|
| 1592 |
+
assert isinstance(repository_names, list), repository_names
|
| 1593 |
+
assert all(isinstance(repo, str) for repo in repository_names), repository_names
|
| 1594 |
+
assert isinstance(properties, dict), properties
|
| 1595 |
+
assert all(isinstance(value, (str, list, type(None))) for value in properties.values()), properties
|
| 1596 |
+
patch_parameters = {
|
| 1597 |
+
"repository_names": repository_names,
|
| 1598 |
+
"properties": [{"property_name": k, "value": v} for k, v in properties.items()],
|
| 1599 |
+
}
|
| 1600 |
+
self._requester.requestJsonAndCheck("PATCH", f"{self.url}/properties/values", input=patch_parameters)
|
| 1601 |
+
|
| 1602 |
+
def get_code_security_configs(self, target_type: Opt[str] = NotSet) -> PaginatedList[CodeSecurityConfig]:
|
| 1603 |
+
"""
|
| 1604 |
+
:calls: `GET /orgs/{org}/code-security/configurations <https://docs.github.com/en/rest/code-security/configurations#get-code-security-configurations-for-an-organization>`_
|
| 1605 |
+
:rtype: :class:`CodeSecurityConfig`
|
| 1606 |
+
"""
|
| 1607 |
+
return PaginatedList(
|
| 1608 |
+
contentClass=github.CodeSecurityConfig.CodeSecurityConfig,
|
| 1609 |
+
requester=self._requester,
|
| 1610 |
+
firstUrl=f"{self.url}/code-security/configurations",
|
| 1611 |
+
firstParams=NotSet.remove_unset_items({"target_type": target_type}),
|
| 1612 |
+
)
|
| 1613 |
+
|
| 1614 |
+
def create_code_security_config(
|
| 1615 |
+
self,
|
| 1616 |
+
name: str,
|
| 1617 |
+
description: str,
|
| 1618 |
+
advanced_security: Opt[str] = NotSet,
|
| 1619 |
+
dependency_graph: Opt[str] = NotSet,
|
| 1620 |
+
dependency_graph_autosubmit_action: Opt[str] = NotSet,
|
| 1621 |
+
dependabot_alerts: Opt[str] = NotSet,
|
| 1622 |
+
dependabot_security_updates: Opt[str] = NotSet,
|
| 1623 |
+
code_scanning_default_setup: Opt[str] = NotSet,
|
| 1624 |
+
secret_scanning: Opt[str] = NotSet,
|
| 1625 |
+
secret_scanning_push_protection: Opt[str] = NotSet,
|
| 1626 |
+
secret_scanning_delegated_bypass: Opt[str] = NotSet,
|
| 1627 |
+
secret_scanning_validity_checks: Opt[str] = NotSet,
|
| 1628 |
+
secret_scanning_non_provider_patterns: Opt[str] = NotSet,
|
| 1629 |
+
private_vulnerability_reporting: Opt[str] = NotSet,
|
| 1630 |
+
enforcement: Opt[str] = NotSet,
|
| 1631 |
+
) -> CodeSecurityConfig:
|
| 1632 |
+
"""
|
| 1633 |
+
:calls: `POST /orgs/{org}/code-security/configurations <https://docs.github.com/en/rest/code-security/configurations#create-a-code-security-configuration>`_
|
| 1634 |
+
:rtype: :class:`PaginatedList` of dict
|
| 1635 |
+
"""
|
| 1636 |
+
assert isinstance(name, str), name
|
| 1637 |
+
assert isinstance(description, str), description
|
| 1638 |
+
assert is_optional(advanced_security, str), advanced_security
|
| 1639 |
+
assert is_optional(dependency_graph, str), dependency_graph
|
| 1640 |
+
assert is_optional(dependency_graph_autosubmit_action, str), dependency_graph_autosubmit_action
|
| 1641 |
+
assert is_optional(dependabot_alerts, str), dependabot_alerts
|
| 1642 |
+
assert is_optional(dependabot_security_updates, str), dependabot_security_updates
|
| 1643 |
+
assert is_optional(code_scanning_default_setup, str), code_scanning_default_setup
|
| 1644 |
+
assert is_optional(secret_scanning, str), secret_scanning
|
| 1645 |
+
assert is_optional(secret_scanning_push_protection, str), secret_scanning_push_protection
|
| 1646 |
+
assert is_optional(secret_scanning_delegated_bypass, str), secret_scanning_delegated_bypass
|
| 1647 |
+
assert is_optional(secret_scanning_validity_checks, str), secret_scanning_validity_checks
|
| 1648 |
+
assert is_optional(secret_scanning_non_provider_patterns, str), secret_scanning_non_provider_patterns
|
| 1649 |
+
assert is_optional(private_vulnerability_reporting, str), private_vulnerability_reporting
|
| 1650 |
+
assert is_optional(enforcement, str), enforcement
|
| 1651 |
+
post_parameters = NotSet.remove_unset_items(
|
| 1652 |
+
{
|
| 1653 |
+
"name": name,
|
| 1654 |
+
"description": description,
|
| 1655 |
+
"advanced_security": advanced_security,
|
| 1656 |
+
"dependency_graph": dependency_graph,
|
| 1657 |
+
"dependency_graph_autosubmit_action": dependency_graph_autosubmit_action,
|
| 1658 |
+
"dependabot_alerts": dependabot_alerts,
|
| 1659 |
+
"dependabot_security_updates": dependabot_security_updates,
|
| 1660 |
+
"code_scanning_default_setup": code_scanning_default_setup,
|
| 1661 |
+
"secret_scanning": secret_scanning,
|
| 1662 |
+
"secret_scanning_push_protection": secret_scanning_push_protection,
|
| 1663 |
+
"secret_scanning_delegated_bypass": secret_scanning_delegated_bypass,
|
| 1664 |
+
"secret_scanning_validity_checks": secret_scanning_validity_checks,
|
| 1665 |
+
"secret_scanning_non_provider_patterns": secret_scanning_non_provider_patterns,
|
| 1666 |
+
"private_vulnerability_reporting": private_vulnerability_reporting,
|
| 1667 |
+
"enforcement": enforcement,
|
| 1668 |
+
}
|
| 1669 |
+
)
|
| 1670 |
+
|
| 1671 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1672 |
+
"POST",
|
| 1673 |
+
f"{self.url}/code-security/configurations",
|
| 1674 |
+
input=post_parameters,
|
| 1675 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 1676 |
+
)
|
| 1677 |
+
return github.CodeSecurityConfig.CodeSecurityConfig(self._requester, headers, data)
|
| 1678 |
+
|
| 1679 |
+
def edit_code_security_config(
|
| 1680 |
+
self,
|
| 1681 |
+
id: int,
|
| 1682 |
+
name: Opt[str] = NotSet,
|
| 1683 |
+
description: Opt[str] = NotSet,
|
| 1684 |
+
advanced_security: Opt[str] = NotSet,
|
| 1685 |
+
dependency_graph: Opt[str] = NotSet,
|
| 1686 |
+
dependency_graph_autosubmit_action: Opt[str] = NotSet,
|
| 1687 |
+
dependabot_alerts: Opt[str] = NotSet,
|
| 1688 |
+
dependabot_security_updates: Opt[str] = NotSet,
|
| 1689 |
+
code_scanning_default_setup: Opt[str] = NotSet,
|
| 1690 |
+
secret_scanning: Opt[str] = NotSet,
|
| 1691 |
+
secret_scanning_push_protection: Opt[str] = NotSet,
|
| 1692 |
+
secret_scanning_delegated_bypass: Opt[str] = NotSet,
|
| 1693 |
+
secret_scanning_validity_checks: Opt[str] = NotSet,
|
| 1694 |
+
secret_scanning_non_provider_patterns: Opt[str] = NotSet,
|
| 1695 |
+
private_vulnerability_reporting: Opt[str] = NotSet,
|
| 1696 |
+
enforcement: Opt[str] = NotSet,
|
| 1697 |
+
) -> CodeSecurityConfig:
|
| 1698 |
+
"""
|
| 1699 |
+
:calls: `PATCH /orgs/{org}/code-security/configurations/{configuration_id} <https://docs.github.com/en/rest/code-security/configurations#update-a-code-security-configuration>`_
|
| 1700 |
+
"""
|
| 1701 |
+
assert isinstance(id, int), id
|
| 1702 |
+
assert is_optional(name, str), name
|
| 1703 |
+
assert is_optional(description, str), description
|
| 1704 |
+
assert is_optional(advanced_security, str), advanced_security
|
| 1705 |
+
assert is_optional(dependency_graph, str), dependency_graph
|
| 1706 |
+
assert is_optional(dependency_graph_autosubmit_action, str), dependency_graph_autosubmit_action
|
| 1707 |
+
assert is_optional(dependabot_alerts, str), dependabot_alerts
|
| 1708 |
+
assert is_optional(dependabot_security_updates, str), dependabot_security_updates
|
| 1709 |
+
assert is_optional(code_scanning_default_setup, str), code_scanning_default_setup
|
| 1710 |
+
assert is_optional(secret_scanning, str), secret_scanning
|
| 1711 |
+
assert is_optional(secret_scanning_push_protection, str), secret_scanning_push_protection
|
| 1712 |
+
assert is_optional(secret_scanning_delegated_bypass, str), secret_scanning_delegated_bypass
|
| 1713 |
+
assert is_optional(secret_scanning_validity_checks, str), secret_scanning_validity_checks
|
| 1714 |
+
assert is_optional(secret_scanning_non_provider_patterns, str), secret_scanning_non_provider_patterns
|
| 1715 |
+
assert is_optional(private_vulnerability_reporting, str), private_vulnerability_reporting
|
| 1716 |
+
assert is_optional(enforcement, str), enforcement
|
| 1717 |
+
post_parameters = NotSet.remove_unset_items(
|
| 1718 |
+
{
|
| 1719 |
+
"name": name,
|
| 1720 |
+
"description": description,
|
| 1721 |
+
"advanced_security": advanced_security,
|
| 1722 |
+
"dependency_graph": dependency_graph,
|
| 1723 |
+
"dependency_graph_autosubmit_action": dependency_graph_autosubmit_action,
|
| 1724 |
+
"dependabot_alerts": dependabot_alerts,
|
| 1725 |
+
"dependabot_security_updates": dependabot_security_updates,
|
| 1726 |
+
"code_scanning_default_setup": code_scanning_default_setup,
|
| 1727 |
+
"secret_scanning": secret_scanning,
|
| 1728 |
+
"secret_scanning_push_protection": secret_scanning_push_protection,
|
| 1729 |
+
"secret_scanning_delegated_bypass": secret_scanning_delegated_bypass,
|
| 1730 |
+
"secret_scanning_validity_checks": secret_scanning_validity_checks,
|
| 1731 |
+
"secret_scanning_non_provider_patterns": secret_scanning_non_provider_patterns,
|
| 1732 |
+
"private_vulnerability_reporting": private_vulnerability_reporting,
|
| 1733 |
+
"enforcement": enforcement,
|
| 1734 |
+
}
|
| 1735 |
+
)
|
| 1736 |
+
|
| 1737 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1738 |
+
"PATCH", f"{self.url}/code-security/configurations/{id}", input=post_parameters
|
| 1739 |
+
)
|
| 1740 |
+
return github.CodeSecurityConfig.CodeSecurityConfig(self._requester, headers, data)
|
| 1741 |
+
|
| 1742 |
+
def delete_code_security_config(self, id: int) -> None:
|
| 1743 |
+
"""
|
| 1744 |
+
:calls: `DELETE /orgs/{org}/code-security/configurations/{configuration_id} <https://docs.github.com/en/rest/code-security/configurations#delete-a-code-security-configuration>`_
|
| 1745 |
+
:param id: integer
|
| 1746 |
+
:rtype: None`
|
| 1747 |
+
"""
|
| 1748 |
+
assert isinstance(id, int), id
|
| 1749 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.url}/code-security/configurations/{id}")
|
| 1750 |
+
|
| 1751 |
+
def get_code_security_config(self, id: int) -> CodeSecurityConfig:
|
| 1752 |
+
"""
|
| 1753 |
+
:calls: `GET /orgs/{org}/code-security/configurations/{configuration_id} <https://docs.github.com/en/rest/code-security/configurations#get-a-code-security-configurationt>`_
|
| 1754 |
+
:param id: configuration_id
|
| 1755 |
+
:rtype: CodeSecurityConfig
|
| 1756 |
+
"""
|
| 1757 |
+
assert isinstance(id, int), id
|
| 1758 |
+
|
| 1759 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/code-security/configurations/{id}")
|
| 1760 |
+
return github.CodeSecurityConfig.CodeSecurityConfig(self._requester, headers, data)
|
| 1761 |
+
|
| 1762 |
+
def set_default_code_security_config(self, id: int, default_for_new_repos: Opt[str] = NotSet) -> None:
|
| 1763 |
+
"""
|
| 1764 |
+
:calls: `PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults <https://docs.github.com/en/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization>`_
|
| 1765 |
+
"""
|
| 1766 |
+
assert isinstance(id, int), id
|
| 1767 |
+
assert is_optional(default_for_new_repos, str), default_for_new_repos
|
| 1768 |
+
put_parameters = NotSet.remove_unset_items({"default_for_new_repos": default_for_new_repos})
|
| 1769 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1770 |
+
"PUT", f"{self.url}/code-security/configurations/{id}/defaults", input=put_parameters
|
| 1771 |
+
)
|
| 1772 |
+
|
| 1773 |
+
def get_default_code_security_configs(self) -> PaginatedList[DefaultCodeSecurityConfig]:
|
| 1774 |
+
"""
|
| 1775 |
+
:calls: `GET /orgs/{org}/code-security/configurations/defaults <https://docs.github.com/en/rest/code-security/configurations#get-default-code-security-configurations>`_
|
| 1776 |
+
:rtype: :class:`github.DefaultCodeSecurityConfig.DefaultCodeSecurityConfig`
|
| 1777 |
+
"""
|
| 1778 |
+
return PaginatedList(
|
| 1779 |
+
contentClass=github.DefaultCodeSecurityConfig.DefaultCodeSecurityConfig,
|
| 1780 |
+
requester=self._requester,
|
| 1781 |
+
firstUrl=f"{self.url}/code-security/configurations/defaults",
|
| 1782 |
+
firstParams=None,
|
| 1783 |
+
)
|
| 1784 |
+
|
| 1785 |
+
def attach_security_config_to_repositories(
|
| 1786 |
+
self, id: int, scope: str, selected_repository_ids: Opt[list[int]] = NotSet
|
| 1787 |
+
) -> None:
|
| 1788 |
+
"""
|
| 1789 |
+
:calls: `POST /orgs/{org}/code-security/configurations/{configuration_id}/attach <https://docs.github.com/en/rest/code-security/configurations#attach-a-configuration-to-repositories>`_
|
| 1790 |
+
"""
|
| 1791 |
+
assert isinstance(id, int), id
|
| 1792 |
+
assert isinstance(scope, str), scope
|
| 1793 |
+
assert is_optional(selected_repository_ids, list), selected_repository_ids
|
| 1794 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 1795 |
+
{
|
| 1796 |
+
"scope": scope,
|
| 1797 |
+
"selected_repository_ids": selected_repository_ids,
|
| 1798 |
+
}
|
| 1799 |
+
)
|
| 1800 |
+
|
| 1801 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1802 |
+
"POST",
|
| 1803 |
+
f"/orgs/{self.login}/code-security/configurations/{id}/attach",
|
| 1804 |
+
input=post_parameters,
|
| 1805 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 1806 |
+
)
|
| 1807 |
+
|
| 1808 |
+
def detach_security_config_from_repositories(self, selected_repository_ids: list[int]) -> None:
|
| 1809 |
+
"""
|
| 1810 |
+
:calls: `DELETE /orgs/{org}/code-security/configurations/detach <https://docs.github.com/en/rest/code-security/configurations#detach-configurations-from-repositories>`_
|
| 1811 |
+
"""
|
| 1812 |
+
assert isinstance(selected_repository_ids, list), selected_repository_ids
|
| 1813 |
+
delete_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
| 1814 |
+
{
|
| 1815 |
+
"selected_repository_ids": selected_repository_ids,
|
| 1816 |
+
}
|
| 1817 |
+
)
|
| 1818 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 1819 |
+
"DELETE",
|
| 1820 |
+
f"/orgs/{self.login}/code-security/configurations/detach",
|
| 1821 |
+
input=delete_parameters,
|
| 1822 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 1823 |
+
)
|
| 1824 |
+
|
| 1825 |
+
def get_repos_for_code_security_config(
|
| 1826 |
+
self, id: int, status: Opt[str] = NotSet
|
| 1827 |
+
) -> PaginatedList[CodeSecurityConfigRepository]:
|
| 1828 |
+
"""
|
| 1829 |
+
:calls: `GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories <https://docs.github.com/en/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration>`_
|
| 1830 |
+
"""
|
| 1831 |
+
assert isinstance(id, int), id
|
| 1832 |
+
assert is_optional(status, str), status
|
| 1833 |
+
|
| 1834 |
+
url_parameters = NotSet.remove_unset_items({"status": status})
|
| 1835 |
+
|
| 1836 |
+
return PaginatedList(
|
| 1837 |
+
github.CodeSecurityConfigRepository.CodeSecurityConfigRepository,
|
| 1838 |
+
self._requester,
|
| 1839 |
+
f"{self.url}/code-security/configurations/{id}/repositories",
|
| 1840 |
+
url_parameters,
|
| 1841 |
+
headers={"Accept": Consts.repoVisibilityPreview},
|
| 1842 |
+
)
|
| 1843 |
+
|
| 1844 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 1845 |
+
if "advanced_security_enabled_for_new_repositories" in attributes: # pragma no branch
|
| 1846 |
+
self._advanced_security_enabled_for_new_repositories = self._makeBoolAttribute(
|
| 1847 |
+
attributes["advanced_security_enabled_for_new_repositories"]
|
| 1848 |
+
)
|
| 1849 |
+
if "archived_at" in attributes: # pragma no branch
|
| 1850 |
+
assert attributes["archived_at"] is None or isinstance(attributes["archived_at"], str), attributes[
|
| 1851 |
+
"archived_at"
|
| 1852 |
+
]
|
| 1853 |
+
self._archived_at = self._makeDatetimeAttribute(attributes["archived_at"])
|
| 1854 |
+
if "avatar_url" in attributes: # pragma no branch
|
| 1855 |
+
self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
|
| 1856 |
+
if "billing_email" in attributes: # pragma no branch
|
| 1857 |
+
self._billing_email = self._makeStringAttribute(attributes["billing_email"])
|
| 1858 |
+
if "blog" in attributes: # pragma no branch
|
| 1859 |
+
self._blog = self._makeStringAttribute(attributes["blog"])
|
| 1860 |
+
if "collaborators" in attributes: # pragma no branch
|
| 1861 |
+
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
|
| 1862 |
+
if "company" in attributes: # pragma no branch
|
| 1863 |
+
self._company = self._makeStringAttribute(attributes["company"])
|
| 1864 |
+
if "created_at" in attributes: # pragma no branch
|
| 1865 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 1866 |
+
if "default_repository_permission" in attributes: # pragma no branch
|
| 1867 |
+
self._default_repository_permission = self._makeStringAttribute(attributes["default_repository_permission"])
|
| 1868 |
+
if "dependabot_alerts_enabled_for_new_repositories" in attributes: # pragma no branch
|
| 1869 |
+
self._dependabot_alerts_enabled_for_new_repositories = self._makeBoolAttribute(
|
| 1870 |
+
attributes["dependabot_alerts_enabled_for_new_repositories"]
|
| 1871 |
+
)
|
| 1872 |
+
if "dependabot_security_updates_enabled_for_new_repositories" in attributes: # pragma no branch
|
| 1873 |
+
self._dependabot_security_updates_enabled_for_new_repositories = self._makeBoolAttribute(
|
| 1874 |
+
attributes["dependabot_security_updates_enabled_for_new_repositories"]
|
| 1875 |
+
)
|
| 1876 |
+
if "dependency_graph_enabled_for_new_repositories" in attributes: # pragma no branch
|
| 1877 |
+
self._dependency_graph_enabled_for_new_repositories = self._makeBoolAttribute(
|
| 1878 |
+
attributes["dependency_graph_enabled_for_new_repositories"]
|
| 1879 |
+
)
|
| 1880 |
+
if "description" in attributes: # pragma no branch
|
| 1881 |
+
self._description = self._makeStringAttribute(attributes["description"])
|
| 1882 |
+
if "disk_usage" in attributes: # pragma no branch
|
| 1883 |
+
self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
|
| 1884 |
+
if "display_login" in attributes: # pragma no branch
|
| 1885 |
+
self._display_login = self._makeStringAttribute(attributes["display_login"])
|
| 1886 |
+
if "email" in attributes: # pragma no branch
|
| 1887 |
+
self._email = self._makeStringAttribute(attributes["email"])
|
| 1888 |
+
if "events_url" in attributes: # pragma no branch
|
| 1889 |
+
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
| 1890 |
+
if "followers" in attributes: # pragma no branch
|
| 1891 |
+
self._followers = self._makeIntAttribute(attributes["followers"])
|
| 1892 |
+
if "following" in attributes: # pragma no branch
|
| 1893 |
+
self._following = self._makeIntAttribute(attributes["following"])
|
| 1894 |
+
if "gravatar_id" in attributes: # pragma no branch
|
| 1895 |
+
self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
|
| 1896 |
+
if "has_organization_projects" in attributes: # pragma no branch
|
| 1897 |
+
self._has_organization_projects = self._makeBoolAttribute(attributes["has_organization_projects"])
|
| 1898 |
+
if "has_repository_projects" in attributes: # pragma no branch
|
| 1899 |
+
self._has_repository_projects = self._makeBoolAttribute(attributes["has_repository_projects"])
|
| 1900 |
+
if "hooks_url" in attributes: # pragma no branch
|
| 1901 |
+
self._hooks_url = self._makeStringAttribute(attributes["hooks_url"])
|
| 1902 |
+
if "html_url" in attributes: # pragma no branch
|
| 1903 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 1904 |
+
if "id" in attributes: # pragma no branch
|
| 1905 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 1906 |
+
if "is_verified" in attributes: # pragma no branch
|
| 1907 |
+
self._is_verified = self._makeBoolAttribute(attributes["is_verified"])
|
| 1908 |
+
if "issues_url" in attributes: # pragma no branch
|
| 1909 |
+
self._issues_url = self._makeStringAttribute(attributes["issues_url"])
|
| 1910 |
+
if "location" in attributes: # pragma no branch
|
| 1911 |
+
self._location = self._makeStringAttribute(attributes["location"])
|
| 1912 |
+
if "login" in attributes: # pragma no branch
|
| 1913 |
+
self._login = self._makeStringAttribute(attributes["login"])
|
| 1914 |
+
if "members_allowed_repository_creation_type" in attributes: # pragma no branch
|
| 1915 |
+
self._members_allowed_repository_creation_type = self._makeStringAttribute(
|
| 1916 |
+
attributes["members_allowed_repository_creation_type"]
|
| 1917 |
+
)
|
| 1918 |
+
if "members_can_create_internal_repositories" in attributes: # pragma no branch
|
| 1919 |
+
self._members_can_create_internal_repositories = self._makeBoolAttribute(
|
| 1920 |
+
attributes["members_can_create_internal_repositories"]
|
| 1921 |
+
)
|
| 1922 |
+
if "members_can_create_pages" in attributes: # pragma no branch
|
| 1923 |
+
self._members_can_create_pages = self._makeBoolAttribute(attributes["members_can_create_pages"])
|
| 1924 |
+
if "members_can_create_private_pages" in attributes: # pragma no branch
|
| 1925 |
+
self._members_can_create_private_pages = self._makeBoolAttribute(
|
| 1926 |
+
attributes["members_can_create_private_pages"]
|
| 1927 |
+
)
|
| 1928 |
+
if "members_can_create_private_repositories" in attributes: # pragma no branch
|
| 1929 |
+
self._members_can_create_private_repositories = self._makeBoolAttribute(
|
| 1930 |
+
attributes["members_can_create_private_repositories"]
|
| 1931 |
+
)
|
| 1932 |
+
if "members_can_create_public_pages" in attributes: # pragma no branch
|
| 1933 |
+
self._members_can_create_public_pages = self._makeBoolAttribute(
|
| 1934 |
+
attributes["members_can_create_public_pages"]
|
| 1935 |
+
)
|
| 1936 |
+
if "members_can_create_public_repositories" in attributes: # pragma no branch
|
| 1937 |
+
self._members_can_create_public_repositories = self._makeBoolAttribute(
|
| 1938 |
+
attributes["members_can_create_public_repositories"]
|
| 1939 |
+
)
|
| 1940 |
+
if "members_can_create_repositories" in attributes: # pragma no branch
|
| 1941 |
+
self._members_can_create_repositories = self._makeBoolAttribute(
|
| 1942 |
+
attributes["members_can_create_repositories"]
|
| 1943 |
+
)
|
| 1944 |
+
if "members_can_fork_private_repositories" in attributes: # pragma no branch
|
| 1945 |
+
self._members_can_fork_private_repositories = self._makeBoolAttribute(
|
| 1946 |
+
attributes["members_can_fork_private_repositories"]
|
| 1947 |
+
)
|
| 1948 |
+
if "members_url" in attributes: # pragma no branch
|
| 1949 |
+
self._members_url = self._makeStringAttribute(attributes["members_url"])
|
| 1950 |
+
if "name" in attributes: # pragma no branch
|
| 1951 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 1952 |
+
if "node_id" in attributes: # pragma no branch
|
| 1953 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 1954 |
+
if "owned_private_repos" in attributes: # pragma no branch
|
| 1955 |
+
self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
|
| 1956 |
+
if "plan" in attributes: # pragma no branch
|
| 1957 |
+
self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
|
| 1958 |
+
if "private_gists" in attributes: # pragma no branch
|
| 1959 |
+
self._private_gists = self._makeIntAttribute(attributes["private_gists"])
|
| 1960 |
+
if "public_gists" in attributes: # pragma no branch
|
| 1961 |
+
self._public_gists = self._makeIntAttribute(attributes["public_gists"])
|
| 1962 |
+
if "public_members_url" in attributes: # pragma no branch
|
| 1963 |
+
self._public_members_url = self._makeStringAttribute(attributes["public_members_url"])
|
| 1964 |
+
if "public_repos" in attributes: # pragma no branch
|
| 1965 |
+
self._public_repos = self._makeIntAttribute(attributes["public_repos"])
|
| 1966 |
+
if "repos_url" in attributes: # pragma no branch
|
| 1967 |
+
self._repos_url = self._makeStringAttribute(attributes["repos_url"])
|
| 1968 |
+
if "secret_scanning_enabled_for_new_repositories" in attributes: # pragma no branch
|
| 1969 |
+
self._secret_scanning_enabled_for_new_repositories = self._makeBoolAttribute(
|
| 1970 |
+
attributes["secret_scanning_enabled_for_new_repositories"]
|
| 1971 |
+
)
|
| 1972 |
+
if "secret_scanning_push_protection_custom_link" in attributes: # pragma no branch
|
| 1973 |
+
self._secret_scanning_push_protection_custom_link = self._makeStringAttribute(
|
| 1974 |
+
attributes["secret_scanning_push_protection_custom_link"]
|
| 1975 |
+
)
|
| 1976 |
+
if "secret_scanning_push_protection_custom_link_enabled" in attributes: # pragma no branch
|
| 1977 |
+
self._secret_scanning_push_protection_custom_link_enabled = self._makeBoolAttribute(
|
| 1978 |
+
attributes["secret_scanning_push_protection_custom_link_enabled"]
|
| 1979 |
+
)
|
| 1980 |
+
if "secret_scanning_push_protection_enabled_for_new_repositories" in attributes: # pragma no branch
|
| 1981 |
+
self._secret_scanning_push_protection_enabled_for_new_repositories = self._makeBoolAttribute(
|
| 1982 |
+
attributes["secret_scanning_push_protection_enabled_for_new_repositories"]
|
| 1983 |
+
)
|
| 1984 |
+
if "total_private_repos" in attributes: # pragma no branch
|
| 1985 |
+
self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
|
| 1986 |
+
if "twitter_username" in attributes: # pragma no branch
|
| 1987 |
+
self._twitter_username = self._makeStringAttribute(attributes["twitter_username"])
|
| 1988 |
+
if "two_factor_requirement_enabled" in attributes: # pragma no branch
|
| 1989 |
+
self._two_factor_requirement_enabled = self._makeBoolAttribute(attributes["two_factor_requirement_enabled"])
|
| 1990 |
+
if "type" in attributes: # pragma no branch
|
| 1991 |
+
self._type = self._makeStringAttribute(attributes["type"])
|
| 1992 |
+
if "updated_at" in attributes: # pragma no branch
|
| 1993 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 1994 |
+
if "url" in attributes: # pragma no branch
|
| 1995 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 1996 |
+
if "web_commit_signoff_required" in attributes: # pragma no branch
|
| 1997 |
+
self._web_commit_signoff_required = self._makeBoolAttribute(attributes["web_commit_signoff_required"])
|
python_embeded/Lib/site-packages/github/OrganizationCustomProperty.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2024 Jacky Lam <jacky.lam@r2studiohk.com> #
|
| 4 |
+
# Copyright 2024 Kian-Meng Ang <kianmeng.ang@gmail.com> #
|
| 5 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 6 |
+
# #
|
| 7 |
+
# This file is part of PyGithub. #
|
| 8 |
+
# http://pygithub.readthedocs.io/ #
|
| 9 |
+
# #
|
| 10 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 11 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 12 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 13 |
+
# any later version. #
|
| 14 |
+
# #
|
| 15 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 16 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 17 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 18 |
+
# details. #
|
| 19 |
+
# #
|
| 20 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 21 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 22 |
+
# #
|
| 23 |
+
################################################################################
|
| 24 |
+
|
| 25 |
+
from __future__ import annotations
|
| 26 |
+
|
| 27 |
+
from typing import Any
|
| 28 |
+
|
| 29 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet, Opt, is_optional
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class CustomProperty:
|
| 33 |
+
"""
|
| 34 |
+
This class represents a CustomProperty for an Organization. Use this class to create a new post parameter object.
|
| 35 |
+
|
| 36 |
+
The reference can be found here
|
| 37 |
+
https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization
|
| 38 |
+
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
def __init__(
|
| 42 |
+
self,
|
| 43 |
+
property_name: str,
|
| 44 |
+
value_type: str,
|
| 45 |
+
required: Opt[bool] = NotSet,
|
| 46 |
+
default_value: Opt[None | str | list[str]] = NotSet,
|
| 47 |
+
description: Opt[str | None] = NotSet,
|
| 48 |
+
allowed_values: Opt[list[str] | None] = NotSet,
|
| 49 |
+
values_editable_by: Opt[str | None] = NotSet,
|
| 50 |
+
):
|
| 51 |
+
assert isinstance(property_name, str), property_name
|
| 52 |
+
assert isinstance(value_type, str), value_type
|
| 53 |
+
assert value_type in ["string", "single_select"], value_type
|
| 54 |
+
assert is_optional(required, bool), required
|
| 55 |
+
assert is_optional(default_value, (type(None), str, list)), default_value
|
| 56 |
+
assert is_optional(description, (str, type(None))), description
|
| 57 |
+
assert is_optional(allowed_values, (list, type(None))), allowed_values
|
| 58 |
+
assert is_optional(values_editable_by, (str, type(None))), values_editable_by
|
| 59 |
+
if values_editable_by is not NotSet:
|
| 60 |
+
assert values_editable_by in ["org_actors", "org_and_repo_actors"], values_editable_by
|
| 61 |
+
|
| 62 |
+
self.property_name = property_name
|
| 63 |
+
self.value_type = value_type
|
| 64 |
+
self.required = required
|
| 65 |
+
self.default_value = default_value
|
| 66 |
+
self.description = description
|
| 67 |
+
self.allowed_values = allowed_values
|
| 68 |
+
self.values_editable_by = values_editable_by
|
| 69 |
+
|
| 70 |
+
def to_dict(self) -> dict[str, Any]:
|
| 71 |
+
return NotSet.remove_unset_items(self.__dict__)
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class OrganizationCustomProperty(NonCompletableGithubObject):
|
| 75 |
+
"""
|
| 76 |
+
This class represents a CustomProperty for an Organization.
|
| 77 |
+
|
| 78 |
+
The reference can be found here
|
| 79 |
+
https://docs.github.com/en/rest/orgs/custom-properties
|
| 80 |
+
|
| 81 |
+
The OpenAPI schema can be found at
|
| 82 |
+
- /components/schemas/custom-property
|
| 83 |
+
|
| 84 |
+
"""
|
| 85 |
+
|
| 86 |
+
def _initAttributes(self) -> None:
|
| 87 |
+
self._allowed_values: Attribute[list[str]] = NotSet
|
| 88 |
+
self._default_value: Attribute[str | list[str]] = NotSet
|
| 89 |
+
self._description: Attribute[str] = NotSet
|
| 90 |
+
self._property_name: Attribute[str] = NotSet
|
| 91 |
+
self._required: Attribute[bool] = NotSet
|
| 92 |
+
self._url: Attribute[str] = NotSet
|
| 93 |
+
self._value_type: Attribute[str] = NotSet
|
| 94 |
+
self._values_editable_by: Attribute[str] = NotSet
|
| 95 |
+
|
| 96 |
+
@property
|
| 97 |
+
def allowed_values(self) -> Opt[list[str] | None]:
|
| 98 |
+
return self._allowed_values.value
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def default_value(self) -> Opt[str | list[str] | None]:
|
| 102 |
+
return self._default_value.value
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def description(self) -> Opt[str | None]:
|
| 106 |
+
return self._description.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def property_name(self) -> str:
|
| 110 |
+
return self._property_name.value
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def required(self) -> Opt[bool | None]:
|
| 114 |
+
return self._required.value
|
| 115 |
+
|
| 116 |
+
@property
|
| 117 |
+
def url(self) -> str:
|
| 118 |
+
return self._url.value
|
| 119 |
+
|
| 120 |
+
@property
|
| 121 |
+
def value_type(self) -> str:
|
| 122 |
+
return self._value_type.value
|
| 123 |
+
|
| 124 |
+
@property
|
| 125 |
+
def values_editable_by(self) -> Opt[str | None]:
|
| 126 |
+
return self._values_editable_by.value
|
| 127 |
+
|
| 128 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 129 |
+
if "allowed_values" in attributes:
|
| 130 |
+
self._allowed_values = self._makeListOfStringsAttribute(attributes["allowed_values"])
|
| 131 |
+
if "default_value" in attributes:
|
| 132 |
+
self._default_value = self._makeStringAttribute(attributes["default_value"])
|
| 133 |
+
if "description" in attributes:
|
| 134 |
+
self._description = self._makeStringAttribute(attributes["description"])
|
| 135 |
+
if "property_name" in attributes: # pragma no branch
|
| 136 |
+
self._property_name = self._makeStringAttribute(attributes["property_name"])
|
| 137 |
+
if "required" in attributes:
|
| 138 |
+
self._required = self._makeBoolAttribute(attributes["required"])
|
| 139 |
+
if "url" in attributes: # pragma no branch
|
| 140 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 141 |
+
if "value_type" in attributes: # pragma no branch
|
| 142 |
+
self._value_type = self._makeStringAttribute(attributes["value_type"])
|
| 143 |
+
if "values_editable_by" in attributes:
|
| 144 |
+
self._values_editable_by = self._makeStringAttribute(attributes["values_editable_by"])
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
class RepositoryCustomPropertyValues(NonCompletableGithubObject):
|
| 148 |
+
"""
|
| 149 |
+
This class represents CustomPropertyValues for a Repository.
|
| 150 |
+
|
| 151 |
+
The reference can be found here
|
| 152 |
+
https://docs.github.com/en/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories
|
| 153 |
+
|
| 154 |
+
"""
|
| 155 |
+
|
| 156 |
+
def _initAttributes(self) -> None:
|
| 157 |
+
self._properties: Attribute[dict[str, str]] = NotSet
|
| 158 |
+
self._repository_full_name: Attribute[str] = NotSet
|
| 159 |
+
self._repository_id: Attribute[int] = NotSet
|
| 160 |
+
self._repository_name: Attribute[str] = NotSet
|
| 161 |
+
|
| 162 |
+
@property
|
| 163 |
+
def properties(self) -> dict[str, str]:
|
| 164 |
+
return self._properties.value
|
| 165 |
+
|
| 166 |
+
@property
|
| 167 |
+
def repository_full_name(self) -> str:
|
| 168 |
+
return self._repository_full_name.value
|
| 169 |
+
|
| 170 |
+
@property
|
| 171 |
+
def repository_name(self) -> str:
|
| 172 |
+
return self._repository_name.value
|
| 173 |
+
|
| 174 |
+
@property
|
| 175 |
+
def repository_id(self) -> int:
|
| 176 |
+
return self._repository_id.value
|
| 177 |
+
|
| 178 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 179 |
+
self._repository_id = self._makeIntAttribute(attributes["repository_id"])
|
| 180 |
+
self._repository_name = self._makeStringAttribute(attributes["repository_name"])
|
| 181 |
+
self._repository_full_name = self._makeStringAttribute(attributes["repository_full_name"])
|
| 182 |
+
properties = {p["property_name"]: p["value"] for p in attributes["properties"]}
|
| 183 |
+
self._properties = self._makeDictAttribute(properties)
|
python_embeded/Lib/site-packages/github/OrganizationDependabotAlert.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 4 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 5 |
+
# Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
|
| 6 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 7 |
+
# #
|
| 8 |
+
# This file is part of PyGithub. #
|
| 9 |
+
# http://pygithub.readthedocs.io/ #
|
| 10 |
+
# #
|
| 11 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 12 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 13 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 14 |
+
# any later version. #
|
| 15 |
+
# #
|
| 16 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 17 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 18 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 19 |
+
# details. #
|
| 20 |
+
# #
|
| 21 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 22 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 23 |
+
# #
|
| 24 |
+
################################################################################
|
| 25 |
+
|
| 26 |
+
from __future__ import annotations
|
| 27 |
+
|
| 28 |
+
from typing import Any
|
| 29 |
+
|
| 30 |
+
from github.DependabotAlert import DependabotAlert
|
| 31 |
+
from github.GithubObject import Attribute, NotSet
|
| 32 |
+
from github.Repository import Repository
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class OrganizationDependabotAlert(DependabotAlert):
|
| 36 |
+
"""
|
| 37 |
+
This class represents a Dependabot alert on an organization.
|
| 38 |
+
|
| 39 |
+
The reference can be found here
|
| 40 |
+
https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization
|
| 41 |
+
|
| 42 |
+
The OpenAPI schema can be found at
|
| 43 |
+
- /components/schemas/dependabot-alert-with-repository
|
| 44 |
+
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
def _initAttributes(self) -> None:
|
| 48 |
+
super()._initAttributes()
|
| 49 |
+
self._repository: Attribute[Repository] = NotSet
|
| 50 |
+
|
| 51 |
+
@property
|
| 52 |
+
def repository(self) -> Repository:
|
| 53 |
+
return self._repository.value
|
| 54 |
+
|
| 55 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 56 |
+
super()._useAttributes(attributes)
|
| 57 |
+
if "repository" in attributes:
|
| 58 |
+
self._repository = self._makeClassAttribute(Repository, attributes["repository"])
|
python_embeded/Lib/site-packages/github/OrganizationSecret.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 4 |
+
# Copyright 2023 Mauricio Alejandro Martínez Pacheco <mauricio.martinez@premise.com>#
|
| 5 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 6 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 7 |
+
# Copyright 2024 Thomas Crowley <15927917+thomascrowley@users.noreply.github.com>#
|
| 8 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 9 |
+
# #
|
| 10 |
+
# This file is part of PyGithub. #
|
| 11 |
+
# http://pygithub.readthedocs.io/ #
|
| 12 |
+
# #
|
| 13 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 14 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 15 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 16 |
+
# any later version. #
|
| 17 |
+
# #
|
| 18 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 19 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 20 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 21 |
+
# details. #
|
| 22 |
+
# #
|
| 23 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 24 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 25 |
+
# #
|
| 26 |
+
################################################################################
|
| 27 |
+
|
| 28 |
+
from datetime import datetime
|
| 29 |
+
from typing import Any, Dict
|
| 30 |
+
|
| 31 |
+
from github.GithubObject import Attribute, NotSet
|
| 32 |
+
from github.PaginatedList import PaginatedList
|
| 33 |
+
from github.Repository import Repository
|
| 34 |
+
from github.Secret import Secret
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class OrganizationSecret(Secret):
|
| 38 |
+
"""
|
| 39 |
+
This class represents a org level GitHub secret.
|
| 40 |
+
|
| 41 |
+
The reference can be found here
|
| 42 |
+
https://docs.github.com/en/rest/actions/secrets
|
| 43 |
+
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
def _initAttributes(self) -> None:
|
| 47 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 48 |
+
self._name: Attribute[str] = NotSet
|
| 49 |
+
self._selected_repositories: Attribute[PaginatedList[Repository]] = NotSet
|
| 50 |
+
self._selected_repositories_url: Attribute[str] = NotSet
|
| 51 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 52 |
+
self._url: Attribute[str] = NotSet
|
| 53 |
+
self._visibility: Attribute[str] = NotSet
|
| 54 |
+
|
| 55 |
+
@property
|
| 56 |
+
def visibility(self) -> str:
|
| 57 |
+
"""
|
| 58 |
+
:type: string
|
| 59 |
+
"""
|
| 60 |
+
self._completeIfNotSet(self._visibility)
|
| 61 |
+
return self._visibility.value
|
| 62 |
+
|
| 63 |
+
@property
|
| 64 |
+
def selected_repositories(self) -> PaginatedList[Repository]:
|
| 65 |
+
return PaginatedList(
|
| 66 |
+
Repository,
|
| 67 |
+
self._requester,
|
| 68 |
+
self._selected_repositories_url.value,
|
| 69 |
+
None,
|
| 70 |
+
list_item="repositories",
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
def edit(
|
| 74 |
+
self,
|
| 75 |
+
value: str,
|
| 76 |
+
visibility: str = "all",
|
| 77 |
+
secret_type: str = "actions",
|
| 78 |
+
) -> bool:
|
| 79 |
+
"""
|
| 80 |
+
:calls: `PATCH /orgs/{org}/{secret_type}/secrets/{variable_name} <https://docs.github.com/en/rest/reference/actions/secrets#update-an-organization-variable>`_
|
| 81 |
+
:param variable_name: string
|
| 82 |
+
:param value: string
|
| 83 |
+
:param visibility: string
|
| 84 |
+
:param secret_type: string options actions or dependabot
|
| 85 |
+
:rtype: bool
|
| 86 |
+
"""
|
| 87 |
+
assert isinstance(value, str), value
|
| 88 |
+
assert isinstance(visibility, str), visibility
|
| 89 |
+
assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
|
| 90 |
+
|
| 91 |
+
patch_parameters: Dict[str, Any] = {
|
| 92 |
+
"name": self.name,
|
| 93 |
+
"value": value,
|
| 94 |
+
"visibility": visibility,
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
status, _, _ = self._requester.requestJson(
|
| 98 |
+
"PATCH",
|
| 99 |
+
f"{self.url}/{secret_type}/secrets/{self.name}",
|
| 100 |
+
input=patch_parameters,
|
| 101 |
+
)
|
| 102 |
+
return status == 204
|
| 103 |
+
|
| 104 |
+
def add_repo(self, repo: Repository) -> bool:
|
| 105 |
+
"""
|
| 106 |
+
:calls: 'PUT {org_url}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>`_
|
| 107 |
+
:param repo: github.Repository.Repository
|
| 108 |
+
:rtype: bool
|
| 109 |
+
"""
|
| 110 |
+
if self.visibility != "selected":
|
| 111 |
+
return False
|
| 112 |
+
self._requester.requestJsonAndCheck("PUT", f"{self._selected_repositories_url.value}/{repo.id}")
|
| 113 |
+
return True
|
| 114 |
+
|
| 115 |
+
def remove_repo(self, repo: Repository) -> bool:
|
| 116 |
+
"""
|
| 117 |
+
:calls: 'DELETE {org_url}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>`_
|
| 118 |
+
:param repo: github.Repository.Repository
|
| 119 |
+
:rtype: bool
|
| 120 |
+
"""
|
| 121 |
+
if self.visibility != "selected":
|
| 122 |
+
return False
|
| 123 |
+
self._requester.requestJsonAndCheck("DELETE", f"{self._selected_repositories_url.value}/{repo.id}")
|
| 124 |
+
return True
|
| 125 |
+
|
| 126 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 127 |
+
if "created_at" in attributes:
|
| 128 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 129 |
+
if "name" in attributes:
|
| 130 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 131 |
+
if "selected_repositories_url" in attributes:
|
| 132 |
+
self._selected_repositories_url = self._makeStringAttribute(attributes["selected_repositories_url"])
|
| 133 |
+
if "updated_at" in attributes:
|
| 134 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 135 |
+
if "url" in attributes:
|
| 136 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 137 |
+
if "visibility" in attributes:
|
| 138 |
+
self._visibility = self._makeStringAttribute(attributes["visibility"])
|
python_embeded/Lib/site-packages/github/OrganizationVariable.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 4 |
+
# Copyright 2023 Mauricio Alejandro Martínez Pacheco <mauricio.martinez@premise.com>#
|
| 5 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 6 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 7 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 8 |
+
# #
|
| 9 |
+
# This file is part of PyGithub. #
|
| 10 |
+
# http://pygithub.readthedocs.io/ #
|
| 11 |
+
# #
|
| 12 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 13 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 14 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 15 |
+
# any later version. #
|
| 16 |
+
# #
|
| 17 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 18 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 19 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 20 |
+
# details. #
|
| 21 |
+
# #
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 23 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 24 |
+
# #
|
| 25 |
+
################################################################################
|
| 26 |
+
|
| 27 |
+
from datetime import datetime
|
| 28 |
+
from typing import Any, Dict
|
| 29 |
+
|
| 30 |
+
from github.GithubObject import Attribute, NotSet
|
| 31 |
+
from github.PaginatedList import PaginatedList
|
| 32 |
+
from github.Repository import Repository
|
| 33 |
+
from github.Variable import Variable
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class OrganizationVariable(Variable):
|
| 37 |
+
"""
|
| 38 |
+
This class represents a org level GitHub variable.
|
| 39 |
+
|
| 40 |
+
The reference can be found here
|
| 41 |
+
https://docs.github.com/en/rest/actions/variables
|
| 42 |
+
|
| 43 |
+
"""
|
| 44 |
+
|
| 45 |
+
def _initAttributes(self) -> None:
|
| 46 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 47 |
+
self._name: Attribute[str] = NotSet
|
| 48 |
+
self._selected_repositories: Attribute[PaginatedList[Repository]] = NotSet
|
| 49 |
+
self._selected_repositories_url: Attribute[str] = NotSet
|
| 50 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 51 |
+
self._url: Attribute[str] = NotSet
|
| 52 |
+
self._visibility: Attribute[str] = NotSet
|
| 53 |
+
|
| 54 |
+
@property
|
| 55 |
+
def visibility(self) -> str:
|
| 56 |
+
"""
|
| 57 |
+
:type: string
|
| 58 |
+
"""
|
| 59 |
+
self._completeIfNotSet(self._visibility)
|
| 60 |
+
return self._visibility.value
|
| 61 |
+
|
| 62 |
+
@property
|
| 63 |
+
def selected_repositories(self) -> PaginatedList[Repository]:
|
| 64 |
+
return PaginatedList(
|
| 65 |
+
Repository,
|
| 66 |
+
self._requester,
|
| 67 |
+
self._selected_repositories_url.value,
|
| 68 |
+
None,
|
| 69 |
+
list_item="repositories",
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
def edit(
|
| 73 |
+
self,
|
| 74 |
+
value: str,
|
| 75 |
+
visibility: str = "all",
|
| 76 |
+
) -> bool:
|
| 77 |
+
"""
|
| 78 |
+
:calls: `PATCH /orgs/{org}/actions/variables/{variable_name} <https://docs.github.com/en/rest/reference/actions/variables#update-an-organization-variable>`_
|
| 79 |
+
:param variable_name: string
|
| 80 |
+
:param value: string
|
| 81 |
+
:param visibility: string
|
| 82 |
+
:rtype: bool
|
| 83 |
+
"""
|
| 84 |
+
assert isinstance(value, str), value
|
| 85 |
+
assert isinstance(visibility, str), visibility
|
| 86 |
+
|
| 87 |
+
patch_parameters: Dict[str, Any] = {
|
| 88 |
+
"name": self.name,
|
| 89 |
+
"value": value,
|
| 90 |
+
"visibility": visibility,
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
status, _, _ = self._requester.requestJson(
|
| 94 |
+
"PATCH",
|
| 95 |
+
f"{self.url}/actions/variables/{self.name}",
|
| 96 |
+
input=patch_parameters,
|
| 97 |
+
)
|
| 98 |
+
return status == 204
|
| 99 |
+
|
| 100 |
+
def add_repo(self, repo: Repository) -> bool:
|
| 101 |
+
"""
|
| 102 |
+
:calls: 'PUT {org_url}/actions/variables/{variable_name} <https://docs.github.com/en/rest/actions/variables#add-selected-repository-to-an-organization-secret>`_
|
| 103 |
+
:param repo: github.Repository.Repository
|
| 104 |
+
:rtype: bool
|
| 105 |
+
"""
|
| 106 |
+
if self.visibility != "selected":
|
| 107 |
+
return False
|
| 108 |
+
self._requester.requestJsonAndCheck("PUT", f"{self._selected_repositories_url.value}/{repo.id}")
|
| 109 |
+
return True
|
| 110 |
+
|
| 111 |
+
def remove_repo(self, repo: Repository) -> bool:
|
| 112 |
+
"""
|
| 113 |
+
:calls: 'DELETE {org_url}/actions/variables/{variable_name} <https://docs.github.com/en/rest/actions/variables#add-selected-repository-to-an-organization-secret>`_
|
| 114 |
+
:param repo: github.Repository.Repository
|
| 115 |
+
:rtype: bool
|
| 116 |
+
"""
|
| 117 |
+
if self.visibility != "selected":
|
| 118 |
+
return False
|
| 119 |
+
self._requester.requestJsonAndCheck("DELETE", f"{self._selected_repositories_url.value}/{repo.id}")
|
| 120 |
+
return True
|
| 121 |
+
|
| 122 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 123 |
+
if "created_at" in attributes:
|
| 124 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 125 |
+
if "name" in attributes:
|
| 126 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 127 |
+
if "selected_repositories_url" in attributes:
|
| 128 |
+
self._selected_repositories_url = self._makeStringAttribute(attributes["selected_repositories_url"])
|
| 129 |
+
if "updated_at" in attributes:
|
| 130 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 131 |
+
if "url" in attributes:
|
| 132 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 133 |
+
if "visibility" in attributes:
|
| 134 |
+
self._visibility = self._makeStringAttribute(attributes["visibility"])
|
python_embeded/Lib/site-packages/github/PaginatedList.py
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Bill Mill <bill.mill@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2013 davidbrai <davidbrai@gmail.com> #
|
| 9 |
+
# Copyright 2014 Thialfihar <thi@thialfihar.org> #
|
| 10 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 11 |
+
# Copyright 2015 Dan Vanderkam <danvdk@gmail.com> #
|
| 12 |
+
# Copyright 2015 Eliot Walker <eliot@lyft.com> #
|
| 13 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 14 |
+
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
| 15 |
+
# Copyright 2018 Gilad Shefer <gshefer@redhat.com> #
|
| 16 |
+
# Copyright 2018 Joel Koglin <JoelKoglin@gmail.com> #
|
| 17 |
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 19 |
+
# Copyright 2018 netsgnut <284779+netsgnut@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 21 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 22 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 23 |
+
# Copyright 2020 Emir Hodzic <emir.hodzich@gmail.com> #
|
| 24 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 25 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 26 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 27 |
+
# Copyright 2023 Andrew Dawes <53574062+AndrewJDawes@users.noreply.github.com> #
|
| 28 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 29 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 30 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 31 |
+
# Copyright 2023 YugoHino <henom06@gmail.com> #
|
| 32 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 33 |
+
# #
|
| 34 |
+
# This file is part of PyGithub. #
|
| 35 |
+
# http://pygithub.readthedocs.io/ #
|
| 36 |
+
# #
|
| 37 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 38 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 39 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 40 |
+
# any later version. #
|
| 41 |
+
# #
|
| 42 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 43 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 44 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 45 |
+
# details. #
|
| 46 |
+
# #
|
| 47 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 48 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 49 |
+
# #
|
| 50 |
+
################################################################################
|
| 51 |
+
|
| 52 |
+
from typing import Any, Callable, Dict, Generic, Iterator, List, Optional, Type, TypeVar, Union
|
| 53 |
+
from urllib.parse import parse_qs
|
| 54 |
+
|
| 55 |
+
from github.GithubObject import GithubObject
|
| 56 |
+
from github.Requester import Requester
|
| 57 |
+
|
| 58 |
+
T = TypeVar("T", bound=GithubObject)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class PaginatedListBase(Generic[T]):
|
| 62 |
+
__elements: List[T]
|
| 63 |
+
|
| 64 |
+
def _couldGrow(self) -> bool:
|
| 65 |
+
raise NotImplementedError
|
| 66 |
+
|
| 67 |
+
def _fetchNextPage(self) -> List[T]:
|
| 68 |
+
raise NotImplementedError
|
| 69 |
+
|
| 70 |
+
def __init__(self, elements: Optional[List[T]] = None) -> None:
|
| 71 |
+
self.__elements = [] if elements is None else elements
|
| 72 |
+
|
| 73 |
+
def __getitem__(self, index: Union[int, slice]) -> Any:
|
| 74 |
+
assert isinstance(index, (int, slice))
|
| 75 |
+
if isinstance(index, int):
|
| 76 |
+
self.__fetchToIndex(index)
|
| 77 |
+
return self.__elements[index]
|
| 78 |
+
else:
|
| 79 |
+
return self._Slice(self, index)
|
| 80 |
+
|
| 81 |
+
def __iter__(self) -> Iterator[T]:
|
| 82 |
+
yield from self.__elements
|
| 83 |
+
while self._couldGrow():
|
| 84 |
+
newElements = self._grow()
|
| 85 |
+
yield from newElements
|
| 86 |
+
|
| 87 |
+
def _isBiggerThan(self, index: int) -> bool:
|
| 88 |
+
return len(self.__elements) > index or self._couldGrow()
|
| 89 |
+
|
| 90 |
+
def __fetchToIndex(self, index: int) -> None:
|
| 91 |
+
while len(self.__elements) <= index and self._couldGrow():
|
| 92 |
+
self._grow()
|
| 93 |
+
|
| 94 |
+
def _grow(self) -> List[T]:
|
| 95 |
+
newElements = self._fetchNextPage()
|
| 96 |
+
self.__elements += newElements
|
| 97 |
+
return newElements
|
| 98 |
+
|
| 99 |
+
class _Slice:
|
| 100 |
+
def __init__(self, theList: "PaginatedListBase[T]", theSlice: slice):
|
| 101 |
+
self.__list = theList
|
| 102 |
+
self.__start = theSlice.start or 0
|
| 103 |
+
self.__stop = theSlice.stop
|
| 104 |
+
self.__step = theSlice.step or 1
|
| 105 |
+
|
| 106 |
+
def __iter__(self) -> Iterator[T]:
|
| 107 |
+
index = self.__start
|
| 108 |
+
while not self.__finished(index):
|
| 109 |
+
if self.__list._isBiggerThan(index):
|
| 110 |
+
yield self.__list[index]
|
| 111 |
+
index += self.__step
|
| 112 |
+
else:
|
| 113 |
+
return
|
| 114 |
+
|
| 115 |
+
def __finished(self, index: int) -> bool:
|
| 116 |
+
return self.__stop is not None and index >= self.__stop
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class PaginatedList(PaginatedListBase[T]):
|
| 120 |
+
"""
|
| 121 |
+
This class abstracts the `pagination of the REST API <https://docs.github.com/en/rest/guides/traversing-with-pagination>`_
|
| 122 |
+
and the GraphQl API <https://docs.github.com/en/graphql/guides/using-pagination-in-the-graphql-api>`_.
|
| 123 |
+
|
| 124 |
+
You can simply enumerate through instances of this class::
|
| 125 |
+
|
| 126 |
+
for repo in user.get_repos():
|
| 127 |
+
print(repo.name)
|
| 128 |
+
|
| 129 |
+
If you want to know the total number of items in the list::
|
| 130 |
+
|
| 131 |
+
print(user.get_repos().totalCount)
|
| 132 |
+
|
| 133 |
+
You can also index them or take slices::
|
| 134 |
+
|
| 135 |
+
second_repo = user.get_repos()[1]
|
| 136 |
+
first_repos = user.get_repos()[:10]
|
| 137 |
+
|
| 138 |
+
If you want to iterate in reversed order, just do::
|
| 139 |
+
|
| 140 |
+
for repo in user.get_repos().reversed:
|
| 141 |
+
print(repo.name)
|
| 142 |
+
|
| 143 |
+
And if you really need it, you can explicitly access a specific page::
|
| 144 |
+
|
| 145 |
+
repos = user.get_repos()
|
| 146 |
+
assert repos.is_rest, "get_page not supported by the GraphQL API"
|
| 147 |
+
|
| 148 |
+
some_repos = repos.get_page(0)
|
| 149 |
+
some_other_repos = repos.get_page(3)
|
| 150 |
+
"""
|
| 151 |
+
|
| 152 |
+
# v3: move * before firstUrl and fix call sites
|
| 153 |
+
def __init__(
|
| 154 |
+
self,
|
| 155 |
+
contentClass: Type[T],
|
| 156 |
+
requester: Requester,
|
| 157 |
+
firstUrl: Optional[str] = None,
|
| 158 |
+
firstParams: Optional[Dict[str, Any]] = None,
|
| 159 |
+
*,
|
| 160 |
+
headers: Optional[Dict[str, str]] = None,
|
| 161 |
+
list_item: Union[str, List[str]] = "items",
|
| 162 |
+
total_count_item: str = "total_count",
|
| 163 |
+
firstData: Optional[Any] = None,
|
| 164 |
+
firstHeaders: Optional[Dict[str, Union[str, int]]] = None,
|
| 165 |
+
attributesTransformer: Optional[Callable[[Dict[str, Any]], Dict[str, Any]]] = None,
|
| 166 |
+
graphql_query: Optional[str] = None,
|
| 167 |
+
graphql_variables: Optional[Dict[str, Any]] = None,
|
| 168 |
+
):
|
| 169 |
+
if firstUrl is None and firstData is None and graphql_query is None:
|
| 170 |
+
raise ValueError("Either firstUrl or graphql_query must be given")
|
| 171 |
+
if firstUrl is not None and graphql_query is not None:
|
| 172 |
+
raise ValueError("Only one of firstUrl or graphql_query can be given")
|
| 173 |
+
if graphql_query is not None:
|
| 174 |
+
if not (isinstance(list_item, list) and all(isinstance(item, str) for item in list_item)):
|
| 175 |
+
raise ValueError("With graphql_query given, item_list must be a list of strings")
|
| 176 |
+
|
| 177 |
+
self.__requester = requester
|
| 178 |
+
self.__contentClass = contentClass
|
| 179 |
+
|
| 180 |
+
self.__is_rest = firstUrl is not None or firstData is not None
|
| 181 |
+
self.__firstUrl = firstUrl
|
| 182 |
+
self.__firstParams: Dict[str, Any] = firstParams or {}
|
| 183 |
+
self.__nextUrl = firstUrl
|
| 184 |
+
self.__nextParams: Dict[str, Any] = firstParams or {}
|
| 185 |
+
self.__headers = headers
|
| 186 |
+
self.__list_item = list_item
|
| 187 |
+
self.__total_count_item = total_count_item
|
| 188 |
+
if self.__requester.per_page != 30:
|
| 189 |
+
self.__nextParams["per_page"] = self.__requester.per_page
|
| 190 |
+
self._reversed = False
|
| 191 |
+
self.__totalCount: Optional[int] = None
|
| 192 |
+
self._attributesTransformer = attributesTransformer
|
| 193 |
+
|
| 194 |
+
self.__graphql_query = graphql_query
|
| 195 |
+
self.__graphql_variables = graphql_variables or {}
|
| 196 |
+
self.__page_info = None
|
| 197 |
+
|
| 198 |
+
first_page = []
|
| 199 |
+
if firstData is not None:
|
| 200 |
+
first_page = self._getPage(firstData, firstHeaders)
|
| 201 |
+
# this paginated list contains a single page
|
| 202 |
+
if self.__nextUrl is None and self.__totalCount is None:
|
| 203 |
+
self.__totalCount = len(first_page)
|
| 204 |
+
super().__init__(first_page)
|
| 205 |
+
|
| 206 |
+
@property
|
| 207 |
+
def is_rest(self) -> bool:
|
| 208 |
+
return self.__is_rest
|
| 209 |
+
|
| 210 |
+
@property
|
| 211 |
+
def is_graphql(self) -> bool:
|
| 212 |
+
return not self.is_rest
|
| 213 |
+
|
| 214 |
+
def _transformAttributes(self, element: Dict[str, Any]) -> Dict[str, Any]:
|
| 215 |
+
if self._attributesTransformer is None:
|
| 216 |
+
return element
|
| 217 |
+
return self._attributesTransformer(element)
|
| 218 |
+
|
| 219 |
+
@property
|
| 220 |
+
def totalCount(self) -> int:
|
| 221 |
+
if self.__totalCount is None:
|
| 222 |
+
if self.is_rest:
|
| 223 |
+
params = self.__nextParams.copy()
|
| 224 |
+
# set per_page = 1 so the totalCount is just the number of pages
|
| 225 |
+
params.update({"per_page": 1})
|
| 226 |
+
headers, data = self.__requester.requestJsonAndCheck(
|
| 227 |
+
"GET", self.__firstUrl, parameters=params, headers=self.__headers # type: ignore
|
| 228 |
+
)
|
| 229 |
+
if "link" not in headers:
|
| 230 |
+
if data and "total_count" in data:
|
| 231 |
+
self.__totalCount = data["total_count"]
|
| 232 |
+
elif data:
|
| 233 |
+
if isinstance(data, dict):
|
| 234 |
+
data = data[self.__list_item]
|
| 235 |
+
self.__totalCount = len(data)
|
| 236 |
+
else:
|
| 237 |
+
self.__totalCount = 0
|
| 238 |
+
else:
|
| 239 |
+
links = self.__parseLinkHeader(headers)
|
| 240 |
+
lastUrl = links.get("last")
|
| 241 |
+
if lastUrl:
|
| 242 |
+
self.__totalCount = int(parse_qs(lastUrl)["page"][0])
|
| 243 |
+
else:
|
| 244 |
+
self.__totalCount = 0
|
| 245 |
+
else:
|
| 246 |
+
variables = self.__graphql_variables.copy()
|
| 247 |
+
if not self._reversed:
|
| 248 |
+
variables["first"] = 1
|
| 249 |
+
variables["after"] = None
|
| 250 |
+
else:
|
| 251 |
+
variables["last"] = 1
|
| 252 |
+
variables["before"] = None
|
| 253 |
+
|
| 254 |
+
_, data = self.__requester.graphql_query(self.__graphql_query, variables) # type: ignore
|
| 255 |
+
pagination = self._get_graphql_pagination(data["data"], self.__list_item) # type: ignore
|
| 256 |
+
self.__totalCount = pagination.get("totalCount")
|
| 257 |
+
return self.__totalCount # type: ignore
|
| 258 |
+
|
| 259 |
+
def _getLastPageUrl(self) -> Optional[str]:
|
| 260 |
+
headers, data = self.__requester.requestJsonAndCheck(
|
| 261 |
+
"GET", self.__firstUrl, parameters=self.__nextParams, headers=self.__headers # type: ignore
|
| 262 |
+
)
|
| 263 |
+
links = self.__parseLinkHeader(headers)
|
| 264 |
+
return links.get("last")
|
| 265 |
+
|
| 266 |
+
@property
|
| 267 |
+
def reversed(self) -> "PaginatedList[T]":
|
| 268 |
+
r = PaginatedList(
|
| 269 |
+
self.__contentClass,
|
| 270 |
+
self.__requester,
|
| 271 |
+
self.__firstUrl,
|
| 272 |
+
self.__firstParams,
|
| 273 |
+
headers=self.__headers,
|
| 274 |
+
list_item=self.__list_item,
|
| 275 |
+
attributesTransformer=self._attributesTransformer,
|
| 276 |
+
graphql_query=self.__graphql_query,
|
| 277 |
+
graphql_variables=self.__graphql_variables,
|
| 278 |
+
)
|
| 279 |
+
r.__reverse()
|
| 280 |
+
return r
|
| 281 |
+
|
| 282 |
+
def __reverse(self) -> None:
|
| 283 |
+
self._reversed = True
|
| 284 |
+
if self.is_rest:
|
| 285 |
+
lastUrl = self._getLastPageUrl()
|
| 286 |
+
if lastUrl:
|
| 287 |
+
self.__nextUrl = lastUrl
|
| 288 |
+
if self.__nextParams:
|
| 289 |
+
# #2929: remove all parameters from self.__nextParams contained in self.__nextUrl
|
| 290 |
+
self.__nextParams = {
|
| 291 |
+
k: v
|
| 292 |
+
for k, v in self.__nextParams.items()
|
| 293 |
+
if k not in Requester.get_parameters_of_url(self.__nextUrl).keys()
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
def _couldGrow(self) -> bool:
|
| 297 |
+
return (
|
| 298 |
+
self.is_rest
|
| 299 |
+
and self.__nextUrl is not None
|
| 300 |
+
or self.is_graphql
|
| 301 |
+
and (
|
| 302 |
+
self.__page_info is None
|
| 303 |
+
or not self._reversed
|
| 304 |
+
and self.__page_info["hasNextPage"]
|
| 305 |
+
or self._reversed
|
| 306 |
+
and self.__page_info["hasPreviousPage"]
|
| 307 |
+
)
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
def _get_graphql_pagination(self, data: Dict[str, Any], path: List[str]) -> Dict[str, Any]:
|
| 311 |
+
for item in path:
|
| 312 |
+
if item not in data:
|
| 313 |
+
raise RuntimeError(f"Pagination path {path} not found in data: {self.paths_of_dict(data)}")
|
| 314 |
+
data = data[item]
|
| 315 |
+
return data
|
| 316 |
+
|
| 317 |
+
def _fetchNextPage(self) -> List[T]:
|
| 318 |
+
if self.is_rest:
|
| 319 |
+
# REST API pagination
|
| 320 |
+
headers, data = self.__requester.requestJsonAndCheck(
|
| 321 |
+
"GET", self.__nextUrl, parameters=self.__nextParams, headers=self.__headers # type: ignore
|
| 322 |
+
)
|
| 323 |
+
data = data if data else []
|
| 324 |
+
return self._getPage(data, headers)
|
| 325 |
+
else:
|
| 326 |
+
# GraphQL API pagination
|
| 327 |
+
variables = self.__graphql_variables.copy()
|
| 328 |
+
if not self._reversed:
|
| 329 |
+
variables["first"] = self.__requester.per_page
|
| 330 |
+
if self.__page_info is not None:
|
| 331 |
+
variables["after"] = self.__page_info["endCursor"]
|
| 332 |
+
else:
|
| 333 |
+
variables["last"] = self.__requester.per_page
|
| 334 |
+
if self.__page_info is not None:
|
| 335 |
+
variables["before"] = self.__page_info["startCursor"]
|
| 336 |
+
|
| 337 |
+
_, data = self.__requester.graphql_query(self.__graphql_query, variables) # type: ignore
|
| 338 |
+
|
| 339 |
+
pagination = self._get_graphql_pagination(data["data"], self.__list_item) # type: ignore
|
| 340 |
+
return self._getPage(pagination, {})
|
| 341 |
+
|
| 342 |
+
def _getPage(self, data: Any, headers: Optional[Dict[str, Union[str, int]]]) -> List[T]:
|
| 343 |
+
if self.is_rest:
|
| 344 |
+
self.__nextUrl = None # type: ignore
|
| 345 |
+
if len(data) > 0:
|
| 346 |
+
links = self.__parseLinkHeader(headers) # type: ignore
|
| 347 |
+
if self._reversed:
|
| 348 |
+
if "prev" in links:
|
| 349 |
+
self.__nextUrl = links["prev"]
|
| 350 |
+
elif "next" in links:
|
| 351 |
+
self.__nextUrl = links["next"]
|
| 352 |
+
self.__nextParams = {}
|
| 353 |
+
if self.__list_item in data:
|
| 354 |
+
self.__totalCount = data.get(self.__total_count_item)
|
| 355 |
+
data = data[self.__list_item]
|
| 356 |
+
content = [
|
| 357 |
+
self.__contentClass(self.__requester, headers, self._transformAttributes(element)) # type: ignore
|
| 358 |
+
for element in data
|
| 359 |
+
if element is not None
|
| 360 |
+
]
|
| 361 |
+
if self._reversed:
|
| 362 |
+
return content[::-1]
|
| 363 |
+
return content
|
| 364 |
+
else:
|
| 365 |
+
if "pageInfo" not in data:
|
| 366 |
+
raise RuntimeError(f"Query must provide pagination with pageInfo:\n{self.__graphql_query}")
|
| 367 |
+
|
| 368 |
+
self.__page_info = data["pageInfo"]
|
| 369 |
+
if any(
|
| 370 |
+
item not in self.__page_info # type: ignore
|
| 371 |
+
for item in ["startCursor", "endCursor", "hasNextPage", "hasPreviousPage"]
|
| 372 |
+
):
|
| 373 |
+
raise RuntimeError(f"Query must provide pagination with pageInfo\n{self.__graphql_query}")
|
| 374 |
+
|
| 375 |
+
if self.__totalCount is None:
|
| 376 |
+
if "totalCount" not in data:
|
| 377 |
+
raise RuntimeError(f"Query must provide totalCount\n{self.__graphql_query}")
|
| 378 |
+
self.__totalCount = data["totalCount"]
|
| 379 |
+
|
| 380 |
+
if "nodes" not in data:
|
| 381 |
+
raise RuntimeError(
|
| 382 |
+
f"No nodes found under pagination path {self.__list_item}: {self.paths_of_dict(data)}"
|
| 383 |
+
)
|
| 384 |
+
|
| 385 |
+
nodes = data["nodes"]
|
| 386 |
+
if self._reversed:
|
| 387 |
+
nodes = nodes[::-1]
|
| 388 |
+
return [self.__contentClass(self.__requester, {}, element) for element in nodes if element is not None]
|
| 389 |
+
|
| 390 |
+
def __parseLinkHeader(self, headers: Dict[str, Union[str, int]]) -> Dict[str, str]:
|
| 391 |
+
links = {}
|
| 392 |
+
if "link" in headers and isinstance(headers["link"], str):
|
| 393 |
+
linkHeaders = headers["link"].split(", ")
|
| 394 |
+
for linkHeader in linkHeaders:
|
| 395 |
+
url, rel, *rest = linkHeader.split("; ")
|
| 396 |
+
url = url[1:-1]
|
| 397 |
+
rel = rel[5:-1]
|
| 398 |
+
links[rel] = url
|
| 399 |
+
return links
|
| 400 |
+
|
| 401 |
+
def get_page(self, page: int) -> List[T]:
|
| 402 |
+
if self.is_graphql:
|
| 403 |
+
raise RuntimeError("Not supported for GraphQL pagination")
|
| 404 |
+
|
| 405 |
+
params = dict(self.__firstParams)
|
| 406 |
+
if page != 0:
|
| 407 |
+
params["page"] = page + 1
|
| 408 |
+
if self.__requester.per_page != 30:
|
| 409 |
+
params["per_page"] = self.__requester.per_page
|
| 410 |
+
headers, data = self.__requester.requestJsonAndCheck(
|
| 411 |
+
"GET", self.__firstUrl, parameters=params, headers=self.__headers # type: ignore
|
| 412 |
+
)
|
| 413 |
+
|
| 414 |
+
if self.__list_item in data:
|
| 415 |
+
self.__totalCount = data.get("total_count")
|
| 416 |
+
data = data[self.__list_item]
|
| 417 |
+
return [self.__contentClass(self.__requester, headers, self._transformAttributes(element)) for element in data]
|
| 418 |
+
|
| 419 |
+
@classmethod
|
| 420 |
+
def override_attributes(cls, overrides: Dict[str, Any]) -> Callable[[Dict[str, Any]], Dict[str, Any]]:
|
| 421 |
+
def attributes_transformer(element: Dict[str, Any]) -> Dict[str, Any]:
|
| 422 |
+
# Recursively merge overrides with attributes, overriding attributes with overrides
|
| 423 |
+
element = cls.merge_dicts(element, overrides)
|
| 424 |
+
return element
|
| 425 |
+
|
| 426 |
+
return attributes_transformer
|
| 427 |
+
|
| 428 |
+
@classmethod
|
| 429 |
+
def merge_dicts(cls, d1: Dict[str, Any], d2: Dict[str, Any]) -> Dict[str, Any]:
|
| 430 |
+
# clone d1
|
| 431 |
+
d1 = d1.copy()
|
| 432 |
+
for k, v in d2.items():
|
| 433 |
+
if isinstance(v, dict):
|
| 434 |
+
d1[k] = cls.merge_dicts(d1.get(k, {}), v)
|
| 435 |
+
else:
|
| 436 |
+
d1[k] = v
|
| 437 |
+
return d1
|
| 438 |
+
|
| 439 |
+
@classmethod
|
| 440 |
+
def paths_of_dict(cls, d: dict) -> dict:
|
| 441 |
+
return {key: cls.paths_of_dict(val) if isinstance(val, dict) else None for key, val in d.items()}
|
python_embeded/Lib/site-packages/github/Path.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Justin Kufro <jkufro@andrew.cmu.edu> #
|
| 11 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 19 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 20 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 21 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 22 |
+
# #
|
| 23 |
+
# This file is part of PyGithub. #
|
| 24 |
+
# http://pygithub.readthedocs.io/ #
|
| 25 |
+
# #
|
| 26 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 27 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 28 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 29 |
+
# any later version. #
|
| 30 |
+
# #
|
| 31 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 32 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 33 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 34 |
+
# details. #
|
| 35 |
+
# #
|
| 36 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 37 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 38 |
+
# #
|
| 39 |
+
################################################################################
|
| 40 |
+
|
| 41 |
+
from typing import Any, Dict
|
| 42 |
+
|
| 43 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class Path(NonCompletableGithubObject):
|
| 47 |
+
"""
|
| 48 |
+
This class represents a popular Path for a GitHub repository.
|
| 49 |
+
|
| 50 |
+
The reference can be found here
|
| 51 |
+
https://docs.github.com/en/rest/reference/repos#traffic
|
| 52 |
+
|
| 53 |
+
The OpenAPI schema can be found at
|
| 54 |
+
- /components/schemas/content-traffic
|
| 55 |
+
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
def _initAttributes(self) -> None:
|
| 59 |
+
self._count: Attribute[int] = NotSet
|
| 60 |
+
self._path: Attribute[str] = NotSet
|
| 61 |
+
self._title: Attribute[str] = NotSet
|
| 62 |
+
self._uniques: Attribute[int] = NotSet
|
| 63 |
+
|
| 64 |
+
def __repr__(self) -> str:
|
| 65 |
+
return self.get__repr__(
|
| 66 |
+
{
|
| 67 |
+
"path": self._path.value,
|
| 68 |
+
"title": self._title.value,
|
| 69 |
+
"count": self._count.value,
|
| 70 |
+
"uniques": self._uniques.value,
|
| 71 |
+
}
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
@property
|
| 75 |
+
def count(self) -> int:
|
| 76 |
+
return self._count.value
|
| 77 |
+
|
| 78 |
+
@property
|
| 79 |
+
def path(self) -> str:
|
| 80 |
+
return self._path.value
|
| 81 |
+
|
| 82 |
+
@property
|
| 83 |
+
def title(self) -> str:
|
| 84 |
+
return self._title.value
|
| 85 |
+
|
| 86 |
+
@property
|
| 87 |
+
def uniques(self) -> int:
|
| 88 |
+
return self._uniques.value
|
| 89 |
+
|
| 90 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 91 |
+
if "count" in attributes: # pragma no branch
|
| 92 |
+
self._count = self._makeIntAttribute(attributes["count"])
|
| 93 |
+
if "path" in attributes: # pragma no branch
|
| 94 |
+
self._path = self._makeStringAttribute(attributes["path"])
|
| 95 |
+
if "title" in attributes: # pragma no branch
|
| 96 |
+
self._title = self._makeStringAttribute(attributes["title"])
|
| 97 |
+
if "uniques" in attributes: # pragma no branch
|
| 98 |
+
self._uniques = self._makeIntAttribute(attributes["uniques"])
|
python_embeded/Lib/site-packages/github/Permissions.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2021 karsten-wagner <39054096+karsten-wagner@users.noreply.github.com>#
|
| 16 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 17 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 18 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# #
|
| 22 |
+
# This file is part of PyGithub. #
|
| 23 |
+
# http://pygithub.readthedocs.io/ #
|
| 24 |
+
# #
|
| 25 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 26 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 27 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 28 |
+
# any later version. #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 31 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 32 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 33 |
+
# details. #
|
| 34 |
+
# #
|
| 35 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 36 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 37 |
+
# #
|
| 38 |
+
################################################################################
|
| 39 |
+
|
| 40 |
+
from typing import Any, Dict
|
| 41 |
+
|
| 42 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Permissions(NonCompletableGithubObject):
|
| 46 |
+
"""
|
| 47 |
+
This class represents Permissions.
|
| 48 |
+
|
| 49 |
+
The OpenAPI schema can be found at
|
| 50 |
+
- /components/schemas/collaborator/properties/permissions
|
| 51 |
+
- /components/schemas/full-repository/properties/permissions
|
| 52 |
+
- /components/schemas/minimal-repository/properties/permissions
|
| 53 |
+
- /components/schemas/repo-search-result-item/properties/permissions
|
| 54 |
+
- /components/schemas/repository/properties/permissions
|
| 55 |
+
- /components/schemas/team/properties/permissions
|
| 56 |
+
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
def _initAttributes(self) -> None:
|
| 60 |
+
self._admin: Attribute[bool] = NotSet
|
| 61 |
+
self._maintain: Attribute[bool] = NotSet
|
| 62 |
+
self._pull: Attribute[bool] = NotSet
|
| 63 |
+
self._push: Attribute[bool] = NotSet
|
| 64 |
+
self._triage: Attribute[bool] = NotSet
|
| 65 |
+
|
| 66 |
+
def __repr__(self) -> str:
|
| 67 |
+
return self.get__repr__(
|
| 68 |
+
{
|
| 69 |
+
"admin": self._admin.value,
|
| 70 |
+
"maintain": self._maintain.value,
|
| 71 |
+
"pull": self._pull.value,
|
| 72 |
+
"push": self._push.value,
|
| 73 |
+
"triage": self._triage.value,
|
| 74 |
+
}
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
@property
|
| 78 |
+
def admin(self) -> bool:
|
| 79 |
+
return self._admin.value
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def maintain(self) -> bool:
|
| 83 |
+
return self._maintain.value
|
| 84 |
+
|
| 85 |
+
@property
|
| 86 |
+
def pull(self) -> bool:
|
| 87 |
+
return self._pull.value
|
| 88 |
+
|
| 89 |
+
@property
|
| 90 |
+
def push(self) -> bool:
|
| 91 |
+
return self._push.value
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def triage(self) -> bool:
|
| 95 |
+
return self._triage.value
|
| 96 |
+
|
| 97 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 98 |
+
if "admin" in attributes: # pragma no branch
|
| 99 |
+
self._admin = self._makeBoolAttribute(attributes["admin"])
|
| 100 |
+
if "maintain" in attributes: # pragma no branch
|
| 101 |
+
self._maintain = self._makeBoolAttribute(attributes["maintain"])
|
| 102 |
+
if "pull" in attributes: # pragma no branch
|
| 103 |
+
self._pull = self._makeBoolAttribute(attributes["pull"])
|
| 104 |
+
if "push" in attributes: # pragma no branch
|
| 105 |
+
self._push = self._makeBoolAttribute(attributes["push"])
|
| 106 |
+
if "triage" in attributes: # pragma no branch
|
| 107 |
+
self._triage = self._makeBoolAttribute(attributes["triage"])
|
python_embeded/Lib/site-packages/github/Plan.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Geoff Low <glow@mdsol.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 17 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 18 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# #
|
| 22 |
+
# This file is part of PyGithub. #
|
| 23 |
+
# http://pygithub.readthedocs.io/ #
|
| 24 |
+
# #
|
| 25 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 26 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 27 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 28 |
+
# any later version. #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 31 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 32 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 33 |
+
# details. #
|
| 34 |
+
# #
|
| 35 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 36 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 37 |
+
# #
|
| 38 |
+
################################################################################
|
| 39 |
+
|
| 40 |
+
from typing import Any, Dict
|
| 41 |
+
|
| 42 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Plan(NonCompletableGithubObject):
|
| 46 |
+
"""
|
| 47 |
+
This class represents Plans.
|
| 48 |
+
|
| 49 |
+
The OpenAPI schema can be found at
|
| 50 |
+
- /components/schemas/organization-full/properties/plan
|
| 51 |
+
- /components/schemas/public-user/properties/plan
|
| 52 |
+
- /components/schemas/team-organization/properties/plan
|
| 53 |
+
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
def _initAttributes(self) -> None:
|
| 57 |
+
self._collaborators: Attribute[int] = NotSet
|
| 58 |
+
self._filled_seats: Attribute[int] = NotSet
|
| 59 |
+
self._name: Attribute[str] = NotSet
|
| 60 |
+
self._private_repos: Attribute[int] = NotSet
|
| 61 |
+
self._seats: Attribute[int] = NotSet
|
| 62 |
+
self._space: Attribute[int] = NotSet
|
| 63 |
+
|
| 64 |
+
def __repr__(self) -> str:
|
| 65 |
+
return self.get__repr__({"name": self._name.value})
|
| 66 |
+
|
| 67 |
+
@property
|
| 68 |
+
def collaborators(self) -> int:
|
| 69 |
+
return self._collaborators.value
|
| 70 |
+
|
| 71 |
+
@property
|
| 72 |
+
def filled_seats(self) -> int:
|
| 73 |
+
return self._filled_seats.value
|
| 74 |
+
|
| 75 |
+
@property
|
| 76 |
+
def name(self) -> str:
|
| 77 |
+
return self._name.value
|
| 78 |
+
|
| 79 |
+
@property
|
| 80 |
+
def private_repos(self) -> int:
|
| 81 |
+
return self._private_repos.value
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def seats(self) -> int:
|
| 85 |
+
return self._seats.value
|
| 86 |
+
|
| 87 |
+
@property
|
| 88 |
+
def space(self) -> int:
|
| 89 |
+
return self._space.value
|
| 90 |
+
|
| 91 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 92 |
+
if "collaborators" in attributes: # pragma no branch
|
| 93 |
+
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
|
| 94 |
+
if "filled_seats" in attributes: # pragma no branch
|
| 95 |
+
self._filled_seats = self._makeIntAttribute(attributes["filled_seats"])
|
| 96 |
+
if "name" in attributes: # pragma no branch
|
| 97 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 98 |
+
if "private_repos" in attributes: # pragma no branch
|
| 99 |
+
self._private_repos = self._makeIntAttribute(attributes["private_repos"])
|
| 100 |
+
if "seats" in attributes: # pragma no branch
|
| 101 |
+
self._seats = self._makeIntAttribute(attributes["seats"])
|
| 102 |
+
if "space" in attributes: # pragma no branch
|
| 103 |
+
self._space = self._makeIntAttribute(attributes["space"])
|
python_embeded/Lib/site-packages/github/Project.py
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Chris McBride <thehighlander@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 12 |
+
# Copyright 2018 Benoit Latinier <benoit@latinier.fr> #
|
| 13 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2018 Yossarian King <yggy@blackbirdinteractive.com> #
|
| 15 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 16 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 18 |
+
# Copyright 2020 Anuj Bansal <bansalanuj1996@gmail.com> #
|
| 19 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 20 |
+
# Copyright 2021 Lars Kellogg-Stedman <lars@oddbit.com> #
|
| 21 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 22 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 23 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 25 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 26 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 27 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 28 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 29 |
+
# #
|
| 30 |
+
# This file is part of PyGithub. #
|
| 31 |
+
# http://pygithub.readthedocs.io/ #
|
| 32 |
+
# #
|
| 33 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 34 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 35 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 36 |
+
# any later version. #
|
| 37 |
+
# #
|
| 38 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 39 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 40 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 41 |
+
# details. #
|
| 42 |
+
# #
|
| 43 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 44 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 45 |
+
# #
|
| 46 |
+
################################################################################
|
| 47 |
+
|
| 48 |
+
from __future__ import annotations
|
| 49 |
+
|
| 50 |
+
from datetime import datetime
|
| 51 |
+
from typing import Any
|
| 52 |
+
|
| 53 |
+
import github.GithubObject
|
| 54 |
+
import github.NamedUser
|
| 55 |
+
import github.ProjectColumn
|
| 56 |
+
from github import Consts
|
| 57 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt
|
| 58 |
+
from github.PaginatedList import PaginatedList
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class Project(CompletableGithubObject):
|
| 62 |
+
"""
|
| 63 |
+
This class represents Projects.
|
| 64 |
+
|
| 65 |
+
The reference can be found here
|
| 66 |
+
https://docs.github.com/en/rest/reference/projects
|
| 67 |
+
|
| 68 |
+
The OpenAPI schema can be found at
|
| 69 |
+
- /components/schemas/project
|
| 70 |
+
|
| 71 |
+
"""
|
| 72 |
+
|
| 73 |
+
def _initAttributes(self) -> None:
|
| 74 |
+
self._body: Attribute[str] = NotSet
|
| 75 |
+
self._columns_url: Attribute[str] = NotSet
|
| 76 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 77 |
+
self._creator: Attribute[github.NamedUser.NamedUser] = NotSet
|
| 78 |
+
self._html_url: Attribute[str] = NotSet
|
| 79 |
+
self._id: Attribute[int] = NotSet
|
| 80 |
+
self._name: Attribute[str] = NotSet
|
| 81 |
+
self._node_id: Attribute[str] = NotSet
|
| 82 |
+
self._number: Attribute[int] = NotSet
|
| 83 |
+
self._organization_permission: Attribute[str] = NotSet
|
| 84 |
+
self._owner_url: Attribute[str] = NotSet
|
| 85 |
+
self._private: Attribute[bool] = NotSet
|
| 86 |
+
self._state: Attribute[str] = NotSet
|
| 87 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 88 |
+
self._url: Attribute[str] = NotSet
|
| 89 |
+
|
| 90 |
+
def __repr__(self) -> str:
|
| 91 |
+
return self.get__repr__({"name": self._name.value})
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def body(self) -> str:
|
| 95 |
+
self._completeIfNotSet(self._body)
|
| 96 |
+
return self._body.value
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def columns_url(self) -> str:
|
| 100 |
+
self._completeIfNotSet(self._columns_url)
|
| 101 |
+
return self._columns_url.value
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def created_at(self) -> datetime:
|
| 105 |
+
self._completeIfNotSet(self._created_at)
|
| 106 |
+
return self._created_at.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def creator(self) -> github.NamedUser.NamedUser:
|
| 110 |
+
self._completeIfNotSet(self._creator)
|
| 111 |
+
return self._creator.value
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def html_url(self) -> str:
|
| 115 |
+
self._completeIfNotSet(self._html_url)
|
| 116 |
+
return self._html_url.value
|
| 117 |
+
|
| 118 |
+
@property
|
| 119 |
+
def id(self) -> int:
|
| 120 |
+
self._completeIfNotSet(self._id)
|
| 121 |
+
return self._id.value
|
| 122 |
+
|
| 123 |
+
@property
|
| 124 |
+
def name(self) -> str:
|
| 125 |
+
self._completeIfNotSet(self._name)
|
| 126 |
+
return self._name.value
|
| 127 |
+
|
| 128 |
+
@property
|
| 129 |
+
def node_id(self) -> str:
|
| 130 |
+
self._completeIfNotSet(self._node_id)
|
| 131 |
+
return self._node_id.value
|
| 132 |
+
|
| 133 |
+
@property
|
| 134 |
+
def number(self) -> int:
|
| 135 |
+
self._completeIfNotSet(self._number)
|
| 136 |
+
return self._number.value
|
| 137 |
+
|
| 138 |
+
@property
|
| 139 |
+
def organization_permission(self) -> str:
|
| 140 |
+
self._completeIfNotSet(self._organization_permission)
|
| 141 |
+
return self._organization_permission.value
|
| 142 |
+
|
| 143 |
+
@property
|
| 144 |
+
def owner_url(self) -> str:
|
| 145 |
+
self._completeIfNotSet(self._owner_url)
|
| 146 |
+
return self._owner_url.value
|
| 147 |
+
|
| 148 |
+
@property
|
| 149 |
+
def private(self) -> bool:
|
| 150 |
+
self._completeIfNotSet(self._private)
|
| 151 |
+
return self._private.value
|
| 152 |
+
|
| 153 |
+
@property
|
| 154 |
+
def state(self) -> str:
|
| 155 |
+
self._completeIfNotSet(self._state)
|
| 156 |
+
return self._state.value
|
| 157 |
+
|
| 158 |
+
@property
|
| 159 |
+
def updated_at(self) -> datetime:
|
| 160 |
+
self._completeIfNotSet(self._updated_at)
|
| 161 |
+
return self._updated_at.value
|
| 162 |
+
|
| 163 |
+
@property
|
| 164 |
+
def url(self) -> str:
|
| 165 |
+
self._completeIfNotSet(self._url)
|
| 166 |
+
return self._url.value
|
| 167 |
+
|
| 168 |
+
def delete(self) -> None:
|
| 169 |
+
"""
|
| 170 |
+
:calls: `DELETE /projects/{project_id} <https://docs.github.com/en/rest/reference/projects#delete-a-project>`_
|
| 171 |
+
"""
|
| 172 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 173 |
+
"DELETE", self.url, headers={"Accept": Consts.mediaTypeProjectsPreview}
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
def edit(
|
| 177 |
+
self,
|
| 178 |
+
name: Opt[str] = NotSet,
|
| 179 |
+
body: Opt[str] = NotSet,
|
| 180 |
+
state: Opt[str] = NotSet,
|
| 181 |
+
organization_permission: Opt[str] = NotSet,
|
| 182 |
+
private: Opt[bool] = NotSet,
|
| 183 |
+
) -> None:
|
| 184 |
+
"""
|
| 185 |
+
:calls: `PATCH /projects/{project_id} <https://docs.github.com/en/rest/reference/projects#update-a-project>`_
|
| 186 |
+
"""
|
| 187 |
+
assert name is NotSet or isinstance(name, str), name
|
| 188 |
+
assert body is NotSet or isinstance(body, str), body
|
| 189 |
+
assert state is NotSet or isinstance(state, str), state
|
| 190 |
+
assert organization_permission is NotSet or isinstance(organization_permission, str), organization_permission
|
| 191 |
+
assert private is NotSet or isinstance(private, bool), private
|
| 192 |
+
patch_parameters = NotSet.remove_unset_items(
|
| 193 |
+
{
|
| 194 |
+
"name": name,
|
| 195 |
+
"body": body,
|
| 196 |
+
"state": state,
|
| 197 |
+
"organization_permission": organization_permission,
|
| 198 |
+
"private": private,
|
| 199 |
+
}
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 203 |
+
"PATCH",
|
| 204 |
+
self.url,
|
| 205 |
+
input=patch_parameters,
|
| 206 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 207 |
+
)
|
| 208 |
+
self._useAttributes(data)
|
| 209 |
+
|
| 210 |
+
def get_columns(self) -> PaginatedList[github.ProjectColumn.ProjectColumn]:
|
| 211 |
+
"""
|
| 212 |
+
:calls: `GET /projects/{project_id}/columns <https://docs.github.com/en/rest/reference/projects#list-project-columns>`_
|
| 213 |
+
"""
|
| 214 |
+
|
| 215 |
+
return PaginatedList(
|
| 216 |
+
github.ProjectColumn.ProjectColumn,
|
| 217 |
+
self._requester,
|
| 218 |
+
self.columns_url,
|
| 219 |
+
None,
|
| 220 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 221 |
+
)
|
| 222 |
+
|
| 223 |
+
def create_column(self, name: str) -> github.ProjectColumn.ProjectColumn:
|
| 224 |
+
"""
|
| 225 |
+
calls: `POST /projects/{project_id}/columns <https://docs.github.com/en/rest/reference/projects#create-a-project-column>`_
|
| 226 |
+
"""
|
| 227 |
+
assert isinstance(name, str), name
|
| 228 |
+
post_parameters = {"name": name}
|
| 229 |
+
import_header = {"Accept": Consts.mediaTypeProjectsPreview}
|
| 230 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 231 |
+
"POST", f"{self.url}/columns", headers=import_header, input=post_parameters
|
| 232 |
+
)
|
| 233 |
+
return github.ProjectColumn.ProjectColumn(self._requester, headers, data, completed=True)
|
| 234 |
+
|
| 235 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 236 |
+
if "body" in attributes: # pragma no branch
|
| 237 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 238 |
+
if "columns_url" in attributes: # pragma no branch
|
| 239 |
+
self._columns_url = self._makeStringAttribute(attributes["columns_url"])
|
| 240 |
+
if "created_at" in attributes: # pragma no branch
|
| 241 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 242 |
+
if "creator" in attributes: # pragma no branch
|
| 243 |
+
self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
|
| 244 |
+
if "html_url" in attributes: # pragma no branch
|
| 245 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 246 |
+
if "id" in attributes: # pragma no branch
|
| 247 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 248 |
+
if "name" in attributes: # pragma no branch
|
| 249 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 250 |
+
if "node_id" in attributes: # pragma no branch
|
| 251 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 252 |
+
if "number" in attributes: # pragma no branch
|
| 253 |
+
self._number = self._makeIntAttribute(attributes["number"])
|
| 254 |
+
if "organization_permission" in attributes: # pragma no branch
|
| 255 |
+
self._organization_permission = self._makeStringAttribute(attributes["organization_permission"])
|
| 256 |
+
if "owner_url" in attributes: # pragma no branch
|
| 257 |
+
self._owner_url = self._makeStringAttribute(attributes["owner_url"])
|
| 258 |
+
if "private" in attributes: # pragma no branch
|
| 259 |
+
self._private = self._makeBoolAttribute(attributes["private"])
|
| 260 |
+
if "state" in attributes: # pragma no branch
|
| 261 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 262 |
+
if "updated_at" in attributes: # pragma no branch
|
| 263 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 264 |
+
if "url" in attributes: # pragma no branch
|
| 265 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2015 Matt Babineau <mbabineau@dataxu.com> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Martijn Koster <mak-github@greenhills.co.uk> #
|
| 11 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 Yossarian King <yggy@blackbirdinteractive.com> #
|
| 14 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 17 |
+
# Copyright 2020 Jody McIntyre <scjody@modernduck.com> #
|
| 18 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 19 |
+
# Copyright 2020 chloe jungah kim <43295963+chloeeekim@users.noreply.github.com>#
|
| 20 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 21 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 22 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 24 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 25 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 27 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 28 |
+
# #
|
| 29 |
+
# This file is part of PyGithub. #
|
| 30 |
+
# http://pygithub.readthedocs.io/ #
|
| 31 |
+
# #
|
| 32 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 33 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 34 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 35 |
+
# any later version. #
|
| 36 |
+
# #
|
| 37 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 38 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 39 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 40 |
+
# details. #
|
| 41 |
+
# #
|
| 42 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 43 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 44 |
+
# #
|
| 45 |
+
################################################################################
|
| 46 |
+
|
| 47 |
+
from __future__ import annotations
|
| 48 |
+
|
| 49 |
+
from datetime import datetime
|
| 50 |
+
from typing import Any
|
| 51 |
+
|
| 52 |
+
import github.Issue
|
| 53 |
+
import github.NamedUser
|
| 54 |
+
import github.ProjectColumn
|
| 55 |
+
import github.PullRequest
|
| 56 |
+
from github import Consts
|
| 57 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt
|
| 58 |
+
|
| 59 |
+
# NOTE: There is currently no way to get cards "in triage" for a project.
|
| 60 |
+
# https://platform.github.community/t/moving-github-project-cards-that-are-in-triage/3784
|
| 61 |
+
#
|
| 62 |
+
# See also https://developer.github.com/v4/object/projectcard for the next generation GitHub API,
|
| 63 |
+
# which may point the way to where the API is likely headed and what might come back to v3. E.g. ProjectCard.content member.
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class ProjectCard(CompletableGithubObject):
|
| 67 |
+
"""
|
| 68 |
+
This class represents Project Cards.
|
| 69 |
+
|
| 70 |
+
The reference can be found here
|
| 71 |
+
https://docs.github.com/en/rest/reference/projects#cards
|
| 72 |
+
|
| 73 |
+
The OpenAPI schema can be found at
|
| 74 |
+
- /components/schemas/project-card
|
| 75 |
+
- /components/schemas/validation-error
|
| 76 |
+
- /components/schemas/validation-error-simple
|
| 77 |
+
- /paths/"/projects/columns/{column_id}/cards"/post/responses/503/content/"application/json"/schema
|
| 78 |
+
|
| 79 |
+
"""
|
| 80 |
+
|
| 81 |
+
def _initAttributes(self) -> None:
|
| 82 |
+
self._archived: Attribute[bool] = NotSet
|
| 83 |
+
self._column_url: Attribute[str] = NotSet
|
| 84 |
+
self._content_url: Attribute[str] = NotSet
|
| 85 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 86 |
+
self._creator: Attribute[github.NamedUser.NamedUser] = NotSet
|
| 87 |
+
self._id: Attribute[int] = NotSet
|
| 88 |
+
self._node_id: Attribute[str] = NotSet
|
| 89 |
+
self._note: Attribute[str] = NotSet
|
| 90 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 91 |
+
self._url: Attribute[str] = NotSet
|
| 92 |
+
|
| 93 |
+
def __repr__(self) -> str:
|
| 94 |
+
return self.get__repr__({"id": self._id.value})
|
| 95 |
+
|
| 96 |
+
@property
|
| 97 |
+
def archived(self) -> bool:
|
| 98 |
+
return self._archived.value
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def column_url(self) -> str:
|
| 102 |
+
return self._column_url.value
|
| 103 |
+
|
| 104 |
+
@property
|
| 105 |
+
def content_url(self) -> str:
|
| 106 |
+
return self._content_url.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def created_at(self) -> datetime:
|
| 110 |
+
return self._created_at.value
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def creator(self) -> github.NamedUser.NamedUser:
|
| 114 |
+
return self._creator.value
|
| 115 |
+
|
| 116 |
+
@property
|
| 117 |
+
def id(self) -> int:
|
| 118 |
+
return self._id.value
|
| 119 |
+
|
| 120 |
+
@property
|
| 121 |
+
def node_id(self) -> str:
|
| 122 |
+
return self._node_id.value
|
| 123 |
+
|
| 124 |
+
@property
|
| 125 |
+
def note(self) -> str:
|
| 126 |
+
return self._note.value
|
| 127 |
+
|
| 128 |
+
@property
|
| 129 |
+
def updated_at(self) -> datetime:
|
| 130 |
+
return self._updated_at.value
|
| 131 |
+
|
| 132 |
+
@property
|
| 133 |
+
def url(self) -> str:
|
| 134 |
+
return self._url.value
|
| 135 |
+
|
| 136 |
+
# Note that the content_url for any card will be an "issue" URL, from
|
| 137 |
+
# which you can retrieve either an Issue or a PullRequest. Unfortunately
|
| 138 |
+
# the API doesn't make it clear which you are dealing with.
|
| 139 |
+
def get_content(
|
| 140 |
+
self, content_type: Opt[str] = NotSet
|
| 141 |
+
) -> github.PullRequest.PullRequest | github.Issue.Issue | None:
|
| 142 |
+
"""
|
| 143 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number} <https://docs.github.com/en/rest/reference/pulls#get-a-pull-request>`_
|
| 144 |
+
"""
|
| 145 |
+
assert content_type is NotSet or isinstance(content_type, str), content_type
|
| 146 |
+
if self.content_url is None:
|
| 147 |
+
return None
|
| 148 |
+
|
| 149 |
+
retclass: type[github.PullRequest.PullRequest] | type[github.Issue.Issue]
|
| 150 |
+
if content_type == "PullRequest":
|
| 151 |
+
url = self.content_url.replace("issues", "pulls")
|
| 152 |
+
retclass = github.PullRequest.PullRequest
|
| 153 |
+
elif content_type is NotSet or content_type == "Issue":
|
| 154 |
+
url = self.content_url
|
| 155 |
+
retclass = github.Issue.Issue
|
| 156 |
+
else:
|
| 157 |
+
raise ValueError(f"Unknown content type: {content_type}")
|
| 158 |
+
headers, data = self._requester.requestJsonAndCheck("GET", url)
|
| 159 |
+
return retclass(self._requester, headers, data, completed=True)
|
| 160 |
+
|
| 161 |
+
def move(self, position: str, column: github.ProjectColumn.ProjectColumn | int) -> bool:
|
| 162 |
+
"""
|
| 163 |
+
:calls: `POST /projects/columns/cards/{card_id}/moves <https://docs.github.com/en/rest/reference/projects#cards>`_
|
| 164 |
+
"""
|
| 165 |
+
assert isinstance(position, str), position
|
| 166 |
+
assert isinstance(column, github.ProjectColumn.ProjectColumn) or isinstance(column, int), column
|
| 167 |
+
post_parameters = {
|
| 168 |
+
"position": position,
|
| 169 |
+
"column_id": column.id if isinstance(column, github.ProjectColumn.ProjectColumn) else column,
|
| 170 |
+
}
|
| 171 |
+
status, _, _ = self._requester.requestJson(
|
| 172 |
+
"POST",
|
| 173 |
+
f"{self.url}/moves",
|
| 174 |
+
input=post_parameters,
|
| 175 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 176 |
+
)
|
| 177 |
+
return status == 201
|
| 178 |
+
|
| 179 |
+
def delete(self) -> bool:
|
| 180 |
+
"""
|
| 181 |
+
:calls: `DELETE /projects/columns/cards/{card_id} <https://docs.github.com/en/rest/reference/projects#cards>`_
|
| 182 |
+
"""
|
| 183 |
+
status, _, _ = self._requester.requestJson(
|
| 184 |
+
"DELETE",
|
| 185 |
+
self.url,
|
| 186 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 187 |
+
)
|
| 188 |
+
return status == 204
|
| 189 |
+
|
| 190 |
+
def edit(self, note: Opt[str] = NotSet, archived: Opt[bool] = NotSet) -> None:
|
| 191 |
+
"""
|
| 192 |
+
:calls: `PATCH /projects/columns/cards/{card_id} <https://docs.github.com/en/rest/reference/projects#cards>`_
|
| 193 |
+
"""
|
| 194 |
+
assert note is NotSet or isinstance(note, str), note
|
| 195 |
+
assert archived is NotSet or isinstance(archived, bool), archived
|
| 196 |
+
patch_parameters: dict[str, Any] = NotSet.remove_unset_items({"note": note, "archived": archived})
|
| 197 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 198 |
+
"PATCH",
|
| 199 |
+
self.url,
|
| 200 |
+
input=patch_parameters,
|
| 201 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 202 |
+
)
|
| 203 |
+
self._useAttributes(data)
|
| 204 |
+
|
| 205 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 206 |
+
if "archived" in attributes: # pragma no branch
|
| 207 |
+
self._archived = self._makeBoolAttribute(attributes["archived"])
|
| 208 |
+
if "column_url" in attributes: # pragma no branch
|
| 209 |
+
self._column_url = self._makeStringAttribute(attributes["column_url"])
|
| 210 |
+
if "content_url" in attributes: # pragma no branch
|
| 211 |
+
self._content_url = self._makeStringAttribute(attributes["content_url"])
|
| 212 |
+
if "created_at" in attributes: # pragma no branch
|
| 213 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 214 |
+
if "creator" in attributes: # pragma no branch
|
| 215 |
+
self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
|
| 216 |
+
if "id" in attributes: # pragma no branch
|
| 217 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 218 |
+
if "node_id" in attributes: # pragma no branch
|
| 219 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 220 |
+
if "note" in attributes: # pragma no branch
|
| 221 |
+
self._note = self._makeStringAttribute(attributes["note"])
|
| 222 |
+
if "updated_at" in attributes: # pragma no branch
|
| 223 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 224 |
+
if "url" in attributes: # pragma no branch
|
| 225 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/ProjectColumn.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2015 Matt Babineau <mbabineau@dataxu.com> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Martijn Koster <mak-github@greenhills.co.uk> #
|
| 11 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 12 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2018 Yossarian King <yggy@blackbirdinteractive.com> #
|
| 14 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2019 Benoit Latinier <benoit@latinier.fr> #
|
| 16 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 17 |
+
# Copyright 2019 Vincent <github@fleeto.us> #
|
| 18 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 19 |
+
# Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
|
| 20 |
+
# Copyright 2020 Florent Clarret <florent.clarret@gmail.com> #
|
| 21 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 22 |
+
# Copyright 2021 Dhruv Bhanushali <dhruv_b@live.com> #
|
| 23 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 24 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 25 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 26 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 27 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 28 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 29 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 30 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 31 |
+
# #
|
| 32 |
+
# This file is part of PyGithub. #
|
| 33 |
+
# http://pygithub.readthedocs.io/ #
|
| 34 |
+
# #
|
| 35 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 36 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 37 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 38 |
+
# any later version. #
|
| 39 |
+
# #
|
| 40 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 41 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 42 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 43 |
+
# details. #
|
| 44 |
+
# #
|
| 45 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 46 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 47 |
+
# #
|
| 48 |
+
################################################################################
|
| 49 |
+
|
| 50 |
+
from __future__ import annotations
|
| 51 |
+
|
| 52 |
+
from datetime import datetime
|
| 53 |
+
from typing import Any
|
| 54 |
+
|
| 55 |
+
import github.GithubObject
|
| 56 |
+
import github.Project
|
| 57 |
+
import github.ProjectCard
|
| 58 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt
|
| 59 |
+
from github.PaginatedList import PaginatedList
|
| 60 |
+
|
| 61 |
+
from . import Consts
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class ProjectColumn(CompletableGithubObject):
|
| 65 |
+
"""
|
| 66 |
+
This class represents Project Columns.
|
| 67 |
+
|
| 68 |
+
The reference can be found here
|
| 69 |
+
https://docs.github.com/en/rest/reference/projects#columns
|
| 70 |
+
|
| 71 |
+
The OpenAPI schema can be found at
|
| 72 |
+
- /components/schemas/project-column
|
| 73 |
+
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
def _initAttributes(self) -> None:
|
| 77 |
+
self._cards_url: Attribute[str] = NotSet
|
| 78 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 79 |
+
self._id: Attribute[int] = NotSet
|
| 80 |
+
self._name: Attribute[str] = NotSet
|
| 81 |
+
self._node_id: Attribute[str] = NotSet
|
| 82 |
+
self._project_url: Attribute[str] = NotSet
|
| 83 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 84 |
+
self._url: Attribute[str] = NotSet
|
| 85 |
+
|
| 86 |
+
def __repr__(self) -> str:
|
| 87 |
+
return self.get__repr__({"name": self._name.value})
|
| 88 |
+
|
| 89 |
+
@property
|
| 90 |
+
def cards_url(self) -> str:
|
| 91 |
+
return self._cards_url.value
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def created_at(self) -> datetime:
|
| 95 |
+
return self._created_at.value
|
| 96 |
+
|
| 97 |
+
@property
|
| 98 |
+
def id(self) -> int:
|
| 99 |
+
return self._id.value
|
| 100 |
+
|
| 101 |
+
@property
|
| 102 |
+
def name(self) -> str:
|
| 103 |
+
return self._name.value
|
| 104 |
+
|
| 105 |
+
@property
|
| 106 |
+
def node_id(self) -> str:
|
| 107 |
+
return self._node_id.value
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def project_url(self) -> str:
|
| 111 |
+
return self._project_url.value
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def updated_at(self) -> datetime:
|
| 115 |
+
return self._updated_at.value
|
| 116 |
+
|
| 117 |
+
@property
|
| 118 |
+
def url(self) -> str:
|
| 119 |
+
return self._url.value
|
| 120 |
+
|
| 121 |
+
def get_cards(self, archived_state: Opt[str] = NotSet) -> PaginatedList[github.ProjectCard.ProjectCard]:
|
| 122 |
+
"""
|
| 123 |
+
:calls: `GET /projects/columns/{column_id}/cards <https://docs.github.com/en/rest/reference/projects#list-project-cards>`_
|
| 124 |
+
"""
|
| 125 |
+
assert archived_state is NotSet or isinstance(archived_state, str), archived_state
|
| 126 |
+
|
| 127 |
+
url_parameters = dict()
|
| 128 |
+
if archived_state is not NotSet:
|
| 129 |
+
url_parameters["archived_state"] = archived_state
|
| 130 |
+
|
| 131 |
+
return PaginatedList(
|
| 132 |
+
github.ProjectCard.ProjectCard,
|
| 133 |
+
self._requester,
|
| 134 |
+
f"{self.url}/cards",
|
| 135 |
+
url_parameters,
|
| 136 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
def create_card(
|
| 140 |
+
self,
|
| 141 |
+
note: Opt[str] = NotSet,
|
| 142 |
+
content_id: Opt[int] = NotSet,
|
| 143 |
+
content_type: Opt[str] = NotSet,
|
| 144 |
+
) -> github.ProjectCard.ProjectCard:
|
| 145 |
+
"""
|
| 146 |
+
:calls: `POST /projects/columns/{column_id}/cards <https://docs.github.com/en/rest/reference/projects#create-a-project-card>`_
|
| 147 |
+
"""
|
| 148 |
+
if isinstance(note, str):
|
| 149 |
+
assert content_id is NotSet, content_id
|
| 150 |
+
assert content_type is NotSet, content_type
|
| 151 |
+
post_parameters: dict[str, Any] = {"note": note}
|
| 152 |
+
else:
|
| 153 |
+
assert note is NotSet, note
|
| 154 |
+
assert isinstance(content_id, int), content_id
|
| 155 |
+
assert isinstance(content_type, str), content_type
|
| 156 |
+
post_parameters = {"content_id": content_id, "content_type": content_type}
|
| 157 |
+
|
| 158 |
+
import_header = {"Accept": Consts.mediaTypeProjectsPreview}
|
| 159 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 160 |
+
"POST", f"{self.url}/cards", headers=import_header, input=post_parameters
|
| 161 |
+
)
|
| 162 |
+
return github.ProjectCard.ProjectCard(self._requester, headers, data, completed=True)
|
| 163 |
+
|
| 164 |
+
def move(self, position: str) -> bool:
|
| 165 |
+
"""
|
| 166 |
+
:calls: `POST POST /projects/columns/{column_id}/moves <https://docs.github.com/en/rest/reference/projects#move-a-project-column>`_
|
| 167 |
+
"""
|
| 168 |
+
assert isinstance(position, str), position
|
| 169 |
+
post_parameters = {"position": position}
|
| 170 |
+
status, _, _ = self._requester.requestJson(
|
| 171 |
+
"POST",
|
| 172 |
+
f"{self.url}/moves",
|
| 173 |
+
input=post_parameters,
|
| 174 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 175 |
+
)
|
| 176 |
+
return status == 201
|
| 177 |
+
|
| 178 |
+
def delete(self) -> bool:
|
| 179 |
+
"""
|
| 180 |
+
:calls: `DELETE /projects/columns/{column_id} <https://docs.github.com/en/rest/reference/projects#delete-a-project-column>`_
|
| 181 |
+
"""
|
| 182 |
+
status, _, _ = self._requester.requestJson(
|
| 183 |
+
"DELETE",
|
| 184 |
+
self.url,
|
| 185 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 186 |
+
)
|
| 187 |
+
return status == 204
|
| 188 |
+
|
| 189 |
+
def edit(self, name: str) -> None:
|
| 190 |
+
"""
|
| 191 |
+
:calls: `PATCH /projects/columns/{column_id} <https://docs.github.com/en/rest/reference/projects#update-an-existing-project-column>`_
|
| 192 |
+
"""
|
| 193 |
+
assert isinstance(name, str), name
|
| 194 |
+
patch_parameters = {"name": name}
|
| 195 |
+
|
| 196 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 197 |
+
"PATCH",
|
| 198 |
+
self.url,
|
| 199 |
+
input=patch_parameters,
|
| 200 |
+
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
| 201 |
+
)
|
| 202 |
+
|
| 203 |
+
self._useAttributes(data)
|
| 204 |
+
|
| 205 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 206 |
+
if "cards_url" in attributes: # pragma no branch
|
| 207 |
+
self._cards_url = self._makeStringAttribute(attributes["cards_url"])
|
| 208 |
+
if "created_at" in attributes: # pragma no branch
|
| 209 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 210 |
+
if "id" in attributes: # pragma no branch
|
| 211 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 212 |
+
if "name" in attributes: # pragma no branch
|
| 213 |
+
self._name = self._makeStringAttribute(attributes["name"])
|
| 214 |
+
if "node_id" in attributes: # pragma no branch
|
| 215 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 216 |
+
if "project_url" in attributes: # pragma no branch
|
| 217 |
+
self._project_url = self._makeStringAttribute(attributes["project_url"])
|
| 218 |
+
if "updated_at" in attributes: # pragma no branch
|
| 219 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 220 |
+
if "url" in attributes: # pragma no branch
|
| 221 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/PublicKey.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2021 Chris Keating <christopherkeating@gmail.com> #
|
| 16 |
+
# Copyright 2021 MeggyCal <MeggyCal@users.noreply.github.com> #
|
| 17 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 18 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 20 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 23 |
+
# #
|
| 24 |
+
# This file is part of PyGithub. #
|
| 25 |
+
# http://pygithub.readthedocs.io/ #
|
| 26 |
+
# #
|
| 27 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 28 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 29 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 30 |
+
# any later version. #
|
| 31 |
+
# #
|
| 32 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 33 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 34 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 35 |
+
# details. #
|
| 36 |
+
# #
|
| 37 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 38 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 39 |
+
# #
|
| 40 |
+
################################################################################
|
| 41 |
+
|
| 42 |
+
# https://docs.github.com/en/rest/reference/actions#example-encrypting-a-secret-using-python
|
| 43 |
+
from __future__ import annotations
|
| 44 |
+
|
| 45 |
+
from base64 import b64encode
|
| 46 |
+
from typing import Any
|
| 47 |
+
|
| 48 |
+
from nacl import encoding, public
|
| 49 |
+
|
| 50 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def encrypt(public_key: str, secret_value: str) -> str:
|
| 54 |
+
"""
|
| 55 |
+
Encrypt a Unicode string using the public key.
|
| 56 |
+
"""
|
| 57 |
+
pk = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder)
|
| 58 |
+
sealed_box = public.SealedBox(pk)
|
| 59 |
+
encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
|
| 60 |
+
return b64encode(encrypted).decode("utf-8")
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class PublicKey(CompletableGithubObject):
|
| 64 |
+
"""
|
| 65 |
+
This class represents either an organization public key or a repository public key.
|
| 66 |
+
|
| 67 |
+
The reference can be found here
|
| 68 |
+
https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key
|
| 69 |
+
or here
|
| 70 |
+
https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key
|
| 71 |
+
|
| 72 |
+
The OpenAPI schema can be found at
|
| 73 |
+
- /components/schemas/actions-public-key
|
| 74 |
+
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
def _initAttributes(self) -> None:
|
| 78 |
+
self._created_at: Attribute[str] = NotSet
|
| 79 |
+
self._id: Attribute[int] = NotSet
|
| 80 |
+
self._key: Attribute[str] = NotSet
|
| 81 |
+
self._key_id: Attribute[str | int] = NotSet
|
| 82 |
+
self._title: Attribute[str] = NotSet
|
| 83 |
+
self._url: Attribute[str] = NotSet
|
| 84 |
+
|
| 85 |
+
def __repr__(self) -> str:
|
| 86 |
+
return self.get__repr__({"key_id": self._key_id.value, "key": self._key.value})
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def created_at(self) -> str:
|
| 90 |
+
self._completeIfNotSet(self._created_at)
|
| 91 |
+
return self._created_at.value
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def id(self) -> int:
|
| 95 |
+
self._completeIfNotSet(self._id)
|
| 96 |
+
return self._id.value
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def key(self) -> str:
|
| 100 |
+
self._completeIfNotSet(self._key)
|
| 101 |
+
return self._key.value
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def key_id(self) -> str | int:
|
| 105 |
+
self._completeIfNotSet(self._key_id)
|
| 106 |
+
return self._key_id.value
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def title(self) -> str:
|
| 110 |
+
self._completeIfNotSet(self._title)
|
| 111 |
+
return self._title.value
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def url(self) -> str:
|
| 115 |
+
self._completeIfNotSet(self._url)
|
| 116 |
+
return self._url.value
|
| 117 |
+
|
| 118 |
+
def encrypt(self, unencrypted_value: str) -> str:
|
| 119 |
+
return encrypt(self._key.value, unencrypted_value)
|
| 120 |
+
|
| 121 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 122 |
+
if "created_at" in attributes: # pragma no branch
|
| 123 |
+
self._created_at = self._makeStringAttribute(attributes["created_at"])
|
| 124 |
+
if "id" in attributes: # pragma no branch
|
| 125 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 126 |
+
if "key" in attributes: # pragma no branch
|
| 127 |
+
self._key = self._makeStringAttribute(attributes["key"])
|
| 128 |
+
if "key_id" in attributes: # pragma no branch
|
| 129 |
+
if isinstance(attributes["key_id"], str):
|
| 130 |
+
self._key_id = self._makeStringAttribute(attributes["key_id"])
|
| 131 |
+
else:
|
| 132 |
+
self._key_id = self._makeIntAttribute(attributes["key_id"])
|
| 133 |
+
if "title" in attributes: # pragma no branch
|
| 134 |
+
self._title = self._makeStringAttribute(attributes["title"])
|
| 135 |
+
if "url" in attributes: # pragma no branch
|
| 136 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
python_embeded/Lib/site-packages/github/PullRequest.py
ADDED
|
@@ -0,0 +1,1141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Michael Stead <michael.stead@gmail.com> #
|
| 4 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 5 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 6 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 9 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 10 |
+
# Copyright 2016 @tmshn <tmshn@r.recruit.co.jp> #
|
| 11 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 12 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 13 |
+
# Copyright 2017 Aaron Levine <allevin@sandia.gov> #
|
| 14 |
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
| 15 |
+
# Copyright 2018 Ben Yohay <ben@lightricks.com> #
|
| 16 |
+
# Copyright 2018 Brian J. Murrell <brian@interlinx.bc.ca> #
|
| 17 |
+
# Copyright 2018 Gilad Shefer <gshefer@redhat.com> #
|
| 18 |
+
# Copyright 2018 Martin Monperrus <monperrus@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2018 Matt Babineau <9685860+babineaum@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com> #
|
| 21 |
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
| 22 |
+
# Copyright 2018 Thibault Jamet <tjamet@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 24 |
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
| 25 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 26 |
+
# Copyright 2019 MarcoFalke <falke.marco@gmail.com> #
|
| 27 |
+
# Copyright 2019 Mark Browning <mark@cerebras.net> #
|
| 28 |
+
# Copyright 2019 MurphyZhao <d2014zjt@163.com> #
|
| 29 |
+
# Copyright 2019 Olof-Joachim Frahm (欧雅福) <olof@macrolet.net> #
|
| 30 |
+
# Copyright 2019 Pavan Kunisetty <nagapavan@users.noreply.github.com> #
|
| 31 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 32 |
+
# Copyright 2019 Tim Gates <tim.gates@iress.com> #
|
| 33 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 34 |
+
# Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
|
| 35 |
+
# Copyright 2020 Florent Clarret <florent.clarret@gmail.com> #
|
| 36 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 37 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 38 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 39 |
+
# Copyright 2022 tison <wander4096@gmail.com> #
|
| 40 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 41 |
+
# Copyright 2023 Heitor Polidoro <14806300+heitorpolidoro@users.noreply.github.com>#
|
| 42 |
+
# Copyright 2023 Heitor Polidoro <heitor.polidoro@gmail.com> #
|
| 43 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 44 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 45 |
+
# Copyright 2023 sd-kialo <138505487+sd-kialo@users.noreply.github.com> #
|
| 46 |
+
# Copyright 2023 vanya20074 <vanya20074@gmail.com> #
|
| 47 |
+
# Copyright 2024 Austin Sasko <austintyler0239@yahoo.com> #
|
| 48 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 49 |
+
# Copyright 2024 Evan Fetsko <emfetsko@gmail.com> #
|
| 50 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 51 |
+
# Copyright 2024 Kobbi Gal <85439776+kgal-pan@users.noreply.github.com> #
|
| 52 |
+
# Copyright 2025 Bruno Didot <bdidot@gmail.com> #
|
| 53 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 54 |
+
# Copyright 2025 Ryan Peach <github.essential257@passmail.net> #
|
| 55 |
+
# Copyright 2025 a-sido <andrei.sidorenko.1993@gmail.com> #
|
| 56 |
+
# #
|
| 57 |
+
# This file is part of PyGithub. #
|
| 58 |
+
# http://pygithub.readthedocs.io/ #
|
| 59 |
+
# #
|
| 60 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 61 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 62 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 63 |
+
# any later version. #
|
| 64 |
+
# #
|
| 65 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 66 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 67 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 68 |
+
# details. #
|
| 69 |
+
# #
|
| 70 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 71 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 72 |
+
# #
|
| 73 |
+
################################################################################
|
| 74 |
+
|
| 75 |
+
from __future__ import annotations
|
| 76 |
+
|
| 77 |
+
import urllib.parse
|
| 78 |
+
from datetime import datetime
|
| 79 |
+
from typing import TYPE_CHECKING, Any
|
| 80 |
+
|
| 81 |
+
from typing_extensions import NotRequired, TypedDict
|
| 82 |
+
|
| 83 |
+
import github.Commit
|
| 84 |
+
import github.File
|
| 85 |
+
import github.IssueComment
|
| 86 |
+
import github.IssueEvent
|
| 87 |
+
import github.Label
|
| 88 |
+
import github.Milestone
|
| 89 |
+
import github.NamedUser
|
| 90 |
+
import github.PaginatedList
|
| 91 |
+
import github.PullRequestComment
|
| 92 |
+
import github.PullRequestMergeStatus
|
| 93 |
+
import github.PullRequestPart
|
| 94 |
+
import github.PullRequestReview
|
| 95 |
+
import github.Team
|
| 96 |
+
from github import Consts
|
| 97 |
+
from github.GithubObject import (
|
| 98 |
+
Attribute,
|
| 99 |
+
CompletableGithubObject,
|
| 100 |
+
NotSet,
|
| 101 |
+
Opt,
|
| 102 |
+
is_defined,
|
| 103 |
+
is_optional,
|
| 104 |
+
is_optional_list,
|
| 105 |
+
is_undefined,
|
| 106 |
+
)
|
| 107 |
+
from github.Issue import Issue
|
| 108 |
+
from github.PaginatedList import PaginatedList
|
| 109 |
+
|
| 110 |
+
if TYPE_CHECKING:
|
| 111 |
+
from github.Commit import Commit
|
| 112 |
+
from github.File import File
|
| 113 |
+
from github.GitRef import GitRef
|
| 114 |
+
from github.IssueComment import IssueComment
|
| 115 |
+
from github.IssueEvent import IssueEvent
|
| 116 |
+
from github.Label import Label
|
| 117 |
+
from github.Milestone import Milestone
|
| 118 |
+
from github.NamedUser import NamedUser
|
| 119 |
+
from github.PullRequestComment import PullRequestComment
|
| 120 |
+
from github.PullRequestMergeStatus import PullRequestMergeStatus
|
| 121 |
+
from github.PullRequestPart import PullRequestPart
|
| 122 |
+
from github.PullRequestReview import PullRequestReview
|
| 123 |
+
from github.Team import Team
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
class ReviewComment(TypedDict):
|
| 127 |
+
path: str
|
| 128 |
+
position: NotRequired[int]
|
| 129 |
+
body: str
|
| 130 |
+
line: NotRequired[int]
|
| 131 |
+
side: NotRequired[str]
|
| 132 |
+
start_line: NotRequired[int]
|
| 133 |
+
start_side: NotRequired[str]
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class PullRequest(CompletableGithubObject):
|
| 137 |
+
"""
|
| 138 |
+
This class represents PullRequests.
|
| 139 |
+
|
| 140 |
+
The reference can be found here
|
| 141 |
+
https://docs.github.com/en/rest/reference/pulls
|
| 142 |
+
|
| 143 |
+
The OpenAPI schema can be found at
|
| 144 |
+
- /components/schemas/pull-request
|
| 145 |
+
- /components/schemas/pull-request-minimal
|
| 146 |
+
- /components/schemas/pull-request-simple
|
| 147 |
+
|
| 148 |
+
"""
|
| 149 |
+
|
| 150 |
+
def _initAttributes(self) -> None:
|
| 151 |
+
self.__links: Attribute[dict[str, Any]] = NotSet
|
| 152 |
+
self._active_lock_reason: Attribute[str] = NotSet
|
| 153 |
+
self._additions: Attribute[int] = NotSet
|
| 154 |
+
self._assignee: Attribute[NamedUser] = NotSet
|
| 155 |
+
self._assignees: Attribute[list[NamedUser]] = NotSet
|
| 156 |
+
self._author_association: Attribute[str] = NotSet
|
| 157 |
+
self._auto_merge: Attribute[dict[str, Any]] = NotSet
|
| 158 |
+
self._base: Attribute[PullRequestPart] = NotSet
|
| 159 |
+
self._body: Attribute[str] = NotSet
|
| 160 |
+
self._changed_files: Attribute[int] = NotSet
|
| 161 |
+
self._closed_at: Attribute[datetime | None] = NotSet
|
| 162 |
+
self._comments: Attribute[int] = NotSet
|
| 163 |
+
self._comments_url: Attribute[str] = NotSet
|
| 164 |
+
self._commits: Attribute[int] = NotSet
|
| 165 |
+
self._commits_url: Attribute[str] = NotSet
|
| 166 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 167 |
+
self._deletions: Attribute[int] = NotSet
|
| 168 |
+
self._diff_url: Attribute[str] = NotSet
|
| 169 |
+
self._draft: Attribute[bool] = NotSet
|
| 170 |
+
self._head: Attribute[PullRequestPart] = NotSet
|
| 171 |
+
self._html_url: Attribute[str] = NotSet
|
| 172 |
+
self._id: Attribute[int] = NotSet
|
| 173 |
+
self._issue_url: Attribute[str] = NotSet
|
| 174 |
+
self._labels: Attribute[list[Label]] = NotSet
|
| 175 |
+
self._locked: Attribute[bool] = NotSet
|
| 176 |
+
self._maintainer_can_modify: Attribute[bool] = NotSet
|
| 177 |
+
self._merge_commit_sha: Attribute[str] = NotSet
|
| 178 |
+
self._mergeable: Attribute[bool] = NotSet
|
| 179 |
+
self._mergeable_state: Attribute[str] = NotSet
|
| 180 |
+
self._merged: Attribute[bool] = NotSet
|
| 181 |
+
self._merged_at: Attribute[datetime | None] = NotSet
|
| 182 |
+
self._merged_by: Attribute[NamedUser] = NotSet
|
| 183 |
+
self._milestone: Attribute[Milestone] = NotSet
|
| 184 |
+
self._node_id: Attribute[str] = NotSet
|
| 185 |
+
self._number: Attribute[int] = NotSet
|
| 186 |
+
self._patch_url: Attribute[str] = NotSet
|
| 187 |
+
self._rebaseable: Attribute[bool] = NotSet
|
| 188 |
+
self._requested_reviewers: Attribute[list[NamedUser]] = NotSet
|
| 189 |
+
self._requested_teams: Attribute[list[Team]] = NotSet
|
| 190 |
+
self._review_comment_url: Attribute[str] = NotSet
|
| 191 |
+
self._review_comments: Attribute[int] = NotSet
|
| 192 |
+
self._review_comments_url: Attribute[str] = NotSet
|
| 193 |
+
self._state: Attribute[str] = NotSet
|
| 194 |
+
self._statuses_url: Attribute[str] = NotSet
|
| 195 |
+
self._title: Attribute[str] = NotSet
|
| 196 |
+
self._updated_at: Attribute[datetime | None] = NotSet
|
| 197 |
+
self._url: Attribute[str] = NotSet
|
| 198 |
+
self._user: Attribute[NamedUser] = NotSet
|
| 199 |
+
|
| 200 |
+
def __repr__(self) -> str:
|
| 201 |
+
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
| 202 |
+
|
| 203 |
+
@property
|
| 204 |
+
def _links(self) -> dict[str, Any]:
|
| 205 |
+
self._completeIfNotSet(self.__links)
|
| 206 |
+
return self.__links.value
|
| 207 |
+
|
| 208 |
+
@property
|
| 209 |
+
def active_lock_reason(self) -> str:
|
| 210 |
+
self._completeIfNotSet(self._active_lock_reason)
|
| 211 |
+
return self._active_lock_reason.value
|
| 212 |
+
|
| 213 |
+
@property
|
| 214 |
+
def additions(self) -> int:
|
| 215 |
+
self._completeIfNotSet(self._additions)
|
| 216 |
+
return self._additions.value
|
| 217 |
+
|
| 218 |
+
@property
|
| 219 |
+
def assignee(self) -> NamedUser:
|
| 220 |
+
self._completeIfNotSet(self._assignee)
|
| 221 |
+
return self._assignee.value
|
| 222 |
+
|
| 223 |
+
@property
|
| 224 |
+
def assignees(self) -> list[NamedUser]:
|
| 225 |
+
self._completeIfNotSet(self._assignees)
|
| 226 |
+
return self._assignees.value
|
| 227 |
+
|
| 228 |
+
@property
|
| 229 |
+
def author_association(self) -> str:
|
| 230 |
+
self._completeIfNotSet(self._author_association)
|
| 231 |
+
return self._author_association.value
|
| 232 |
+
|
| 233 |
+
@property
|
| 234 |
+
def auto_merge(self) -> dict[str, Any]:
|
| 235 |
+
self._completeIfNotSet(self._auto_merge)
|
| 236 |
+
return self._auto_merge.value
|
| 237 |
+
|
| 238 |
+
@property
|
| 239 |
+
def base(self) -> PullRequestPart:
|
| 240 |
+
self._completeIfNotSet(self._base)
|
| 241 |
+
return self._base.value
|
| 242 |
+
|
| 243 |
+
@property
|
| 244 |
+
def body(self) -> str:
|
| 245 |
+
self._completeIfNotSet(self._body)
|
| 246 |
+
return self._body.value
|
| 247 |
+
|
| 248 |
+
@property
|
| 249 |
+
def changed_files(self) -> int:
|
| 250 |
+
self._completeIfNotSet(self._changed_files)
|
| 251 |
+
return self._changed_files.value
|
| 252 |
+
|
| 253 |
+
@property
|
| 254 |
+
def closed_at(self) -> datetime | None:
|
| 255 |
+
self._completeIfNotSet(self._closed_at)
|
| 256 |
+
return self._closed_at.value
|
| 257 |
+
|
| 258 |
+
@property
|
| 259 |
+
def comments(self) -> int:
|
| 260 |
+
self._completeIfNotSet(self._comments)
|
| 261 |
+
return self._comments.value
|
| 262 |
+
|
| 263 |
+
@property
|
| 264 |
+
def comments_url(self) -> str:
|
| 265 |
+
self._completeIfNotSet(self._comments_url)
|
| 266 |
+
return self._comments_url.value
|
| 267 |
+
|
| 268 |
+
@property
|
| 269 |
+
def commits(self) -> int:
|
| 270 |
+
self._completeIfNotSet(self._commits)
|
| 271 |
+
return self._commits.value
|
| 272 |
+
|
| 273 |
+
@property
|
| 274 |
+
def commits_url(self) -> str:
|
| 275 |
+
self._completeIfNotSet(self._commits_url)
|
| 276 |
+
return self._commits_url.value
|
| 277 |
+
|
| 278 |
+
@property
|
| 279 |
+
def created_at(self) -> datetime:
|
| 280 |
+
self._completeIfNotSet(self._created_at)
|
| 281 |
+
return self._created_at.value
|
| 282 |
+
|
| 283 |
+
@property
|
| 284 |
+
def deletions(self) -> int:
|
| 285 |
+
self._completeIfNotSet(self._deletions)
|
| 286 |
+
return self._deletions.value
|
| 287 |
+
|
| 288 |
+
@property
|
| 289 |
+
def diff_url(self) -> str:
|
| 290 |
+
self._completeIfNotSet(self._diff_url)
|
| 291 |
+
return self._diff_url.value
|
| 292 |
+
|
| 293 |
+
@property
|
| 294 |
+
def draft(self) -> bool:
|
| 295 |
+
self._completeIfNotSet(self._draft)
|
| 296 |
+
return self._draft.value
|
| 297 |
+
|
| 298 |
+
@property
|
| 299 |
+
def head(self) -> PullRequestPart:
|
| 300 |
+
self._completeIfNotSet(self._head)
|
| 301 |
+
return self._head.value
|
| 302 |
+
|
| 303 |
+
@property
|
| 304 |
+
def html_url(self) -> str:
|
| 305 |
+
self._completeIfNotSet(self._html_url)
|
| 306 |
+
return self._html_url.value
|
| 307 |
+
|
| 308 |
+
@property
|
| 309 |
+
def id(self) -> int:
|
| 310 |
+
self._completeIfNotSet(self._id)
|
| 311 |
+
return self._id.value
|
| 312 |
+
|
| 313 |
+
@property
|
| 314 |
+
def issue_url(self) -> str:
|
| 315 |
+
self._completeIfNotSet(self._issue_url)
|
| 316 |
+
return self._issue_url.value
|
| 317 |
+
|
| 318 |
+
@property
|
| 319 |
+
def labels(self) -> list[Label]:
|
| 320 |
+
self._completeIfNotSet(self._labels)
|
| 321 |
+
return self._labels.value
|
| 322 |
+
|
| 323 |
+
@property
|
| 324 |
+
def locked(self) -> bool:
|
| 325 |
+
self._completeIfNotSet(self._locked)
|
| 326 |
+
return self._locked.value
|
| 327 |
+
|
| 328 |
+
@property
|
| 329 |
+
def maintainer_can_modify(self) -> bool:
|
| 330 |
+
self._completeIfNotSet(self._maintainer_can_modify)
|
| 331 |
+
return self._maintainer_can_modify.value
|
| 332 |
+
|
| 333 |
+
@property
|
| 334 |
+
def merge_commit_sha(self) -> str:
|
| 335 |
+
self._completeIfNotSet(self._merge_commit_sha)
|
| 336 |
+
return self._merge_commit_sha.value
|
| 337 |
+
|
| 338 |
+
@property
|
| 339 |
+
def mergeable(self) -> bool:
|
| 340 |
+
self._completeIfNotSet(self._mergeable)
|
| 341 |
+
return self._mergeable.value
|
| 342 |
+
|
| 343 |
+
@property
|
| 344 |
+
def mergeable_state(self) -> str:
|
| 345 |
+
self._completeIfNotSet(self._mergeable_state)
|
| 346 |
+
return self._mergeable_state.value
|
| 347 |
+
|
| 348 |
+
@property
|
| 349 |
+
def merged(self) -> bool:
|
| 350 |
+
self._completeIfNotSet(self._merged)
|
| 351 |
+
return self._merged.value
|
| 352 |
+
|
| 353 |
+
@property
|
| 354 |
+
def merged_at(self) -> datetime | None:
|
| 355 |
+
self._completeIfNotSet(self._merged_at)
|
| 356 |
+
return self._merged_at.value
|
| 357 |
+
|
| 358 |
+
@property
|
| 359 |
+
def merged_by(self) -> NamedUser:
|
| 360 |
+
self._completeIfNotSet(self._merged_by)
|
| 361 |
+
return self._merged_by.value
|
| 362 |
+
|
| 363 |
+
@property
|
| 364 |
+
def milestone(self) -> Milestone:
|
| 365 |
+
self._completeIfNotSet(self._milestone)
|
| 366 |
+
return self._milestone.value
|
| 367 |
+
|
| 368 |
+
@property
|
| 369 |
+
def node_id(self) -> str:
|
| 370 |
+
self._completeIfNotSet(self._node_id)
|
| 371 |
+
return self._node_id.value
|
| 372 |
+
|
| 373 |
+
@property
|
| 374 |
+
def number(self) -> int:
|
| 375 |
+
self._completeIfNotSet(self._number)
|
| 376 |
+
return self._number.value
|
| 377 |
+
|
| 378 |
+
@property
|
| 379 |
+
def patch_url(self) -> str:
|
| 380 |
+
self._completeIfNotSet(self._patch_url)
|
| 381 |
+
return self._patch_url.value
|
| 382 |
+
|
| 383 |
+
@property
|
| 384 |
+
def rebaseable(self) -> bool:
|
| 385 |
+
self._completeIfNotSet(self._rebaseable)
|
| 386 |
+
return self._rebaseable.value
|
| 387 |
+
|
| 388 |
+
@property
|
| 389 |
+
def requested_reviewers(self) -> list[NamedUser]:
|
| 390 |
+
self._completeIfNotSet(self._requested_reviewers)
|
| 391 |
+
return self._requested_reviewers.value
|
| 392 |
+
|
| 393 |
+
@property
|
| 394 |
+
def requested_teams(self) -> list[Team]:
|
| 395 |
+
self._completeIfNotSet(self._requested_teams)
|
| 396 |
+
return self._requested_teams.value
|
| 397 |
+
|
| 398 |
+
@property
|
| 399 |
+
def review_comment_url(self) -> str:
|
| 400 |
+
self._completeIfNotSet(self._review_comment_url)
|
| 401 |
+
return self._review_comment_url.value
|
| 402 |
+
|
| 403 |
+
@property
|
| 404 |
+
def review_comments(self) -> int:
|
| 405 |
+
self._completeIfNotSet(self._review_comments)
|
| 406 |
+
return self._review_comments.value
|
| 407 |
+
|
| 408 |
+
@property
|
| 409 |
+
def review_comments_url(self) -> str:
|
| 410 |
+
self._completeIfNotSet(self._review_comments_url)
|
| 411 |
+
return self._review_comments_url.value
|
| 412 |
+
|
| 413 |
+
@property
|
| 414 |
+
def state(self) -> str:
|
| 415 |
+
self._completeIfNotSet(self._state)
|
| 416 |
+
return self._state.value
|
| 417 |
+
|
| 418 |
+
@property
|
| 419 |
+
def statuses_url(self) -> str:
|
| 420 |
+
self._completeIfNotSet(self._statuses_url)
|
| 421 |
+
return self._statuses_url.value
|
| 422 |
+
|
| 423 |
+
@property
|
| 424 |
+
def title(self) -> str:
|
| 425 |
+
self._completeIfNotSet(self._title)
|
| 426 |
+
return self._title.value
|
| 427 |
+
|
| 428 |
+
@property
|
| 429 |
+
def updated_at(self) -> datetime | None:
|
| 430 |
+
self._completeIfNotSet(self._updated_at)
|
| 431 |
+
return self._updated_at.value
|
| 432 |
+
|
| 433 |
+
@property
|
| 434 |
+
def url(self) -> str:
|
| 435 |
+
self._completeIfNotSet(self._url)
|
| 436 |
+
return self._url.value
|
| 437 |
+
|
| 438 |
+
@property
|
| 439 |
+
def user(self) -> NamedUser:
|
| 440 |
+
self._completeIfNotSet(self._user)
|
| 441 |
+
return self._user.value
|
| 442 |
+
|
| 443 |
+
def as_issue(self) -> Issue:
|
| 444 |
+
"""
|
| 445 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number} <https://docs.github.com/en/rest/reference/issues>`_
|
| 446 |
+
"""
|
| 447 |
+
headers, data = self._requester.requestJsonAndCheck("GET", self.issue_url)
|
| 448 |
+
return github.Issue.Issue(self._requester, headers, data, completed=True)
|
| 449 |
+
|
| 450 |
+
def create_comment(self, body: str, commit: github.Commit.Commit, path: str, position: int) -> PullRequestComment:
|
| 451 |
+
"""
|
| 452 |
+
:calls: `POST /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 453 |
+
"""
|
| 454 |
+
return self.create_review_comment(body, commit, path, position)
|
| 455 |
+
|
| 456 |
+
def create_review_comment(
|
| 457 |
+
self,
|
| 458 |
+
body: str,
|
| 459 |
+
commit: github.Commit.Commit,
|
| 460 |
+
path: str,
|
| 461 |
+
# line replaces deprecated position argument, so we put it between path and side
|
| 462 |
+
line: Opt[int] = NotSet,
|
| 463 |
+
side: Opt[str] = NotSet,
|
| 464 |
+
start_line: Opt[int] = NotSet,
|
| 465 |
+
start_side: Opt[str] = NotSet,
|
| 466 |
+
in_reply_to: Opt[int] = NotSet,
|
| 467 |
+
subject_type: Opt[str] = NotSet,
|
| 468 |
+
as_suggestion: bool = False,
|
| 469 |
+
) -> PullRequestComment:
|
| 470 |
+
"""
|
| 471 |
+
:calls: `POST /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 472 |
+
"""
|
| 473 |
+
assert isinstance(body, str), body
|
| 474 |
+
assert isinstance(commit, github.Commit.Commit), commit
|
| 475 |
+
assert isinstance(path, str), path
|
| 476 |
+
assert is_optional(line, int), line
|
| 477 |
+
assert is_undefined(side) or side in ["LEFT", "RIGHT"], side
|
| 478 |
+
assert is_optional(start_line, int), start_line
|
| 479 |
+
assert is_undefined(start_side) or start_side in [
|
| 480 |
+
"LEFT",
|
| 481 |
+
"RIGHT",
|
| 482 |
+
"side",
|
| 483 |
+
], start_side
|
| 484 |
+
assert is_optional(in_reply_to, int), in_reply_to
|
| 485 |
+
assert is_undefined(subject_type) or subject_type in [
|
| 486 |
+
"line",
|
| 487 |
+
"file",
|
| 488 |
+
], subject_type
|
| 489 |
+
assert isinstance(as_suggestion, bool), as_suggestion
|
| 490 |
+
|
| 491 |
+
if as_suggestion:
|
| 492 |
+
body = f"```suggestion\n{body}\n```"
|
| 493 |
+
post_parameters = NotSet.remove_unset_items(
|
| 494 |
+
{
|
| 495 |
+
"body": body,
|
| 496 |
+
"commit_id": commit._identity,
|
| 497 |
+
"path": path,
|
| 498 |
+
"line": line,
|
| 499 |
+
"side": side,
|
| 500 |
+
"start_line": start_line,
|
| 501 |
+
"start_side": start_side,
|
| 502 |
+
"in_reply_to": in_reply_to,
|
| 503 |
+
"subject_type": subject_type,
|
| 504 |
+
}
|
| 505 |
+
)
|
| 506 |
+
|
| 507 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/comments", input=post_parameters)
|
| 508 |
+
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
| 509 |
+
|
| 510 |
+
def create_review_comment_reply(self, comment_id: int, body: str) -> PullRequestComment:
|
| 511 |
+
"""
|
| 512 |
+
:calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 513 |
+
"""
|
| 514 |
+
assert isinstance(comment_id, int), comment_id
|
| 515 |
+
assert isinstance(body, str), body
|
| 516 |
+
post_parameters = {"body": body}
|
| 517 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 518 |
+
"POST",
|
| 519 |
+
f"{self.url}/comments/{comment_id}/replies",
|
| 520 |
+
input=post_parameters,
|
| 521 |
+
)
|
| 522 |
+
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
| 523 |
+
|
| 524 |
+
def create_issue_comment(self, body: str) -> IssueComment:
|
| 525 |
+
"""
|
| 526 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 527 |
+
"""
|
| 528 |
+
assert isinstance(body, str), body
|
| 529 |
+
post_parameters = {
|
| 530 |
+
"body": body,
|
| 531 |
+
}
|
| 532 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.issue_url}/comments", input=post_parameters)
|
| 533 |
+
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
| 534 |
+
|
| 535 |
+
def create_review(
|
| 536 |
+
self,
|
| 537 |
+
commit: Opt[github.Commit.Commit] = NotSet,
|
| 538 |
+
body: Opt[str] = NotSet,
|
| 539 |
+
event: Opt[str] = NotSet,
|
| 540 |
+
comments: Opt[list[ReviewComment]] = NotSet,
|
| 541 |
+
) -> PullRequestReview:
|
| 542 |
+
"""
|
| 543 |
+
:calls: `POST /repos/{owner}/{repo}/pulls/{number}/reviews <https://docs.github.com/en/free-pro-team@latest/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request>`_
|
| 544 |
+
"""
|
| 545 |
+
assert is_optional(commit, github.Commit.Commit), commit
|
| 546 |
+
assert is_optional(body, str), body
|
| 547 |
+
assert is_optional(event, str), event
|
| 548 |
+
assert is_optional_list(comments, dict), comments
|
| 549 |
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items({"body": body})
|
| 550 |
+
post_parameters["event"] = "COMMENT" if is_undefined(event) else event
|
| 551 |
+
if is_defined(commit):
|
| 552 |
+
post_parameters["commit_id"] = commit.sha
|
| 553 |
+
if is_defined(comments):
|
| 554 |
+
post_parameters["comments"] = comments
|
| 555 |
+
else:
|
| 556 |
+
post_parameters["comments"] = []
|
| 557 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/reviews", input=post_parameters)
|
| 558 |
+
return github.PullRequestReview.PullRequestReview(self._requester, headers, data)
|
| 559 |
+
|
| 560 |
+
def create_review_request(
|
| 561 |
+
self,
|
| 562 |
+
reviewers: Opt[list[str] | str] = NotSet,
|
| 563 |
+
team_reviewers: Opt[list[str] | str] = NotSet,
|
| 564 |
+
) -> None:
|
| 565 |
+
"""
|
| 566 |
+
:calls: `POST /repos/{owner}/{repo}/pulls/{number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
|
| 567 |
+
"""
|
| 568 |
+
assert is_optional(reviewers, str) or is_optional_list(reviewers, str), reviewers
|
| 569 |
+
assert is_optional(team_reviewers, str) or is_optional_list(team_reviewers, str), team_reviewers
|
| 570 |
+
|
| 571 |
+
if isinstance(reviewers, str):
|
| 572 |
+
reviewers = [reviewers]
|
| 573 |
+
if isinstance(team_reviewers, str):
|
| 574 |
+
team_reviewers = [team_reviewers]
|
| 575 |
+
|
| 576 |
+
post_parameters = NotSet.remove_unset_items({"reviewers": reviewers, "team_reviewers": team_reviewers})
|
| 577 |
+
|
| 578 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 579 |
+
"POST", f"{self.url}/requested_reviewers", input=post_parameters
|
| 580 |
+
)
|
| 581 |
+
|
| 582 |
+
def delete_review_request(
|
| 583 |
+
self,
|
| 584 |
+
reviewers: Opt[list[str] | str] = NotSet,
|
| 585 |
+
team_reviewers: Opt[list[str] | str] = NotSet,
|
| 586 |
+
) -> None:
|
| 587 |
+
"""
|
| 588 |
+
:calls: `DELETE /repos/{owner}/{repo}/pulls/{number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
|
| 589 |
+
"""
|
| 590 |
+
assert is_optional(reviewers, str) or is_optional_list(reviewers, str), reviewers
|
| 591 |
+
assert is_optional(team_reviewers, str) or is_optional_list(team_reviewers, str), team_reviewers
|
| 592 |
+
|
| 593 |
+
if isinstance(reviewers, str):
|
| 594 |
+
reviewers = [reviewers]
|
| 595 |
+
if isinstance(team_reviewers, str):
|
| 596 |
+
team_reviewers = [team_reviewers]
|
| 597 |
+
|
| 598 |
+
post_parameters = NotSet.remove_unset_items({"reviewers": reviewers, "team_reviewers": team_reviewers})
|
| 599 |
+
|
| 600 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 601 |
+
"DELETE", f"{self.url}/requested_reviewers", input=post_parameters
|
| 602 |
+
)
|
| 603 |
+
|
| 604 |
+
def edit(
|
| 605 |
+
self,
|
| 606 |
+
title: Opt[str] = NotSet,
|
| 607 |
+
body: Opt[str] = NotSet,
|
| 608 |
+
state: Opt[str] = NotSet,
|
| 609 |
+
base: Opt[str] = NotSet,
|
| 610 |
+
maintainer_can_modify: Opt[bool] = NotSet,
|
| 611 |
+
) -> None:
|
| 612 |
+
"""
|
| 613 |
+
:calls: `PATCH /repos/{owner}/{repo}/pulls/{number} <https://docs.github.com/en/rest/reference/pulls>`_
|
| 614 |
+
"""
|
| 615 |
+
assert is_optional(title, str), title
|
| 616 |
+
assert is_optional(body, str), body
|
| 617 |
+
assert is_optional(state, str), state
|
| 618 |
+
assert is_optional(base, str), base
|
| 619 |
+
assert is_optional(maintainer_can_modify, bool), maintainer_can_modify
|
| 620 |
+
post_parameters = NotSet.remove_unset_items(
|
| 621 |
+
{"title": title, "body": body, "state": state, "base": base, "maintainer_can_modify": maintainer_can_modify}
|
| 622 |
+
)
|
| 623 |
+
|
| 624 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 625 |
+
self._useAttributes(data)
|
| 626 |
+
|
| 627 |
+
def get_comment(self, id: int) -> PullRequestComment:
|
| 628 |
+
"""
|
| 629 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/comments/{number} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 630 |
+
"""
|
| 631 |
+
return self.get_review_comment(id)
|
| 632 |
+
|
| 633 |
+
def get_review_comment(self, id: int) -> PullRequestComment:
|
| 634 |
+
"""
|
| 635 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/comments/{number} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 636 |
+
"""
|
| 637 |
+
assert isinstance(id, int), id
|
| 638 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self._parentUrl(self.url)}/comments/{id}")
|
| 639 |
+
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
| 640 |
+
|
| 641 |
+
def get_comments(
|
| 642 |
+
self,
|
| 643 |
+
sort: Opt[str] = NotSet,
|
| 644 |
+
direction: Opt[str] = NotSet,
|
| 645 |
+
since: Opt[datetime] = NotSet,
|
| 646 |
+
) -> PaginatedList[PullRequestComment]:
|
| 647 |
+
"""
|
| 648 |
+
Warning: this only returns review comments. For normal conversation comments, use get_issue_comments.
|
| 649 |
+
|
| 650 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 651 |
+
:param sort: string 'created' or 'updated'
|
| 652 |
+
:param direction: string 'asc' or 'desc'
|
| 653 |
+
:param since: datetime
|
| 654 |
+
"""
|
| 655 |
+
return self.get_review_comments(sort=sort, direction=direction, since=since)
|
| 656 |
+
|
| 657 |
+
# v3: remove *, added here to force named parameters because order has changed
|
| 658 |
+
def get_review_comments(
|
| 659 |
+
self,
|
| 660 |
+
*,
|
| 661 |
+
sort: Opt[str] = NotSet,
|
| 662 |
+
direction: Opt[str] = NotSet,
|
| 663 |
+
since: Opt[datetime] = NotSet,
|
| 664 |
+
) -> PaginatedList[PullRequestComment]:
|
| 665 |
+
"""
|
| 666 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 667 |
+
:param sort: string 'created' or 'updated'
|
| 668 |
+
:param direction: string 'asc' or 'desc'
|
| 669 |
+
:param since: datetime
|
| 670 |
+
"""
|
| 671 |
+
assert is_optional(sort, str), sort
|
| 672 |
+
assert is_optional(direction, str), direction
|
| 673 |
+
assert is_optional(since, datetime), since
|
| 674 |
+
|
| 675 |
+
url_parameters = NotSet.remove_unset_items({"sort": sort, "direction": direction})
|
| 676 |
+
if is_defined(since):
|
| 677 |
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 678 |
+
|
| 679 |
+
return PaginatedList(
|
| 680 |
+
github.PullRequestComment.PullRequestComment,
|
| 681 |
+
self._requester,
|
| 682 |
+
f"{self.url}/comments",
|
| 683 |
+
url_parameters,
|
| 684 |
+
)
|
| 685 |
+
|
| 686 |
+
def get_single_review_comments(self, id: int) -> PaginatedList[PullRequestComment]:
|
| 687 |
+
"""
|
| 688 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/review/{id}/comments <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
| 689 |
+
"""
|
| 690 |
+
assert isinstance(id, int), id
|
| 691 |
+
return PaginatedList(
|
| 692 |
+
github.PullRequestComment.PullRequestComment,
|
| 693 |
+
self._requester,
|
| 694 |
+
f"{self.url}/reviews/{id}/comments",
|
| 695 |
+
None,
|
| 696 |
+
)
|
| 697 |
+
|
| 698 |
+
def get_commits(self) -> PaginatedList[Commit]:
|
| 699 |
+
"""
|
| 700 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/commits <https://docs.github.com/en/rest/reference/pulls>`_
|
| 701 |
+
"""
|
| 702 |
+
return PaginatedList(github.Commit.Commit, self._requester, f"{self.url}/commits", None)
|
| 703 |
+
|
| 704 |
+
def get_files(self) -> PaginatedList[File]:
|
| 705 |
+
"""
|
| 706 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/files <https://docs.github.com/en/rest/reference/pulls>`_
|
| 707 |
+
"""
|
| 708 |
+
return PaginatedList(github.File.File, self._requester, f"{self.url}/files", None)
|
| 709 |
+
|
| 710 |
+
def get_issue_comment(self, id: int) -> IssueComment:
|
| 711 |
+
"""
|
| 712 |
+
:calls: `GET /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 713 |
+
"""
|
| 714 |
+
assert isinstance(id, int), id
|
| 715 |
+
headers, data = self._requester.requestJsonAndCheck("GET", f"{self._parentUrl(self.issue_url)}/comments/{id}")
|
| 716 |
+
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
| 717 |
+
|
| 718 |
+
def get_issue_comments(self) -> PaginatedList[IssueComment]:
|
| 719 |
+
"""
|
| 720 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
| 721 |
+
"""
|
| 722 |
+
return PaginatedList(
|
| 723 |
+
github.IssueComment.IssueComment,
|
| 724 |
+
self._requester,
|
| 725 |
+
f"{self.issue_url}/comments",
|
| 726 |
+
None,
|
| 727 |
+
)
|
| 728 |
+
|
| 729 |
+
def get_issue_events(self) -> PaginatedList[IssueEvent]:
|
| 730 |
+
"""
|
| 731 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/events <https://docs.github.com/en/rest/reference/issues#events>`_
|
| 732 |
+
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueEvent.IssueEvent`
|
| 733 |
+
"""
|
| 734 |
+
return PaginatedList(
|
| 735 |
+
github.IssueEvent.IssueEvent,
|
| 736 |
+
self._requester,
|
| 737 |
+
f"{self.issue_url}/events",
|
| 738 |
+
None,
|
| 739 |
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
| 740 |
+
)
|
| 741 |
+
|
| 742 |
+
def get_review(self, id: int) -> PullRequestReview:
|
| 743 |
+
"""
|
| 744 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/reviews/{id} <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
| 745 |
+
:param id: integer
|
| 746 |
+
:rtype: :class:`github.PullRequestReview.PullRequestReview`
|
| 747 |
+
"""
|
| 748 |
+
assert isinstance(id, int), id
|
| 749 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 750 |
+
"GET",
|
| 751 |
+
f"{self.url}/reviews/{id}",
|
| 752 |
+
)
|
| 753 |
+
return github.PullRequestReview.PullRequestReview(self._requester, headers, data)
|
| 754 |
+
|
| 755 |
+
def get_reviews(self) -> PaginatedList[PullRequestReview]:
|
| 756 |
+
"""
|
| 757 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/reviews <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
| 758 |
+
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestReview.PullRequestReview`
|
| 759 |
+
"""
|
| 760 |
+
return PaginatedList(
|
| 761 |
+
github.PullRequestReview.PullRequestReview,
|
| 762 |
+
self._requester,
|
| 763 |
+
f"{self.url}/reviews",
|
| 764 |
+
None,
|
| 765 |
+
)
|
| 766 |
+
|
| 767 |
+
def get_review_requests(self) -> tuple[PaginatedList[NamedUser], PaginatedList[Team]]:
|
| 768 |
+
"""
|
| 769 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
|
| 770 |
+
:rtype: tuple of :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` and of :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
|
| 771 |
+
"""
|
| 772 |
+
return (
|
| 773 |
+
PaginatedList(
|
| 774 |
+
github.NamedUser.NamedUser,
|
| 775 |
+
self._requester,
|
| 776 |
+
f"{self.url}/requested_reviewers",
|
| 777 |
+
None,
|
| 778 |
+
list_item="users",
|
| 779 |
+
),
|
| 780 |
+
PaginatedList(
|
| 781 |
+
github.Team.Team,
|
| 782 |
+
self._requester,
|
| 783 |
+
f"{self.url}/requested_reviewers",
|
| 784 |
+
None,
|
| 785 |
+
list_item="teams",
|
| 786 |
+
),
|
| 787 |
+
)
|
| 788 |
+
|
| 789 |
+
def get_labels(self) -> PaginatedList[Label]:
|
| 790 |
+
"""
|
| 791 |
+
:calls: `GET /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 792 |
+
"""
|
| 793 |
+
return PaginatedList(github.Label.Label, self._requester, f"{self.issue_url}/labels", None)
|
| 794 |
+
|
| 795 |
+
def add_to_labels(self, *labels: github.Label.Label | str) -> None:
|
| 796 |
+
"""
|
| 797 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 798 |
+
"""
|
| 799 |
+
assert all(isinstance(element, (github.Label.Label, str)) for element in labels), labels
|
| 800 |
+
post_parameters = [label.name if isinstance(label, github.Label.Label) else label for label in labels]
|
| 801 |
+
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.issue_url}/labels", input=post_parameters)
|
| 802 |
+
|
| 803 |
+
def delete_labels(self) -> None:
|
| 804 |
+
"""
|
| 805 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 806 |
+
"""
|
| 807 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.issue_url}/labels")
|
| 808 |
+
|
| 809 |
+
def remove_from_labels(self, label: github.Label.Label | str) -> None:
|
| 810 |
+
"""
|
| 811 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{number}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 812 |
+
"""
|
| 813 |
+
assert isinstance(label, (github.Label.Label, str)), label
|
| 814 |
+
if isinstance(label, github.Label.Label):
|
| 815 |
+
label = label._identity
|
| 816 |
+
else:
|
| 817 |
+
label = urllib.parse.quote(label)
|
| 818 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.issue_url}/labels/{label}")
|
| 819 |
+
|
| 820 |
+
def set_labels(self, *labels: github.Label.Label | str) -> None:
|
| 821 |
+
"""
|
| 822 |
+
:calls: `PUT /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
| 823 |
+
"""
|
| 824 |
+
assert all(isinstance(element, (github.Label.Label, str)) for element in labels), labels
|
| 825 |
+
post_parameters = [label.name if isinstance(label, github.Label.Label) else label for label in labels]
|
| 826 |
+
headers, data = self._requester.requestJsonAndCheck("PUT", f"{self.issue_url}/labels", input=post_parameters)
|
| 827 |
+
|
| 828 |
+
def is_merged(self) -> bool:
|
| 829 |
+
"""
|
| 830 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/{number}/merge <https://docs.github.com/en/rest/reference/pulls>`_
|
| 831 |
+
"""
|
| 832 |
+
status, headers, data = self._requester.requestJson("GET", f"{self.url}/merge")
|
| 833 |
+
return status == 204
|
| 834 |
+
|
| 835 |
+
def restore_branch(self) -> GitRef:
|
| 836 |
+
"""
|
| 837 |
+
Convenience function that calls :meth:`Repository.create_git_ref` :rtype: :class:`github.GitRef.GitRef`
|
| 838 |
+
"""
|
| 839 |
+
return self.head.repo.create_git_ref(f"refs/heads/{self.head.ref}", sha=self.head.sha)
|
| 840 |
+
|
| 841 |
+
def delete_branch(self, force: bool = False) -> None:
|
| 842 |
+
"""
|
| 843 |
+
Convenience function that calls :meth:`GitRef.delete` :rtype: bool.
|
| 844 |
+
"""
|
| 845 |
+
if not force:
|
| 846 |
+
remaining_pulls = self.head.repo.get_pulls(head=f"{self.head.repo.owner.login}:{self.head.ref}")
|
| 847 |
+
if remaining_pulls.totalCount > 0:
|
| 848 |
+
raise RuntimeError(
|
| 849 |
+
"This branch is referenced by open pull requests, set force=True to delete this branch."
|
| 850 |
+
)
|
| 851 |
+
return self.head.repo.get_git_ref(f"heads/{self.head.ref}").delete()
|
| 852 |
+
|
| 853 |
+
def enable_automerge(
|
| 854 |
+
self,
|
| 855 |
+
merge_method: Opt[str] = "MERGE",
|
| 856 |
+
author_email: Opt[str] = NotSet,
|
| 857 |
+
client_mutation_id: Opt[str] = NotSet,
|
| 858 |
+
commit_body: Opt[str] = NotSet,
|
| 859 |
+
commit_headline: Opt[str] = NotSet,
|
| 860 |
+
expected_head_oid: Opt[str] = NotSet,
|
| 861 |
+
) -> dict[str, Any]:
|
| 862 |
+
"""
|
| 863 |
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to enable pull request auto merge
|
| 864 |
+
<https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge>
|
| 865 |
+
"""
|
| 866 |
+
assert is_optional(author_email, str), author_email
|
| 867 |
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
| 868 |
+
assert is_optional(commit_body, str), commit_body
|
| 869 |
+
assert is_optional(commit_headline, str), commit_headline
|
| 870 |
+
assert is_optional(expected_head_oid, str), expected_head_oid
|
| 871 |
+
assert isinstance(merge_method, str) and merge_method in ["MERGE", "REBASE", "SQUASH"], merge_method
|
| 872 |
+
|
| 873 |
+
# Define the variables
|
| 874 |
+
variables = {
|
| 875 |
+
"pullRequestId": self.node_id,
|
| 876 |
+
"authorEmail": author_email,
|
| 877 |
+
"clientMutationId": client_mutation_id,
|
| 878 |
+
"commitBody": commit_body,
|
| 879 |
+
"commitHeadline": commit_headline,
|
| 880 |
+
"expectedHeadOid": expected_head_oid,
|
| 881 |
+
"mergeMethod": merge_method,
|
| 882 |
+
}
|
| 883 |
+
|
| 884 |
+
# Make the request
|
| 885 |
+
_, data = self._requester.graphql_named_mutation(
|
| 886 |
+
mutation_name="enablePullRequestAutoMerge",
|
| 887 |
+
mutation_input=NotSet.remove_unset_items(variables),
|
| 888 |
+
output_schema="actor { avatarUrl login resourcePath url } clientMutationId",
|
| 889 |
+
)
|
| 890 |
+
return data
|
| 891 |
+
|
| 892 |
+
def disable_automerge(
|
| 893 |
+
self,
|
| 894 |
+
client_mutation_id: Opt[str] = NotSet,
|
| 895 |
+
) -> dict[str, Any]:
|
| 896 |
+
"""
|
| 897 |
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to disable pull request auto merge
|
| 898 |
+
<https://docs.github.com/en/graphql/reference/mutations#disablepullrequestautomerge>
|
| 899 |
+
"""
|
| 900 |
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
| 901 |
+
|
| 902 |
+
# Define the variables
|
| 903 |
+
variables = {
|
| 904 |
+
"pullRequestId": self.node_id,
|
| 905 |
+
"clientMutationId": client_mutation_id,
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
+
# Make the request
|
| 909 |
+
_, data = self._requester.graphql_named_mutation(
|
| 910 |
+
mutation_name="disablePullRequestAutoMerge",
|
| 911 |
+
mutation_input=NotSet.remove_unset_items(variables),
|
| 912 |
+
output_schema="actor { avatarUrl login resourcePath url } clientMutationId",
|
| 913 |
+
)
|
| 914 |
+
return data
|
| 915 |
+
|
| 916 |
+
def merge(
|
| 917 |
+
self,
|
| 918 |
+
commit_message: Opt[str] = NotSet,
|
| 919 |
+
commit_title: Opt[str] = NotSet,
|
| 920 |
+
merge_method: Opt[str] = NotSet,
|
| 921 |
+
sha: Opt[str] = NotSet,
|
| 922 |
+
delete_branch: bool = False,
|
| 923 |
+
) -> PullRequestMergeStatus:
|
| 924 |
+
"""
|
| 925 |
+
:calls: `PUT /repos/{owner}/{repo}/pulls/{number}/merge <https://docs.github.com/en/rest/reference/pulls>`_
|
| 926 |
+
"""
|
| 927 |
+
assert is_optional(commit_message, str), commit_message
|
| 928 |
+
assert is_optional(commit_title, str), commit_title
|
| 929 |
+
assert is_optional(merge_method, str), merge_method
|
| 930 |
+
assert is_optional(sha, str), sha
|
| 931 |
+
post_parameters = NotSet.remove_unset_items(
|
| 932 |
+
{"commit_message": commit_message, "commit_title": commit_title, "merge_method": merge_method, "sha": sha}
|
| 933 |
+
)
|
| 934 |
+
headers, data = self._requester.requestJsonAndCheck("PUT", f"{self.url}/merge", input=post_parameters)
|
| 935 |
+
if delete_branch:
|
| 936 |
+
self.delete_branch()
|
| 937 |
+
|
| 938 |
+
return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, headers, data)
|
| 939 |
+
|
| 940 |
+
def add_to_assignees(self, *assignees: github.NamedUser.NamedUser | str) -> None:
|
| 941 |
+
"""
|
| 942 |
+
:calls: `POST /repos/{owner}/{repo}/issues/{number}/assignees <https://docs.github.com/en/rest/issues/assignees?apiVersion=2022-11-28#add-assignees-to-an-issue>`_
|
| 943 |
+
"""
|
| 944 |
+
assert all(isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees), assignees
|
| 945 |
+
post_parameters = {
|
| 946 |
+
"assignees": [
|
| 947 |
+
assignee.login if isinstance(assignee, github.NamedUser.NamedUser) else assignee
|
| 948 |
+
for assignee in assignees
|
| 949 |
+
]
|
| 950 |
+
}
|
| 951 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 952 |
+
"POST", f"{self.issue_url}/assignees", input=post_parameters
|
| 953 |
+
)
|
| 954 |
+
# Only use the assignees attribute, since we call this PR as an issue
|
| 955 |
+
self._useAttributes({"assignees": data["assignees"]})
|
| 956 |
+
|
| 957 |
+
def remove_from_assignees(self, *assignees: github.NamedUser.NamedUser | str) -> None:
|
| 958 |
+
"""
|
| 959 |
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
|
| 960 |
+
"""
|
| 961 |
+
assert all(isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees), assignees
|
| 962 |
+
post_parameters = {
|
| 963 |
+
"assignees": [
|
| 964 |
+
assignee.login if isinstance(assignee, github.NamedUser.NamedUser) else assignee
|
| 965 |
+
for assignee in assignees
|
| 966 |
+
]
|
| 967 |
+
}
|
| 968 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 969 |
+
"DELETE", f"{self.issue_url}/assignees", input=post_parameters
|
| 970 |
+
)
|
| 971 |
+
# Only use the assignees attribute, since we call this PR as an issue
|
| 972 |
+
self._useAttributes({"assignees": data["assignees"]})
|
| 973 |
+
|
| 974 |
+
def update_branch(self, expected_head_sha: Opt[str] = NotSet) -> bool:
|
| 975 |
+
"""
|
| 976 |
+
:calls `PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch <https://docs.github.com/en/rest/reference/pulls>`_
|
| 977 |
+
"""
|
| 978 |
+
assert is_optional(expected_head_sha, str), expected_head_sha
|
| 979 |
+
post_parameters = NotSet.remove_unset_items({"expected_head_sha": expected_head_sha})
|
| 980 |
+
status, headers, data = self._requester.requestJson(
|
| 981 |
+
"PUT",
|
| 982 |
+
f"{self.url}/update-branch",
|
| 983 |
+
input=post_parameters,
|
| 984 |
+
headers={"Accept": Consts.updateBranchPreview},
|
| 985 |
+
)
|
| 986 |
+
return status == 202
|
| 987 |
+
|
| 988 |
+
def convert_to_draft(
|
| 989 |
+
self,
|
| 990 |
+
client_mutation_id: Opt[str] = NotSet,
|
| 991 |
+
) -> dict[str, Any]:
|
| 992 |
+
"""
|
| 993 |
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ to convert pull request to draft
|
| 994 |
+
<https://docs.github.com/en/graphql/reference/mutations#convertpullrequesttodraft>
|
| 995 |
+
"""
|
| 996 |
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
| 997 |
+
|
| 998 |
+
# Define the variables
|
| 999 |
+
variables = {
|
| 1000 |
+
"pullRequestId": self.node_id,
|
| 1001 |
+
"clientMutationId": client_mutation_id,
|
| 1002 |
+
}
|
| 1003 |
+
|
| 1004 |
+
# Make the request
|
| 1005 |
+
_, data = self._requester.graphql_named_mutation(
|
| 1006 |
+
mutation_name="convertPullRequestToDraft",
|
| 1007 |
+
mutation_input=NotSet.remove_unset_items(variables),
|
| 1008 |
+
output_schema="clientMutationId pullRequest { isDraft }",
|
| 1009 |
+
)
|
| 1010 |
+
self._useAttributes({"draft": data["pullRequest"]["isDraft"]})
|
| 1011 |
+
return data
|
| 1012 |
+
|
| 1013 |
+
def mark_ready_for_review(
|
| 1014 |
+
self,
|
| 1015 |
+
client_mutation_id: Opt[str] = NotSet,
|
| 1016 |
+
) -> dict[str, Any]:
|
| 1017 |
+
"""
|
| 1018 |
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ to mark pull request ready for review
|
| 1019 |
+
<https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview>
|
| 1020 |
+
"""
|
| 1021 |
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
| 1022 |
+
|
| 1023 |
+
# Define the variables
|
| 1024 |
+
variables = {
|
| 1025 |
+
"pullRequestId": self.node_id,
|
| 1026 |
+
"clientMutationId": client_mutation_id,
|
| 1027 |
+
}
|
| 1028 |
+
|
| 1029 |
+
# Make the request
|
| 1030 |
+
_, data = self._requester.graphql_named_mutation(
|
| 1031 |
+
mutation_name="markPullRequestReadyForReview",
|
| 1032 |
+
mutation_input=NotSet.remove_unset_items(variables),
|
| 1033 |
+
output_schema="clientMutationId pullRequest { isDraft }",
|
| 1034 |
+
)
|
| 1035 |
+
self._useAttributes({"draft": data["pullRequest"]["isDraft"]})
|
| 1036 |
+
return data
|
| 1037 |
+
|
| 1038 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 1039 |
+
if "_links" in attributes: # pragma no branch
|
| 1040 |
+
self.__links = self._makeDictAttribute(attributes["_links"])
|
| 1041 |
+
if "active_lock_reason" in attributes: # pragma no branch
|
| 1042 |
+
self._active_lock_reason = self._makeStringAttribute(attributes["active_lock_reason"])
|
| 1043 |
+
if "additions" in attributes: # pragma no branch
|
| 1044 |
+
self._additions = self._makeIntAttribute(attributes["additions"])
|
| 1045 |
+
if "assignee" in attributes: # pragma no branch
|
| 1046 |
+
self._assignee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
|
| 1047 |
+
if "assignees" in attributes: # pragma no branch
|
| 1048 |
+
self._assignees = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, attributes["assignees"])
|
| 1049 |
+
elif "assignee" in attributes:
|
| 1050 |
+
if attributes["assignee"] is not None:
|
| 1051 |
+
self._assignees = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, [attributes["assignee"]])
|
| 1052 |
+
else:
|
| 1053 |
+
self._assignees = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, [])
|
| 1054 |
+
if "author_association" in attributes: # pragma no branch
|
| 1055 |
+
self._author_association = self._makeStringAttribute(attributes["author_association"])
|
| 1056 |
+
if "auto_merge" in attributes: # pragma no branch
|
| 1057 |
+
self._auto_merge = self._makeDictAttribute(attributes["auto_merge"])
|
| 1058 |
+
if "base" in attributes: # pragma no branch
|
| 1059 |
+
self._base = self._makeClassAttribute(github.PullRequestPart.PullRequestPart, attributes["base"])
|
| 1060 |
+
if "body" in attributes: # pragma no branch
|
| 1061 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 1062 |
+
if "changed_files" in attributes: # pragma no branch
|
| 1063 |
+
self._changed_files = self._makeIntAttribute(attributes["changed_files"])
|
| 1064 |
+
if "closed_at" in attributes: # pragma no branch
|
| 1065 |
+
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
| 1066 |
+
if "comments" in attributes: # pragma no branch
|
| 1067 |
+
self._comments = self._makeIntAttribute(attributes["comments"])
|
| 1068 |
+
if "comments_url" in attributes: # pragma no branch
|
| 1069 |
+
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
| 1070 |
+
if "commits" in attributes: # pragma no branch
|
| 1071 |
+
self._commits = self._makeIntAttribute(attributes["commits"])
|
| 1072 |
+
if "commits_url" in attributes: # pragma no branch
|
| 1073 |
+
self._commits_url = self._makeStringAttribute(attributes["commits_url"])
|
| 1074 |
+
if "created_at" in attributes: # pragma no branch
|
| 1075 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 1076 |
+
if "deletions" in attributes: # pragma no branch
|
| 1077 |
+
self._deletions = self._makeIntAttribute(attributes["deletions"])
|
| 1078 |
+
if "diff_url" in attributes: # pragma no branch
|
| 1079 |
+
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
| 1080 |
+
if "draft" in attributes: # pragma no branch
|
| 1081 |
+
self._draft = self._makeBoolAttribute(attributes["draft"])
|
| 1082 |
+
if "head" in attributes: # pragma no branch
|
| 1083 |
+
self._head = self._makeClassAttribute(github.PullRequestPart.PullRequestPart, attributes["head"])
|
| 1084 |
+
if "html_url" in attributes: # pragma no branch
|
| 1085 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 1086 |
+
if "id" in attributes: # pragma no branch
|
| 1087 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 1088 |
+
if "issue_url" in attributes: # pragma no branch
|
| 1089 |
+
self._issue_url = self._makeStringAttribute(attributes["issue_url"])
|
| 1090 |
+
if "labels" in attributes: # pragma no branch
|
| 1091 |
+
self._labels = self._makeListOfClassesAttribute(github.Label.Label, attributes["labels"])
|
| 1092 |
+
if "locked" in attributes: # pragma no branch
|
| 1093 |
+
self._locked = self._makeBoolAttribute(attributes["locked"])
|
| 1094 |
+
if "maintainer_can_modify" in attributes: # pragma no branch
|
| 1095 |
+
self._maintainer_can_modify = self._makeBoolAttribute(attributes["maintainer_can_modify"])
|
| 1096 |
+
if "merge_commit_sha" in attributes: # pragma no branch
|
| 1097 |
+
self._merge_commit_sha = self._makeStringAttribute(attributes["merge_commit_sha"])
|
| 1098 |
+
if "mergeable" in attributes: # pragma no branch
|
| 1099 |
+
self._mergeable = self._makeBoolAttribute(attributes["mergeable"])
|
| 1100 |
+
if "mergeable_state" in attributes: # pragma no branch
|
| 1101 |
+
self._mergeable_state = self._makeStringAttribute(attributes["mergeable_state"])
|
| 1102 |
+
if "merged" in attributes: # pragma no branch
|
| 1103 |
+
self._merged = self._makeBoolAttribute(attributes["merged"])
|
| 1104 |
+
if "merged_at" in attributes: # pragma no branch
|
| 1105 |
+
self._merged_at = self._makeDatetimeAttribute(attributes["merged_at"])
|
| 1106 |
+
if "merged_by" in attributes: # pragma no branch
|
| 1107 |
+
self._merged_by = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["merged_by"])
|
| 1108 |
+
if "milestone" in attributes: # pragma no branch
|
| 1109 |
+
self._milestone = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
|
| 1110 |
+
if "node_id" in attributes: # pragma no branch
|
| 1111 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 1112 |
+
if "number" in attributes: # pragma no branch
|
| 1113 |
+
self._number = self._makeIntAttribute(attributes["number"])
|
| 1114 |
+
if "patch_url" in attributes: # pragma no branch
|
| 1115 |
+
self._patch_url = self._makeStringAttribute(attributes["patch_url"])
|
| 1116 |
+
if "rebaseable" in attributes: # pragma no branch
|
| 1117 |
+
self._rebaseable = self._makeBoolAttribute(attributes["rebaseable"])
|
| 1118 |
+
if "requested_reviewers" in attributes:
|
| 1119 |
+
self._requested_reviewers = self._makeListOfClassesAttribute(
|
| 1120 |
+
github.NamedUser.NamedUser, attributes["requested_reviewers"]
|
| 1121 |
+
)
|
| 1122 |
+
if "requested_teams" in attributes:
|
| 1123 |
+
self._requested_teams = self._makeListOfClassesAttribute(github.Team.Team, attributes["requested_teams"])
|
| 1124 |
+
if "review_comment_url" in attributes: # pragma no branch
|
| 1125 |
+
self._review_comment_url = self._makeStringAttribute(attributes["review_comment_url"])
|
| 1126 |
+
if "review_comments" in attributes: # pragma no branch
|
| 1127 |
+
self._review_comments = self._makeIntAttribute(attributes["review_comments"])
|
| 1128 |
+
if "review_comments_url" in attributes: # pragma no branch
|
| 1129 |
+
self._review_comments_url = self._makeStringAttribute(attributes["review_comments_url"])
|
| 1130 |
+
if "state" in attributes: # pragma no branch
|
| 1131 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 1132 |
+
if "statuses_url" in attributes: # pragma no branch
|
| 1133 |
+
self._statuses_url = self._makeStringAttribute(attributes["statuses_url"])
|
| 1134 |
+
if "title" in attributes: # pragma no branch
|
| 1135 |
+
self._title = self._makeStringAttribute(attributes["title"])
|
| 1136 |
+
if "updated_at" in attributes: # pragma no branch
|
| 1137 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 1138 |
+
if "url" in attributes: # pragma no branch
|
| 1139 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 1140 |
+
if "user" in attributes: # pragma no branch
|
| 1141 |
+
self._user = self._makeClassAttrib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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
| 7 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 9 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 10 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 11 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 12 |
+
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
| 13 |
+
# Copyright 2018 Jess Morgan <979404+JessMorgan@users.noreply.github.com> #
|
| 14 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
| 16 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 17 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 19 |
+
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
| 20 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 21 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 22 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 23 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 24 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 25 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 26 |
+
# Copyright 2024 Den Stroebel <stroebs@users.noreply.github.com> #
|
| 27 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 28 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 29 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 30 |
+
# #
|
| 31 |
+
# This file is part of PyGithub. #
|
| 32 |
+
# http://pygithub.readthedocs.io/ #
|
| 33 |
+
# #
|
| 34 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 35 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 36 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 37 |
+
# any later version. #
|
| 38 |
+
# #
|
| 39 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 40 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 41 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 42 |
+
# details. #
|
| 43 |
+
# #
|
| 44 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 45 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 46 |
+
# #
|
| 47 |
+
################################################################################
|
| 48 |
+
|
| 49 |
+
from __future__ import annotations
|
| 50 |
+
|
| 51 |
+
from datetime import datetime
|
| 52 |
+
from typing import Any
|
| 53 |
+
|
| 54 |
+
import github.GithubObject
|
| 55 |
+
import github.NamedUser
|
| 56 |
+
import github.Reaction
|
| 57 |
+
from github import Consts
|
| 58 |
+
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
|
| 59 |
+
from github.PaginatedList import PaginatedList
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class PullRequestComment(CompletableGithubObject):
|
| 63 |
+
"""
|
| 64 |
+
This class represents PullRequestComments.
|
| 65 |
+
|
| 66 |
+
The reference can be found here
|
| 67 |
+
https://docs.github.com/en/rest/reference/pulls#review-comments
|
| 68 |
+
|
| 69 |
+
The OpenAPI schema can be found at
|
| 70 |
+
- /components/schemas/pull-request-review-comment
|
| 71 |
+
|
| 72 |
+
"""
|
| 73 |
+
|
| 74 |
+
def _initAttributes(self) -> None:
|
| 75 |
+
self.__links: Attribute[dict[str, Any]] = NotSet
|
| 76 |
+
self._author_association: Attribute[str] = NotSet
|
| 77 |
+
self._body: Attribute[str] = NotSet
|
| 78 |
+
self._body_html: Attribute[str] = NotSet
|
| 79 |
+
self._body_text: Attribute[str] = NotSet
|
| 80 |
+
self._commit_id: Attribute[str] = NotSet
|
| 81 |
+
self._created_at: Attribute[datetime] = NotSet
|
| 82 |
+
self._diff_hunk: Attribute[str] = NotSet
|
| 83 |
+
self._html_url: Attribute[str] = NotSet
|
| 84 |
+
self._id: Attribute[int] = NotSet
|
| 85 |
+
self._in_reply_to_id: Attribute[int] = NotSet
|
| 86 |
+
self._line: Attribute[int] = NotSet
|
| 87 |
+
self._node_id: Attribute[str] = NotSet
|
| 88 |
+
self._original_commit_id: Attribute[str] = NotSet
|
| 89 |
+
self._original_line: Attribute[int] = NotSet
|
| 90 |
+
self._original_position: Attribute[int] = NotSet
|
| 91 |
+
self._original_start_line: Attribute[int] = NotSet
|
| 92 |
+
self._path: Attribute[str] = NotSet
|
| 93 |
+
self._position: Attribute[int] = NotSet
|
| 94 |
+
self._pull_request_review_id: Attribute[int] = NotSet
|
| 95 |
+
self._pull_request_url: Attribute[str] = NotSet
|
| 96 |
+
self._reactions: Attribute[dict[str, Any]] = NotSet
|
| 97 |
+
self._side: Attribute[str] = NotSet
|
| 98 |
+
self._start_line: Attribute[int] = NotSet
|
| 99 |
+
self._start_side: Attribute[str] = NotSet
|
| 100 |
+
self._subject_type: Attribute[str] = NotSet
|
| 101 |
+
self._updated_at: Attribute[datetime] = NotSet
|
| 102 |
+
self._url: Attribute[str] = NotSet
|
| 103 |
+
self._user: Attribute[github.NamedUser.NamedUser] = NotSet
|
| 104 |
+
|
| 105 |
+
def __repr__(self) -> str:
|
| 106 |
+
return self.get__repr__({"id": self._id.value, "user": self._user.value})
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def _links(self) -> dict[str, Any]:
|
| 110 |
+
self._completeIfNotSet(self.__links)
|
| 111 |
+
return self.__links.value
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def author_association(self) -> str:
|
| 115 |
+
self._completeIfNotSet(self._author_association)
|
| 116 |
+
return self._author_association.value
|
| 117 |
+
|
| 118 |
+
@property
|
| 119 |
+
def body(self) -> str:
|
| 120 |
+
self._completeIfNotSet(self._body)
|
| 121 |
+
return self._body.value
|
| 122 |
+
|
| 123 |
+
@property
|
| 124 |
+
def body_html(self) -> str:
|
| 125 |
+
self._completeIfNotSet(self._body_html)
|
| 126 |
+
return self._body_html.value
|
| 127 |
+
|
| 128 |
+
@property
|
| 129 |
+
def body_text(self) -> str:
|
| 130 |
+
self._completeIfNotSet(self._body_text)
|
| 131 |
+
return self._body_text.value
|
| 132 |
+
|
| 133 |
+
@property
|
| 134 |
+
def commit_id(self) -> str:
|
| 135 |
+
self._completeIfNotSet(self._commit_id)
|
| 136 |
+
return self._commit_id.value
|
| 137 |
+
|
| 138 |
+
@property
|
| 139 |
+
def created_at(self) -> datetime:
|
| 140 |
+
self._completeIfNotSet(self._created_at)
|
| 141 |
+
return self._created_at.value
|
| 142 |
+
|
| 143 |
+
@property
|
| 144 |
+
def diff_hunk(self) -> str:
|
| 145 |
+
self._completeIfNotSet(self._diff_hunk)
|
| 146 |
+
return self._diff_hunk.value
|
| 147 |
+
|
| 148 |
+
@property
|
| 149 |
+
def html_url(self) -> str:
|
| 150 |
+
self._completeIfNotSet(self._html_url)
|
| 151 |
+
return self._html_url.value
|
| 152 |
+
|
| 153 |
+
@property
|
| 154 |
+
def id(self) -> int:
|
| 155 |
+
self._completeIfNotSet(self._id)
|
| 156 |
+
return self._id.value
|
| 157 |
+
|
| 158 |
+
@property
|
| 159 |
+
def in_reply_to_id(self) -> int:
|
| 160 |
+
self._completeIfNotSet(self._in_reply_to_id)
|
| 161 |
+
return self._in_reply_to_id.value
|
| 162 |
+
|
| 163 |
+
@property
|
| 164 |
+
def line(self) -> int:
|
| 165 |
+
self._completeIfNotSet(self._line)
|
| 166 |
+
return self._line.value
|
| 167 |
+
|
| 168 |
+
@property
|
| 169 |
+
def node_id(self) -> str:
|
| 170 |
+
self._completeIfNotSet(self._node_id)
|
| 171 |
+
return self._node_id.value
|
| 172 |
+
|
| 173 |
+
@property
|
| 174 |
+
def original_commit_id(self) -> str:
|
| 175 |
+
self._completeIfNotSet(self._original_commit_id)
|
| 176 |
+
return self._original_commit_id.value
|
| 177 |
+
|
| 178 |
+
@property
|
| 179 |
+
def original_line(self) -> int:
|
| 180 |
+
self._completeIfNotSet(self._original_line)
|
| 181 |
+
return self._original_line.value
|
| 182 |
+
|
| 183 |
+
@property
|
| 184 |
+
def original_position(self) -> int:
|
| 185 |
+
self._completeIfNotSet(self._original_position)
|
| 186 |
+
return self._original_position.value
|
| 187 |
+
|
| 188 |
+
@property
|
| 189 |
+
def original_start_line(self) -> int:
|
| 190 |
+
self._completeIfNotSet(self._original_start_line)
|
| 191 |
+
return self._original_start_line.value
|
| 192 |
+
|
| 193 |
+
@property
|
| 194 |
+
def path(self) -> str:
|
| 195 |
+
self._completeIfNotSet(self._path)
|
| 196 |
+
return self._path.value
|
| 197 |
+
|
| 198 |
+
@property
|
| 199 |
+
def position(self) -> int:
|
| 200 |
+
self._completeIfNotSet(self._position)
|
| 201 |
+
return self._position.value
|
| 202 |
+
|
| 203 |
+
@property
|
| 204 |
+
def pull_request_review_id(self) -> int:
|
| 205 |
+
self._completeIfNotSet(self._pull_request_review_id)
|
| 206 |
+
return self._pull_request_review_id.value
|
| 207 |
+
|
| 208 |
+
@property
|
| 209 |
+
def pull_request_url(self) -> str:
|
| 210 |
+
self._completeIfNotSet(self._pull_request_url)
|
| 211 |
+
return self._pull_request_url.value
|
| 212 |
+
|
| 213 |
+
@property
|
| 214 |
+
def reactions(self) -> dict[str, Any]:
|
| 215 |
+
self._completeIfNotSet(self._reactions)
|
| 216 |
+
return self._reactions.value
|
| 217 |
+
|
| 218 |
+
@property
|
| 219 |
+
def side(self) -> str:
|
| 220 |
+
self._completeIfNotSet(self._side)
|
| 221 |
+
return self._side.value
|
| 222 |
+
|
| 223 |
+
@property
|
| 224 |
+
def start_line(self) -> int:
|
| 225 |
+
self._completeIfNotSet(self._start_line)
|
| 226 |
+
return self._start_line.value
|
| 227 |
+
|
| 228 |
+
@property
|
| 229 |
+
def start_side(self) -> str:
|
| 230 |
+
self._completeIfNotSet(self._start_side)
|
| 231 |
+
return self._start_side.value
|
| 232 |
+
|
| 233 |
+
@property
|
| 234 |
+
def subject_type(self) -> str:
|
| 235 |
+
self._completeIfNotSet(self._subject_type)
|
| 236 |
+
return self._subject_type.value
|
| 237 |
+
|
| 238 |
+
@property
|
| 239 |
+
def updated_at(self) -> datetime:
|
| 240 |
+
self._completeIfNotSet(self._updated_at)
|
| 241 |
+
return self._updated_at.value
|
| 242 |
+
|
| 243 |
+
@property
|
| 244 |
+
def url(self) -> str:
|
| 245 |
+
self._completeIfNotSet(self._url)
|
| 246 |
+
return self._url.value
|
| 247 |
+
|
| 248 |
+
@property
|
| 249 |
+
def user(self) -> github.NamedUser.NamedUser:
|
| 250 |
+
self._completeIfNotSet(self._user)
|
| 251 |
+
return self._user.value
|
| 252 |
+
|
| 253 |
+
def delete(self) -> None:
|
| 254 |
+
"""
|
| 255 |
+
:calls: `DELETE /repos/{owner}/{repo}/pulls/comments/{number} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 256 |
+
:rtype: None
|
| 257 |
+
"""
|
| 258 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
|
| 259 |
+
|
| 260 |
+
def edit(self, body: str) -> None:
|
| 261 |
+
"""
|
| 262 |
+
:calls: `PATCH /repos/{owner}/{repo}/pulls/comments/{number} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
| 263 |
+
:param body: string
|
| 264 |
+
:rtype: None
|
| 265 |
+
"""
|
| 266 |
+
assert isinstance(body, str), body
|
| 267 |
+
post_parameters = {
|
| 268 |
+
"body": body,
|
| 269 |
+
}
|
| 270 |
+
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
|
| 271 |
+
self._useAttributes(data)
|
| 272 |
+
|
| 273 |
+
def get_reactions(self) -> PaginatedList[github.Reaction.Reaction]:
|
| 274 |
+
"""
|
| 275 |
+
:calls: `GET /repos/{owner}/{repo}/pulls/comments/{number}/reactions
|
| 276 |
+
<https://docs.github.com/en/rest/reference/reactions#list-reactions-for-a-pull-request-review-comment>`_
|
| 277 |
+
:return: :class: :class:`github.PaginatedList.PaginatedList` of :class:`github.Reaction.Reaction`
|
| 278 |
+
"""
|
| 279 |
+
return PaginatedList(
|
| 280 |
+
github.Reaction.Reaction,
|
| 281 |
+
self._requester,
|
| 282 |
+
f"{self.url}/reactions",
|
| 283 |
+
None,
|
| 284 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 285 |
+
)
|
| 286 |
+
|
| 287 |
+
def create_reaction(self, reaction_type: str) -> github.Reaction.Reaction:
|
| 288 |
+
"""
|
| 289 |
+
:calls: `POST /repos/{owner}/{repo}/pulls/comments/{number}/reactions
|
| 290 |
+
<https://docs.github.com/en/rest/reference/reactions#create-reaction-for-a-pull-request-review-comment>`_
|
| 291 |
+
:param reaction_type: string
|
| 292 |
+
:rtype: :class:`github.Reaction.Reaction`
|
| 293 |
+
"""
|
| 294 |
+
assert isinstance(reaction_type, str), reaction_type
|
| 295 |
+
post_parameters = {
|
| 296 |
+
"content": reaction_type,
|
| 297 |
+
}
|
| 298 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 299 |
+
"POST",
|
| 300 |
+
f"{self.url}/reactions",
|
| 301 |
+
input=post_parameters,
|
| 302 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 303 |
+
)
|
| 304 |
+
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
| 305 |
+
|
| 306 |
+
def delete_reaction(self, reaction_id: int) -> bool:
|
| 307 |
+
"""
|
| 308 |
+
:calls: `DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
|
| 309 |
+
<https://docs.github.com/en/rest/reference/reactions#delete-a-pull-request-comment-reaction>`_
|
| 310 |
+
:param reaction_id: integer
|
| 311 |
+
:rtype: bool
|
| 312 |
+
"""
|
| 313 |
+
assert isinstance(reaction_id, int), reaction_id
|
| 314 |
+
status, _, _ = self._requester.requestJson(
|
| 315 |
+
"DELETE",
|
| 316 |
+
f"{self.url}/reactions/{reaction_id}",
|
| 317 |
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
| 318 |
+
)
|
| 319 |
+
return status == 204
|
| 320 |
+
|
| 321 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 322 |
+
if "_links" in attributes: # pragma no branch
|
| 323 |
+
self.__links = self._makeDictAttribute(attributes["_links"])
|
| 324 |
+
if "author_association" in attributes: # pragma no branch
|
| 325 |
+
self._author_association = self._makeStringAttribute(attributes["author_association"])
|
| 326 |
+
if "body" in attributes: # pragma no branch
|
| 327 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 328 |
+
if "body_html" in attributes: # pragma no branch
|
| 329 |
+
self._body_html = self._makeStringAttribute(attributes["body_html"])
|
| 330 |
+
if "body_text" in attributes: # pragma no branch
|
| 331 |
+
self._body_text = self._makeStringAttribute(attributes["body_text"])
|
| 332 |
+
if "commit_id" in attributes: # pragma no branch
|
| 333 |
+
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
|
| 334 |
+
if "created_at" in attributes: # pragma no branch
|
| 335 |
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
| 336 |
+
if "diff_hunk" in attributes: # pragma no branch
|
| 337 |
+
self._diff_hunk = self._makeStringAttribute(attributes["diff_hunk"])
|
| 338 |
+
if "html_url" in attributes: # pragma no branch
|
| 339 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 340 |
+
if "id" in attributes: # pragma no branch
|
| 341 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 342 |
+
if "in_reply_to_id" in attributes: # pragma no branch
|
| 343 |
+
self._in_reply_to_id = self._makeIntAttribute(attributes["in_reply_to_id"])
|
| 344 |
+
if "line" in attributes: # pragma no branch
|
| 345 |
+
self._line = self._makeIntAttribute(attributes["line"])
|
| 346 |
+
if "node_id" in attributes: # pragma no branch
|
| 347 |
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
| 348 |
+
if "original_commit_id" in attributes: # pragma no branch
|
| 349 |
+
self._original_commit_id = self._makeStringAttribute(attributes["original_commit_id"])
|
| 350 |
+
if "original_line" in attributes: # pragma no branch
|
| 351 |
+
self._original_line = self._makeIntAttribute(attributes["original_line"])
|
| 352 |
+
if "original_position" in attributes: # pragma no branch
|
| 353 |
+
self._original_position = self._makeIntAttribute(attributes["original_position"])
|
| 354 |
+
if "original_start_line" in attributes: # pragma no branch
|
| 355 |
+
self._original_start_line = self._makeIntAttribute(attributes["original_start_line"])
|
| 356 |
+
if "path" in attributes: # pragma no branch
|
| 357 |
+
self._path = self._makeStringAttribute(attributes["path"])
|
| 358 |
+
if "position" in attributes: # pragma no branch
|
| 359 |
+
self._position = self._makeIntAttribute(attributes["position"])
|
| 360 |
+
if "pull_request_review_id" in attributes: # pragma no branch
|
| 361 |
+
self._pull_request_review_id = self._makeIntAttribute(attributes["pull_request_review_id"])
|
| 362 |
+
if "pull_request_url" in attributes: # pragma no branch
|
| 363 |
+
self._pull_request_url = self._makeStringAttribute(attributes["pull_request_url"])
|
| 364 |
+
if "reactions" in attributes: # pragma no branch
|
| 365 |
+
self._reactions = self._makeDictAttribute(attributes["reactions"])
|
| 366 |
+
if "side" in attributes: # pragma no branch
|
| 367 |
+
self._side = self._makeStringAttribute(attributes["side"])
|
| 368 |
+
if "start_line" in attributes: # pragma no branch
|
| 369 |
+
self._start_line = self._makeIntAttribute(attributes["start_line"])
|
| 370 |
+
if "start_side" in attributes: # pragma no branch
|
| 371 |
+
self._start_side = self._makeStringAttribute(attributes["start_side"])
|
| 372 |
+
if "subject_type" in attributes: # pragma no branch
|
| 373 |
+
self._subject_type = self._makeStringAttribute(attributes["subject_type"])
|
| 374 |
+
if "updated_at" in attributes: # pragma no branch
|
| 375 |
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
| 376 |
+
if "url" in attributes: # pragma no branch
|
| 377 |
+
self._url = self._makeStringAttribute(attributes["url"])
|
| 378 |
+
if "user" in attributes: # pragma no branch
|
| 379 |
+
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
python_embeded/Lib/site-packages/github/PullRequestMergeStatus.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
| 8 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 9 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 10 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 11 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 13 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 14 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
| 17 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 20 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 22 |
+
# #
|
| 23 |
+
# This file is part of PyGithub. #
|
| 24 |
+
# http://pygithub.readthedocs.io/ #
|
| 25 |
+
# #
|
| 26 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 27 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 28 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 29 |
+
# any later version. #
|
| 30 |
+
# #
|
| 31 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 32 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 33 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 34 |
+
# details. #
|
| 35 |
+
# #
|
| 36 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 37 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 38 |
+
# #
|
| 39 |
+
################################################################################
|
| 40 |
+
|
| 41 |
+
from typing import Any, Dict
|
| 42 |
+
|
| 43 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PullRequestMergeStatus(NonCompletableGithubObject):
|
| 47 |
+
"""
|
| 48 |
+
This class represents PullRequestMergeStatuses.
|
| 49 |
+
|
| 50 |
+
The reference can be found here
|
| 51 |
+
https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged
|
| 52 |
+
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
def _initAttributes(self) -> None:
|
| 56 |
+
self._merged: Attribute[bool] = NotSet
|
| 57 |
+
self._message: Attribute[str] = NotSet
|
| 58 |
+
self._sha: Attribute[str] = NotSet
|
| 59 |
+
|
| 60 |
+
def __repr__(self) -> str:
|
| 61 |
+
return self.get__repr__({"sha": self._sha.value, "merged": self._merged.value})
|
| 62 |
+
|
| 63 |
+
@property
|
| 64 |
+
def merged(self) -> bool:
|
| 65 |
+
return self._merged.value
|
| 66 |
+
|
| 67 |
+
@property
|
| 68 |
+
def message(self) -> str:
|
| 69 |
+
return self._message.value
|
| 70 |
+
|
| 71 |
+
@property
|
| 72 |
+
def sha(self) -> str:
|
| 73 |
+
return self._sha.value
|
| 74 |
+
|
| 75 |
+
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
|
| 76 |
+
if "merged" in attributes: # pragma no branch
|
| 77 |
+
self._merged = self._makeBoolAttribute(attributes["merged"])
|
| 78 |
+
if "message" in attributes: # pragma no branch
|
| 79 |
+
self._message = self._makeStringAttribute(attributes["message"])
|
| 80 |
+
if "sha" in attributes: # pragma no branch
|
| 81 |
+
self._sha = self._makeStringAttribute(attributes["sha"])
|
python_embeded/Lib/site-packages/github/PullRequestPart.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 11 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 12 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 13 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 15 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 16 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 17 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 18 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 19 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 20 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# #
|
| 22 |
+
# This file is part of PyGithub. #
|
| 23 |
+
# http://pygithub.readthedocs.io/ #
|
| 24 |
+
# #
|
| 25 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 26 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 27 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 28 |
+
# any later version. #
|
| 29 |
+
# #
|
| 30 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 31 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 32 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 33 |
+
# details. #
|
| 34 |
+
# #
|
| 35 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 36 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 37 |
+
# #
|
| 38 |
+
################################################################################
|
| 39 |
+
|
| 40 |
+
from __future__ import annotations
|
| 41 |
+
|
| 42 |
+
from typing import TYPE_CHECKING, Any
|
| 43 |
+
|
| 44 |
+
import github.NamedUser
|
| 45 |
+
import github.Repository
|
| 46 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 47 |
+
|
| 48 |
+
if TYPE_CHECKING:
|
| 49 |
+
from github.NamedUser import NamedUser
|
| 50 |
+
from github.Repository import Repository
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class PullRequestPart(NonCompletableGithubObject):
|
| 54 |
+
"""
|
| 55 |
+
This class represents PullRequestParts.
|
| 56 |
+
|
| 57 |
+
The OpenAPI schema can be found at
|
| 58 |
+
- /components/schemas/pull-request-minimal/properties/base
|
| 59 |
+
- /components/schemas/pull-request-minimal/properties/head
|
| 60 |
+
- /components/schemas/pull-request-simple/properties/base
|
| 61 |
+
- /components/schemas/pull-request-simple/properties/head
|
| 62 |
+
- /components/schemas/pull-request/properties/base
|
| 63 |
+
- /components/schemas/pull-request/properties/head
|
| 64 |
+
|
| 65 |
+
"""
|
| 66 |
+
|
| 67 |
+
def _initAttributes(self) -> None:
|
| 68 |
+
self._label: Attribute[str] = NotSet
|
| 69 |
+
self._ref: Attribute[str] = NotSet
|
| 70 |
+
self._repo: Attribute[Repository] = NotSet
|
| 71 |
+
self._sha: Attribute[str] = NotSet
|
| 72 |
+
self._user: Attribute[NamedUser] = NotSet
|
| 73 |
+
|
| 74 |
+
def __repr__(self) -> str:
|
| 75 |
+
return self.get__repr__({"sha": self._sha.value})
|
| 76 |
+
|
| 77 |
+
@property
|
| 78 |
+
def label(self) -> str:
|
| 79 |
+
return self._label.value
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def ref(self) -> str:
|
| 83 |
+
return self._ref.value
|
| 84 |
+
|
| 85 |
+
@property
|
| 86 |
+
def repo(self) -> Repository:
|
| 87 |
+
return self._repo.value
|
| 88 |
+
|
| 89 |
+
@property
|
| 90 |
+
def sha(self) -> str:
|
| 91 |
+
return self._sha.value
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def user(self) -> NamedUser:
|
| 95 |
+
return self._user.value
|
| 96 |
+
|
| 97 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 98 |
+
if "label" in attributes: # pragma no branch
|
| 99 |
+
self._label = self._makeStringAttribute(attributes["label"])
|
| 100 |
+
if "ref" in attributes: # pragma no branch
|
| 101 |
+
self._ref = self._makeStringAttribute(attributes["ref"])
|
| 102 |
+
if "repo" in attributes: # pragma no branch
|
| 103 |
+
self._repo = self._makeClassAttribute(github.Repository.Repository, attributes["repo"])
|
| 104 |
+
if "sha" in attributes: # pragma no branch
|
| 105 |
+
self._sha = self._makeStringAttribute(attributes["sha"])
|
| 106 |
+
if "user" in attributes: # pragma no branch
|
| 107 |
+
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
python_embeded/Lib/site-packages/github/PullRequestReview.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
############################ Copyrights and license ############################
|
| 2 |
+
# #
|
| 3 |
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 4 |
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
| 5 |
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
| 6 |
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 7 |
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
| 8 |
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
| 9 |
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
| 10 |
+
# Copyright 2017 Aaron Levine <allevin@sandia.gov> #
|
| 11 |
+
# Copyright 2017 Mike Miller <github@mikeage.net> #
|
| 12 |
+
# Copyright 2018 Darragh Bailey <daragh.bailey@gmail.com> #
|
| 13 |
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
| 14 |
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
| 15 |
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
| 16 |
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
| 17 |
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
| 18 |
+
# Copyright 2021 Claire Johns <42869556+johnsc1@users.noreply.github.com> #
|
| 19 |
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
| 20 |
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
| 21 |
+
# Copyright 2023 Gael Colas <gael.colas@plus.ai> #
|
| 22 |
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 23 |
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
| 24 |
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
| 25 |
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
| 26 |
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
| 27 |
+
# #
|
| 28 |
+
# This file is part of PyGithub. #
|
| 29 |
+
# http://pygithub.readthedocs.io/ #
|
| 30 |
+
# #
|
| 31 |
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
| 32 |
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
| 33 |
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
| 34 |
+
# any later version. #
|
| 35 |
+
# #
|
| 36 |
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
| 37 |
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
| 38 |
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
| 39 |
+
# details. #
|
| 40 |
+
# #
|
| 41 |
+
# You should have received a copy of the GNU Lesser General Public License #
|
| 42 |
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
| 43 |
+
# #
|
| 44 |
+
################################################################################
|
| 45 |
+
|
| 46 |
+
from __future__ import annotations
|
| 47 |
+
|
| 48 |
+
from datetime import datetime
|
| 49 |
+
from typing import Any
|
| 50 |
+
|
| 51 |
+
import github.GithubObject
|
| 52 |
+
import github.NamedUser
|
| 53 |
+
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class PullRequestReview(NonCompletableGithubObject):
|
| 57 |
+
"""
|
| 58 |
+
This class represents PullRequestReviews.
|
| 59 |
+
|
| 60 |
+
The reference can be found here
|
| 61 |
+
https://docs.github.com/en/rest/reference/pulls#reviews
|
| 62 |
+
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
def _initAttributes(self) -> None:
|
| 66 |
+
self._body: Attribute[str] = NotSet
|
| 67 |
+
self._commit_id: Attribute[str] = NotSet
|
| 68 |
+
self._html_url: Attribute[str] = NotSet
|
| 69 |
+
self._id: Attribute[int] = NotSet
|
| 70 |
+
self._pull_request_url: Attribute[str] = NotSet
|
| 71 |
+
self._state: Attribute[str] = NotSet
|
| 72 |
+
self._submitted_at: Attribute[datetime] = NotSet
|
| 73 |
+
self._user: Attribute[github.NamedUser.NamedUser] = NotSet
|
| 74 |
+
|
| 75 |
+
def __repr__(self) -> str:
|
| 76 |
+
return self.get__repr__({"id": self._id.value, "user": self._user.value})
|
| 77 |
+
|
| 78 |
+
@property
|
| 79 |
+
def body(self) -> str:
|
| 80 |
+
return self._body.value
|
| 81 |
+
|
| 82 |
+
@property
|
| 83 |
+
def commit_id(self) -> str:
|
| 84 |
+
return self._commit_id.value
|
| 85 |
+
|
| 86 |
+
@property
|
| 87 |
+
def html_url(self) -> str:
|
| 88 |
+
return self._html_url.value
|
| 89 |
+
|
| 90 |
+
@property
|
| 91 |
+
def id(self) -> int:
|
| 92 |
+
return self._id.value
|
| 93 |
+
|
| 94 |
+
@property
|
| 95 |
+
def pull_request_url(self) -> str:
|
| 96 |
+
return self._pull_request_url.value
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def state(self) -> str:
|
| 100 |
+
return self._state.value
|
| 101 |
+
|
| 102 |
+
@property
|
| 103 |
+
def submitted_at(self) -> datetime:
|
| 104 |
+
return self._submitted_at.value
|
| 105 |
+
|
| 106 |
+
@property
|
| 107 |
+
def user(self) -> github.NamedUser.NamedUser:
|
| 108 |
+
return self._user.value
|
| 109 |
+
|
| 110 |
+
def dismiss(self, message: str) -> None:
|
| 111 |
+
"""
|
| 112 |
+
:calls: `PUT /repos/{owner}/{repo}/pulls/{number}/reviews/{review_id}/dismissals <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
| 113 |
+
"""
|
| 114 |
+
post_parameters = {"message": message}
|
| 115 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 116 |
+
"PUT",
|
| 117 |
+
f"{self.pull_request_url}/reviews/{self.id}/dismissals",
|
| 118 |
+
input=post_parameters,
|
| 119 |
+
)
|
| 120 |
+
self._useAttributes(data)
|
| 121 |
+
|
| 122 |
+
def delete(self) -> None:
|
| 123 |
+
"""
|
| 124 |
+
:calls: `DELETE /repos/:owner/:repo/pulls/:number/reviews/:review_id <https://developer.github.com/v3/pulls/reviews/>`_
|
| 125 |
+
"""
|
| 126 |
+
headers, data = self._requester.requestJsonAndCheck("DELETE", f"{self.pull_request_url}/reviews/{self.id}")
|
| 127 |
+
|
| 128 |
+
def edit(self, body: str) -> None:
|
| 129 |
+
"""
|
| 130 |
+
:calls: `PUT /repos/{owner}/{repo}/pulls/{number}/reviews/{review_id}
|
| 131 |
+
<https://docs.github.com/en/rest/pulls/reviews#update-a-review-for-a-pull-request>`_
|
| 132 |
+
"""
|
| 133 |
+
assert isinstance(body, str), body
|
| 134 |
+
post_parameters = {
|
| 135 |
+
"body": body,
|
| 136 |
+
}
|
| 137 |
+
headers, data = self._requester.requestJsonAndCheck(
|
| 138 |
+
"PUT",
|
| 139 |
+
f"{self.pull_request_url}/reviews/{self.id}",
|
| 140 |
+
input=post_parameters,
|
| 141 |
+
)
|
| 142 |
+
self._useAttributes(data)
|
| 143 |
+
|
| 144 |
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
| 145 |
+
if "body" in attributes: # pragma no branch
|
| 146 |
+
self._body = self._makeStringAttribute(attributes["body"])
|
| 147 |
+
if "commit_id" in attributes: # pragma no branch
|
| 148 |
+
self._commit_id = self._makeStringAttribute(attributes["commit_id"])
|
| 149 |
+
if "html_url" in attributes: # pragma no branch
|
| 150 |
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
| 151 |
+
if "id" in attributes: # pragma no branch
|
| 152 |
+
self._id = self._makeIntAttribute(attributes["id"])
|
| 153 |
+
if "pull_request_url" in attributes: # pragma no branch
|
| 154 |
+
self._pull_request_url = self._makeStringAttribute(attributes["pull_request_url"])
|
| 155 |
+
if "state" in attributes: # pragma no branch
|
| 156 |
+
self._state = self._makeStringAttribute(attributes["state"])
|
| 157 |
+
if "submitted_at" in attributes: # pragma no branch
|
| 158 |
+
self._submitted_at = self._makeDatetimeAttribute(attributes["submitted_at"])
|
| 159 |
+
if "user" in attributes: # pragma no branch
|
| 160 |
+
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|