Skip to content

Commit

Permalink
refactor(merge attribute): make replace_uri_in_template_string more r…
Browse files Browse the repository at this point in the history
…eadable

Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
  • Loading branch information
MyPyDavid committed Jun 19, 2024
1 parent 1c66288 commit 1bf0d46
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rdmo/management/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

def replace_uri_in_template_string(template: str, source_uri: str, target_uri: str) -> str:
patterns = [f"'{source_uri}'", f'"{source_uri}"']
replacements = [f"'{target_uri}'", f'"{target_uri}"']

new_template = template
for pattern, replacement in zip(patterns, replacements):
new_template = new_template.replace(pattern, replacement)
return new_template
replacements = [
(f"'{source_uri}'", f"'{target_uri}'"),
(f'"{source_uri}"', f'"{target_uri}"'),
]
for pattern, replacement in replacements:
template = template.replace(pattern, replacement)
return template

0 comments on commit 1bf0d46

Please sign in to comment.