summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Firth <dan.firth@codethink.co.uk>2016-12-05 10:47:36 +0000
committerBen Brown <ben.brown@codethink.co.uk>2017-07-12 21:17:21 +0000
commit476387fa5ba2dbe180af210d1d123294b809075d (patch)
tree81b650dec9e937393a2dd0b7c416c33850f522d0
parent7135c51af946aff8f304252d77994ac613a93038 (diff)
downloadybd-lc/eafp.tar.gz
Add docstring for get_repo_url, use EAFPlc/eafp
-rw-r--r--ybd/repos.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/ybd/repos.py b/ybd/repos.py
index 0a24b6b..5239cc1 100644
--- a/ybd/repos.py
+++ b/ybd/repos.py
@@ -38,11 +38,12 @@ else:
def get_repo_url(repo):
- if repo:
- for alias, url in app.config.get('aliases', {}).items():
- repo = repo.replace(alias, url)
- if repo[:4] == "http" and not repo.endswith('.git'):
- repo = repo + '.git'
+ '''Takes a repository url and returns a normalized version with the
+ aliases replaced with their values.'''
+ for alias, url in app.config.get('aliases', {}).items():
+ repo = repo.replace(alias, url)
+ if repo.startswith("http") and not repo.endswith('.git'):
+ repo = repo + '.git'
return repo