Skip to content

Commit

Permalink
feat: optimise the function to have single lower()
Browse files Browse the repository at this point in the history
  • Loading branch information
a-spiker committed Oct 24, 2024
1 parent b98af33 commit cd341c5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,18 +687,17 @@ def find_delimiter_in(value):
return ";"


def convert_edition_to_shortform(edition):
"""Convert edition to shortform Enterprise or Community or Federal or N/E"""

if "enterprise" in edition.lower():
def convert_edition_to_shortform(edition: str) -> str:
"""Convert edition to shortform: Enterprise, Community, Federal, or N/E"""
edition_lower = edition.lower()

if "enterprise" in edition_lower:
return "Enterprise"

if "community" in edition.lower():
elif "community" in edition_lower:
return "Community"

if "federal" in edition.lower():
elif "federal" in edition_lower:
return "Federal"

return "N/E"


Expand Down

0 comments on commit cd341c5

Please sign in to comment.