Repository: PyGithub/PyGithub

Issue:
feat: add allow_forking to Repository
Adds to the `allow_forking` attribute to a `Repository`: https://docs.github.com/en/rest/repos/repos#update-a-repository
> **allow_forking** boolean
> Either true to allow private forks, or false to prevent private forks.

This attribute can be modified via `edit` (on a private repository):
```py
>>> g.get_repo("<test repo>").allow_forking
True
>>> g.get_repo("<test repo>").edit(allow_forking=False)
>>> g.get_repo("<test repo>").allow_forking
False
>>> g.get_repo("<test repo>").edit(allow_forking=True)
>>> g.get_repo("<test repo>").allow_forking
True
```


Discussion:

Resolving patch:
diff --git a/github/Repository.py b/github/Repository.py
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -158,6 +158,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
     def __repr__(self):
         return self.get__repr__({"full_name": self._full_name.value})
 
+    @property
+    def allow_forking(self):
+        """
+        :type: bool
+        """
+        self._completeIfNotSet(self._allow_forking)
+        return self._allow_forking.value
+
     @property
     def allow_merge_commit(self):
         """
@@ -1552,6 +1560,7 @@ def edit(
         has_wiki=github.GithubObject.NotSet,
         has_downloads=github.GithubObject.NotSet,
         default_branch=github.GithubObject.NotSet,
+        allow_forking=github.GithubObject.NotSet,
         allow_squash_merge=github.GithubObject.NotSet,
         allow_merge_commit=github.GithubObject.NotSet,
         allow_rebase_merge=github.GithubObject.NotSet,
@@ -1603,6 +1612,9 @@ def edit(
         assert default_branch is github.GithubObject.NotSet or isinstance(
             default_branch, str
         ), default_branch
+        assert allow_forking is github.GithubObject.NotSet or isinstance(
+            allow_forking, bool
+        ), allow_forking
         assert allow_squash_merge is github.GithubObject.NotSet or isinstance(
             allow_squash_merge, bool
         ), allow_squash_merge
@@ -1639,6 +1651,8 @@ def edit(
             post_parameters["default_branch"] = default_branch
         if allow_squash_merge is not github.GithubObject.NotSet:
             post_parameters["allow_squash_merge"] = allow_squash_merge
+        if allow_forking is not github.GithubObject.NotSet:
+            post_parameters["allow_forking"] = allow_forking
         if allow_merge_commit is not github.GithubObject.NotSet:
             post_parameters["allow_merge_commit"] = allow_merge_commit
         if allow_rebase_merge is not github.GithubObject.NotSet:
@@ -3787,6 +3801,7 @@ def get_codescan_alerts(self):
         )
 
     def _initAttributes(self):
+        self._allow_forking = github.GithubObject.NotSet
         self._allow_merge_commit = github.GithubObject.NotSet
         self._allow_rebase_merge = github.GithubObject.NotSet
         self._allow_squash_merge = github.GithubObject.NotSet
@@ -3873,6 +3888,8 @@ def _initAttributes(self):
         self._watchers_count = github.GithubObject.NotSet
 
     def _useAttributes(self, attributes):
+        if "allow_forking" in attributes:  # pragma no branch
+            self._allow_forking = self._makeBoolAttribute(attributes["allow_forking"])
         if "allow_merge_commit" in attributes:  # pragma no branch
             self._allow_merge_commit = self._makeBoolAttribute(
                 attributes["allow_merge_commit"]


Test patch:
diff --git a/tests/ReplayData/Repository.testEditWithAllArguments.txt b/tests/ReplayData/Repository.testEditWithAllArguments.txt
--- a/tests/ReplayData/Repository.testEditWithAllArguments.txt
+++ b/tests/ReplayData/Repository.testEditWithAllArguments.txt
@@ -4,10 +4,10 @@ api.github.com
 None
 /repos/jacquev6/PyGithub
 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
-{"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "private": true, "description": "Description edited by PyGithub", "has_projects": false, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
+{"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "private": true, "description": "Description edited by PyGithub", "has_projects": false, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
 200
 [('status', '200 OK'), ('x-ratelimit-remaining', '4953'), ('content-length', '1109'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"749313ec2d171323deb61f9f4c85e84f"'), ('date', 'Sat, 26 May 2012 11:22:13 GMT'), ('content-type', 'application/json; charset=utf-8')]
-{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "has_projects": false, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
+{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "has_projects": false, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
 
 https
 PATCH
diff --git a/tests/Repository.py b/tests/Repository.py
--- a/tests/Repository.py
+++ b/tests/Repository.py
@@ -134,6 +134,7 @@ def testEditWithAllArguments(self):
             has_projects=False,
             has_wiki=False,
             has_downloads=True,
+            allow_forking=True,
             allow_squash_merge=True,
             allow_merge_commit=True,
             allow_rebase_merge=True,
@@ -149,6 +150,7 @@ def testEditWithAllArguments(self):
         self.assertFalse(self.repo.has_projects)
         self.assertFalse(self.repo.has_wiki)
         self.assertTrue(self.repo.has_downloads)
+        self.assertTrue(self.repo.allow_forking)
         self.assertTrue(self.repo.allow_squash_merge)
         self.assertTrue(self.repo.allow_merge_commit)
         self.assertTrue(self.repo.allow_rebase_merge)