prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Bug in repr(PublicKey)
  hi there.
  
  there is a bug in "repo.get_public_key".
  
  i found this bug by trying to use "repo.create_secret", which failed because of this issue
  
  ```
  repo.get_public_key()
  Traceback (most recent call last):
    File "<input>", line 1, in <module>
    File "/Users/sschultchen/PycharmProjects/IAC_Main/venv/lib/python3.9/site-packages/github/PublicKey.py", line 55, in __repr__
      return self.get__repr__({"key_id": self._key_id.value, "key": self._key.value})
    File "/Users/sschultchen/PycharmProjects/IAC_Main/venv/lib/python3.9/site-packages/github/GithubObject.py", line 62, in value
      raise GithubException.BadAttributeException(
  github.GithubException.BadAttributeException: (1, <class 'str'>, None)
  ```
  
  i guess the reason for this might be that the pygithub implementation assumes that "key_id" is a string, but it actually is a integer.
  
  at least, the github api gives me an integer, and not a string for this attribute.
  
  </issue>
  <code>
  [start of github/PublicKey.py]
  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 #                                                                              #
  13 # This file is part of PyGithub.                                               #
  14 # http://pygithub.readthedocs.io/                                              #
  15 #                                                                              #
  16 # PyGithub is free software: you can redistribute it and/or modify it under    #
  17 # the terms of the GNU Lesser General Public License as published by the Free  #
  18 # Software Foundation, either version 3 of the License, or (at your option)    #
  19 # any later version.                                                           #
  20 #                                                                              #
  21 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #
  22 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #
  23 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
  24 # details.                                                                     #
  25 #                                                                              #
  26 # You should have received a copy of the GNU Lesser General Public License     #
  27 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #
  28 #                                                                              #
  29 ################################################################################
  30 
  31 # https://docs.github.com/en/rest/reference/actions#example-encrypting-a-secret-using-python
  32 from base64 import b64encode
  33 
  34 from nacl import encoding, public
  35 
  36 import github.GithubObject
  37 
  38 
  39 def encrypt(public_key: str, secret_value: str) -> str:
  40     """Encrypt a Unicode string using the public key."""
  41     public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
  42     sealed_box = public.SealedBox(public_key)
  43     encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
  44     return b64encode(encrypted).decode("utf-8")
  45 
  46 
  47 class PublicKey(github.GithubObject.CompletableGithubObject):
  48     """
  49     This class represents either an organization public key or a repository public key.
  50     The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key
  51     or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key
  52     """
  53 
  54     def __repr__(self):
  55         return self.get__repr__({"key_id": self._key_id.value, "key": self._key.value})
  56 
  57     @property
  58     def key(self):
  59         """
  60         :type: string
  61         """
  62         self._completeIfNotSet(self._key)
  63         return self._key.value
  64 
  65     @property
  66     def key_id(self):
  67         """
  68         :type: string
  69         """
  70         self._completeIfNotSet(self._key_id)
  71         return self._key_id.value
  72 
  73     def _initAttributes(self):
  74         self._key = github.GithubObject.NotSet
  75         self._key_id = github.GithubObject.NotSet
  76 
  77     def _useAttributes(self, attributes):
  78         if "key" in attributes:  # pragma no branch
  79             self._key = self._makeStringAttribute(attributes["key"])
  80         if "key_id" in attributes:  # pragma no branch
  81             self._key_id = self._makeStringAttribute(attributes["key_id"])
  82 
  83     def encrypt(self, unencrypted_value):
  84         return encrypt(self._key.value, unencrypted_value)
  85
  [end of github/PublicKey.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/github/PublicKey.py b/github/PublicKey.py
  --- a/github/PublicKey.py
  +++ b/github/PublicKey.py
  @@ -65,7 +65,7 @@
       @property
       def key_id(self):
           """
  -        :type: string
  +        :type: string or int
           """
           self._completeIfNotSet(self._key_id)
           return self._key_id.value
  @@ -78,7 +78,10 @@
           if "key" in attributes:  # pragma no branch
               self._key = self._makeStringAttribute(attributes["key"])
           if "key_id" in attributes:  # pragma no branch
  -            self._key_id = self._makeStringAttribute(attributes["key_id"])
  +            if type(attributes["key_id"]) == str:
  +                self._key_id = self._makeStringAttribute(attributes["key_id"])
  +            else:
  +                self._key_id = self._makeIntAttribute(attributes["key_id"])
   
       def encrypt(self, unencrypted_value):
           return encrypt(self._key.value, unencrypted_value)
  
verification_info: {"golden_diff": "diff --git a/github/PublicKey.py b/github/PublicKey.py\n--- a/github/PublicKey.py\n+++ b/github/PublicKey.py\n@@ -65,7 +65,7 @@\n     @property\n     def key_id(self):\n         \"\"\"\n-        :type: string\n+        :type: string or int\n         \"\"\"\n         self._completeIfNotSet(self._key_id)\n         return self._key_id.value\n@@ -78,7 +78,10 @@\n         if \"key\" in attributes:  # pragma no branch\n             self._key = self._makeStringAttribute(attributes[\"key\"])\n         if \"key_id\" in attributes:  # pragma no branch\n-            self._key_id = self._makeStringAttribute(attributes[\"key_id\"])\n+            if type(attributes[\"key_id\"]) == str:\n+                self._key_id = self._makeStringAttribute(attributes[\"key_id\"])\n+            else:\n+                self._key_id = self._makeIntAttribute(attributes[\"key_id\"])\n \n     def encrypt(self, unencrypted_value):\n         return encrypt(self._key.value, unencrypted_value)\n", "issue": "Bug in repr(PublicKey)\nhi there.\r\n\r\nthere is a bug in \"repo.get_public_key\".\r\n\r\ni found this bug by trying to use \"repo.create_secret\", which failed because of this issue\r\n\r\n```\r\nrepo.get_public_key()\r\nTraceback (most recent call last):\r\n  File \"<input>\", line 1, in <module>\r\n  File \"/Users/sschultchen/PycharmProjects/IAC_Main/venv/lib/python3.9/site-packages/github/PublicKey.py\", line 55, in __repr__\r\n    return self.get__repr__({\"key_id\": self._key_id.value, \"key\": self._key.value})\r\n  File \"/Users/sschultchen/PycharmProjects/IAC_Main/venv/lib/python3.9/site-packages/github/GithubObject.py\", line 62, in value\r\n    raise GithubException.BadAttributeException(\r\ngithub.GithubException.BadAttributeException: (1, <class 'str'>, None)\r\n```\r\n\r\ni guess the reason for this might be that the pygithub implementation assumes that \"key_id\" is a string, but it actually is a integer.\r\n\r\nat least, the github api gives me an integer, and not a string for this attribute.\n", "before_files": [{"content": "############################ Copyrights and license ############################\n#                                                                              #\n# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net>                 #\n# Copyright 2012 Zearin <zearin@gonk.net>                                      #\n# Copyright 2013 AKFish <akfish@gmail.com>                                     #\n# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net>                 #\n# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net>                 #\n# Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #\n# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #\n# Copyright 2018 Wan Liuyang <tsfdye@gmail.com>                                #\n# Copyright 2018 sfdye <tsfdye@gmail.com>                                      #\n#                                                                              #\n# This file is part of PyGithub.                                               #\n# http://pygithub.readthedocs.io/                                              #\n#                                                                              #\n# PyGithub is free software: you can redistribute it and/or modify it under    #\n# the terms of the GNU Lesser General Public License as published by the Free  #\n# Software Foundation, either version 3 of the License, or (at your option)    #\n# any later version.                                                           #\n#                                                                              #\n# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #\n# details.                                                                     #\n#                                                                              #\n# You should have received a copy of the GNU Lesser General Public License     #\n# along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #\n#                                                                              #\n################################################################################\n\n# https://docs.github.com/en/rest/reference/actions#example-encrypting-a-secret-using-python\nfrom base64 import b64encode\n\nfrom nacl import encoding, public\n\nimport github.GithubObject\n\n\ndef encrypt(public_key: str, secret_value: str) -> str:\n    \"\"\"Encrypt a Unicode string using the public key.\"\"\"\n    public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())\n    sealed_box = public.SealedBox(public_key)\n    encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))\n    return b64encode(encrypted).decode(\"utf-8\")\n\n\nclass PublicKey(github.GithubObject.CompletableGithubObject):\n    \"\"\"\n    This class represents either an organization public key or a repository public key.\n    The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key\n    or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key\n    \"\"\"\n\n    def __repr__(self):\n        return self.get__repr__({\"key_id\": self._key_id.value, \"key\": self._key.value})\n\n    @property\n    def key(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._key)\n        return self._key.value\n\n    @property\n    def key_id(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._key_id)\n        return self._key_id.value\n\n    def _initAttributes(self):\n        self._key = github.GithubObject.NotSet\n        self._key_id = github.GithubObject.NotSet\n\n    def _useAttributes(self, attributes):\n        if \"key\" in attributes:  # pragma no branch\n            self._key = self._makeStringAttribute(attributes[\"key\"])\n        if \"key_id\" in attributes:  # pragma no branch\n            self._key_id = self._makeStringAttribute(attributes[\"key_id\"])\n\n    def encrypt(self, unencrypted_value):\n        return encrypt(self._key.value, unencrypted_value)\n", "path": "github/PublicKey.py"}]}