@@ -196,20 +196,19 @@ def normalize_and_hash_email_address(email_address):
196196 Returns:
197197 A normalized (lowercase, removed whitespace) and SHA-265 hashed string.
198198 """
199- normalized_email = email_address .lower ()
199+ normalized_email = email_address .strip (). lower ()
200200 email_parts = normalized_email .split ("@" )
201- # Checks whether the domain of the email address is either "gmail.com"
202- # or "googlemail.com". If this regex does not match then this statement
203- # will evaluate to None.
204- is_gmail = re .match (r"^(gmail|googlemail)\.com$" , email_parts [1 ])
205-
206- # Check that there are at least two segments and the second segment
207- # matches the above regex expression validating the email domain name.
208- if len (email_parts ) > 1 and is_gmail :
209- # Removes any '.' characters from the portion of the email address
210- # before the domain if the domain is gmail.com or googlemail.com.
211- email_parts [0 ] = email_parts [0 ].replace ("." , "" )
212- normalized_email = "@" .join (email_parts )
201+
202+ # Check that there are at least two segments
203+ if len (email_parts ) > 1 :
204+ # Checks whether the domain of the email address is either "gmail.com"
205+ # or "googlemail.com". If this regex does not match then this statement
206+ # will evaluate to None.
207+ if re .match (r"^(gmail|googlemail)\.com$" , email_parts [1 ]):
208+ # Removes any '.' characters from the portion of the email address
209+ # before the domain if the domain is gmail.com or googlemail.com.
210+ email_parts [0 ] = email_parts [0 ].replace ("." , "" )
211+ normalized_email = "@" .join (email_parts )
213212
214213 return normalize_and_hash (normalized_email )
215214
0 commit comments