MCPcopy
hub / github.com/PyGithub/PyGithub / edit

Method edit

github/Label.py:129–144  ·  view source on GitHub ↗

:calls: `PATCH /repos/{owner}/{repo}/labels/{name} `_

(self, name: str, color: str, description: Opt[str] = NotSet)

Source from the content-addressed store, hash-verified

127 headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
128
129 def edit(self, name: str, color: str, description: Opt[str] = NotSet) -> None:
130 """
131 :calls: `PATCH /repos/{owner}/{repo}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
132 """
133 assert isinstance(name, str), name
134 assert isinstance(color, str), color
135 assert is_optional(description, str), description
136 post_parameters = NotSet.remove_unset_items({"new_name": name, "color": color, "description": description})
137 headers, data = self._requester.requestJsonAndCheck(
138 "PATCH",
139 self.url,
140 input=post_parameters,
141 headers={"Accept": Consts.mediaTypeLabelDescriptionSearchPreview},
142 )
143 self._useAttributes(data)
144 self._set_complete()
145
146 def _useAttributes(self, attributes: dict[str, Any]) -> None:
147 if "color" in attributes: # pragma no branch

Callers

nothing calls this directly

Calls 5

_useAttributesMethod · 0.95
is_optionalFunction · 0.90
remove_unset_itemsMethod · 0.80
requestJsonAndCheckMethod · 0.80
_set_completeMethod · 0.80

Tested by

no test coverage detected