Skip to content

Commit e1957ba

Browse files
backward compatible type hints
1 parent d5aee76 commit e1957ba

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

parsons/daisychain/daisychain.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from typing import Optional, Union
2+
13
from parsons.utilities.api_connector import APIConnector
2-
from typing import Union, Optional
34

45

56
class Daisychain:
@@ -34,7 +35,7 @@ def request(
3435
return results
3536

3637
def find_person(
37-
self, email_address: str | None = None, phone_number: str | None = None
38+
self, email_address: Optional[str] = None, phone_number: Optional[str] = None
3839
) -> list[dict]:
3940
"""
4041
Find a person by email address and/or phone number.
@@ -57,9 +58,9 @@ def find_person(
5758
Returns:
5859
a list of person dictionaries
5960
"""
60-
assert (
61-
email_address or phone_number
62-
), "At least one of email address or phone number must be provided."
61+
assert email_address or phone_number, (
62+
"At least one of email address or phone number must be provided."
63+
)
6364
payload: dict[str, dict[str, str]] = {"person": {}}
6465
if email_address:
6566
payload["person"]["email"] = email_address
@@ -72,14 +73,14 @@ def find_person(
7273

7374
def post_action(
7475
self,
75-
email_address: str | None = None,
76-
phone_number: str | None = None,
77-
first_name: str | None = None,
78-
last_name: str | None = None,
79-
addresses: list[dict] | None = None,
76+
email_address: Optional[str] = None,
77+
phone_number: Optional[str] = None,
78+
first_name: Optional[str] = None,
79+
last_name: Optional[str] = None,
80+
addresses: Optional[list[dict]] = None,
8081
email_opt_in: bool = False,
8182
sms_opt_in: bool = False,
82-
action_data: dict | None = None,
83+
action_data: Optional[dict] = None,
8384
) -> str:
8485
"""Record an action on a person in Daisychain.
8586
@@ -127,9 +128,9 @@ def post_action(
127128
person id (string)
128129
129130
"""
130-
assert (
131-
email_address or phone_number
132-
), "At least one of email address or phone number must be provided."
131+
assert email_address or phone_number, (
132+
"At least one of email address or phone number must be provided."
133+
)
133134
if not action_data:
134135
action_data = {}
135136
payload = {

0 commit comments

Comments
 (0)