-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
def get_info_from_email_prefix(email_prefix: str) -> list: | ||
""" | ||
Extract info from email_prefix | ||
version 0 format: uuid_b, uuid_s (long uuid) | ||
vesion 1 format: prenom_nom_uuid (short uuid) | ||
Args: | ||
email_prefix (str): _description_ | ||
Returns: | ||
[VERSION, UUID, KIND_SENDER] | ||
""" | ||
email_prefix_infos = email_prefix.split("_") | ||
# specificity of version 0: only 1 char at the end | ||
if len(email_prefix_infos[-1]) == 1: | ||
version = 0 | ||
uuid = email_prefix_infos[0] | ||
kind_sender = email_prefix_infos[1] | ||
else: # version 1 | ||
version = 1 | ||
uuid = email_prefix[-1] | ||
kind_sender = None # not useful | ||
return version, uuid, kind_sender |