Skip to content

Commit

Permalink
Merge pull request #2059 from resilient-tech/mergify/bp/version-14-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-2041

fix: avoid_duplicate in address (backport #2041)
  • Loading branch information
mergify[bot] authored Apr 23, 2024
2 parents 3c80e93 + 5b0cc69 commit aa270cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions india_compliance/gst_india/utils/gstin_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ def _get_address(address):
def _extract_address_lines(address):
"""merge and divide address into exactly two lines"""

for key in address:
address[key] = address[key].strip(f"{whitespace},")
unique_values = set()
for key, value in address.copy().items():
value = value.strip(f"{whitespace},")
if value in unique_values:
address.pop(key)
else:
address[key] = value
unique_values.add(value)

address_line1 = ", ".join(
titlecase(value)
Expand Down

0 comments on commit aa270cf

Please sign in to comment.