Skip to content

Commit

Permalink
Merge pull request Neurotech-HQ#53 from filipporomani/patch-2
Browse files Browse the repository at this point in the history
refactor: remove type union operator
  • Loading branch information
Kalebu authored Jan 16, 2023
2 parents 548da4e + fd9df10 commit 592defa
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions heyoo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def preprocess(self, data):
"""
return data["entry"][0]["changes"][0]["value"]

def get_mobile(self, data) -> (str | None):
def get_mobile(self, data)-> Union[str, None]:
"""
Extracts the mobile number of the sender from the data received from the webhook.
Expand All @@ -674,7 +674,7 @@ def get_mobile(self, data) -> (str | None):
if "contacts" in data:
return data["contacts"][0]["wa_id"]

def get_name(self, data) -> (str | None):
def get_name(self, data)-> Union[str, None]:
"""
Extracts the name of the sender from the data received from the webhook.
Expand All @@ -691,7 +691,7 @@ def get_name(self, data) -> (str | None):
if contact:
return contact["contacts"][0]["profile"]["name"]

def get_message(self, data) -> (str | None):
def get_message(self, data)-> Union[str, None]:
"""
Extracts the text message of the sender from the data received from the webhook.
Expand All @@ -708,7 +708,7 @@ def get_message(self, data) -> (str | None):
if "messages" in data:
return data["messages"][0]["text"]["body"]

def get_message_id(self, data) -> (str | None):
def get_message_id(self, data)-> Union[str, None]:
"""
Extracts the message id of the sender from the data received from the webhook.
Expand All @@ -725,7 +725,7 @@ def get_message_id(self, data) -> (str | None):
if "messages" in data:
return data["messages"][0]["id"]

def get_message_timestamp(self, data) -> (str | None):
def get_message_timestamp(self, data)-> Union[str, None]:
""" "
Extracts the timestamp of the message from the data received from the webhook.
Expand All @@ -742,7 +742,7 @@ def get_message_timestamp(self, data) -> (str | None):
if "messages" in data:
return data["messages"][0]["timestamp"]

def get_interactive_response(self, data) -> (Dict | None):
def get_interactive_response(self, data)-> Union[Dict, None]:
"""
Extracts the response of the interactive message from the data received from the webhook.
Expand All @@ -764,7 +764,7 @@ def get_interactive_response(self, data) -> (Dict | None):
if "interactive" in data["messages"][0]:
return data["messages"][0]["interactive"]

def get_location(self, data) -> (Dict | None):
def get_location(self, data)-> Union[Dict, None]:
"""
Extracts the location of the sender from the data received from the webhook.
Expand All @@ -784,7 +784,7 @@ def get_location(self, data) -> (Dict | None):
if "location" in data["messages"][0]:
return data["messages"][0]["location"]

def get_image(self, data) -> (Dict | None):
def get_image(self, data)-> Union[Dict, None]:
""" "
Extracts the image of the sender from the data received from the webhook.
Expand All @@ -803,7 +803,7 @@ def get_image(self, data) -> (Dict | None):
if "image" in data["messages"][0]:
return data["messages"][0]["image"]

def get_document(self, data) -> (Dict | None):
def get_document(self, data)-> Union[Dict, None]:
""" "
Extracts the document of the sender from the data received from the webhook.
Expand All @@ -823,7 +823,7 @@ def get_document(self, data) -> (Dict | None):
return data["messages"][0]["document"]


def get_audio(self, data) -> (Dict | None):
def get_audio(self, data)-> Union[Dict, None]:
"""
Extracts the audio of the sender from the data received from the webhook.
Expand All @@ -843,7 +843,7 @@ def get_audio(self, data) -> (Dict | None):
if "audio" in data["messages"][0]:
return data["messages"][0]["audio"]

def get_video(self, data) -> (Dict | None):
def get_video(self, data)-> Union[Dict, None]:
"""
Extracts the video of the sender from the data received from the webhook.
Expand All @@ -863,7 +863,7 @@ def get_video(self, data) -> (Dict | None):
if "video" in data["messages"][0]:
return data["messages"][0]["video"]

def get_message_type(self, data) -> (str | None):
def get_message_type(self, data)-> Union[str, None]:
"""
Gets the type of the message sent by the sender from the data received from the webhook.
Expand All @@ -883,7 +883,7 @@ def get_message_type(self, data) -> (str | None):
if "messages" in data:
return data["messages"][0]["type"]

def get_delivery(self, data) -> (Dict | None):
def get_delivery(self, data)-> Union[Dict, None]:
"""
Extracts the delivery status of the message from the data received from the webhook.
Args:
Expand Down

0 comments on commit 592defa

Please sign in to comment.