Skip to content

Commit

Permalink
get
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgreg31 committed May 14, 2023
1 parent 38ec62f commit cab4757
Showing 1 changed file with 22 additions and 36 deletions.
58 changes: 22 additions & 36 deletions github/HookDelivery.py
Expand Up @@ -140,43 +140,35 @@ def _initAttributes(self) -> None:

def _useAttributes(self, attributes: Dict[str, Any]):
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])
assert isinstance(self._id, int)
self._id = self._makeIntAttribute(attributes.get("id"))
if "guid" in attributes: # pragma no branch
self._guid = self._makeStringAttribute(attributes["guid"])
assert isinstance(self._guid, str)
self._guid = self._makeStringAttribute(attributes.get("guid"))
if "delivered_at" in attributes: # pragma no branch
self._delivered_at = self._makeStringAttribute(attributes["delivered_at"])
assert isinstance(self._delivered_at, str)
self._delivered_at = self._makeStringAttribute(
attributes.get("delivered_at")
)
if "redelivery" in attributes: # pragma no branch
self._redelivery = self._makeBoolAttribute(attributes["redelivery"])
assert isinstance(self._redelivery, bool)
self._redelivery = self._makeBoolAttribute(attributes.get("redelivery"))
if "duration" in attributes: # pragma no branch
self._duration = self._makeFloatAttribute(attributes["duration"])
assert isinstance(self._duration, float)
self._duration = self._makeFloatAttribute(attributes.get("duration"))
if "status" in attributes: # pragma no branch
self._status = self._makeStringAttribute(attributes["status"])
assert isinstance(self._status, str)
self._status = self._makeStringAttribute(attributes.get("status"))
if "status_code" in attributes: # pragma no branch
self._status_code = self._makeIntAttribute(attributes["status_code"])
assert isinstance(self._status_code, int)
self._status_code = self._makeIntAttribute(attributes.get("status_code"))
if "event" in attributes: # pragma no branch
self._event = self._makeStringAttribute(attributes["event"])
assert isinstance(self._event, str)
self._event = self._makeStringAttribute(attributes.get("event"))
if "action" in attributes: # pragma no branch
self._action = self._makeStringAttribute(attributes["action"])
assert isinstance(self._action, str)
self._action = self._makeStringAttribute(attributes.get("action"))
if "installation_id" in attributes: # pragma no branch
self._installation_id = self._makeIntAttribute(
attributes["installation_id"]
attributes.get("installation_id")
)
assert isinstance(self._installation_id, int)
if "repository_id" in attributes: # pragma no branch
self._repository_id = self._makeIntAttribute(attributes["repository_id"])
assert isinstance(self._repository_id, int)
self._repository_id = self._makeIntAttribute(
attributes.get("repository_id")
)
if "url" in attributes: # pragma no branch
self._url = self._makeStringAttribute(attributes["url"])
assert isinstance(self._url, str)
self._url = self._makeStringAttribute(attributes.get("url"))


class HookDeliveryRequest(NonCompletableGithubObject):
Expand Down Expand Up @@ -204,11 +196,9 @@ def _initAttributes(self) -> None:

def _useAttributes(self, attributes: Dict[str, Any]) -> None:
if "headers" in attributes: # pragma no branch
self._headers = self._makeDictAttribute(attributes["headers"])
assert isinstance(self._headers, dict)
self._headers = self._makeDictAttribute(attributes.get("headers"))
if "payload" in attributes: # pragma no branch
self._payload = self._makeDictAttribute(attributes["payload"])
assert isinstance(self._payload, dict)
self._payload = self._makeDictAttribute(attributes.get("payload"))


class HookDeliveryResponse(NonCompletableGithubObject):
Expand Down Expand Up @@ -236,11 +226,9 @@ def _initAttributes(self) -> None:

def _useAttributes(self, attributes: Dict[str, Any]) -> None:
if "headers" in attributes: # pragma no branch
self._headers = self._makeDictAttribute(attributes["headers"])
assert isinstance(self._headers, dict)
self._headers = self._makeDictAttribute(attributes.get("headers"))
if "payload" in attributes: # pragma no branch
self._payload = self._makeStringAttribute(attributes["payload"])
assert isinstance(self._payload, dict)
self._payload = self._makeStringAttribute(attributes.get("payload"))


class HookDelivery(HookDeliverySummary):
Expand Down Expand Up @@ -271,11 +259,9 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None:
super()._useAttributes(attributes)
if "request" in attributes: # pragma no branch
self._request = self._makeClassAttribute(
HookDeliveryRequest, attributes["request"]
HookDeliveryRequest, attributes.get("request")
)
assert isinstance(self._request, HookDeliveryRequest)
if "response" in attributes: # pragma no branch
self._response = self._makeClassAttribute(
HookDeliveryResponse, attributes["response"]
HookDeliveryResponse, attributes.get("response")
)
assert isinstance(self._response, HookDeliveryResponse)

0 comments on commit cab4757

Please sign in to comment.