def determine_repo_dir(template, abbreviations, clone_to_dir, checkout, no_input):
 template = expand_abbreviations(template, abbreviations)
 if is_repo_url(template):
  cloned_repo = clone(repo_url=template, checkout=checkout, clone_to_dir=clone_to_dir, no_input=no_input)
  repository_candidates = [cloned_repo]
 else:
  repository_candidates = [template, os.path.join(clone_to_dir, template)]
 for repo_candidate in repository_candidates:
  if repository_has_cookiecutter_json(repo_candidate):
   return repo_candidate
 raise RepositoryNotFound(u'A valid repository for "{}" could not be found in the following locations:\n{}'.format(template, u'\n'.join(repository_candidates)))

def determine_repo_dir ( template , abbreviations , clone_to_dir , checkout , no_input ) : template = expand_abbreviations ( template , abbreviations ) if is_repo_url ( template ) : cloned_repo = clone ( repo_url = template , checkout = checkout , clone_to_dir = clone_to_dir , no_input = no_input ) repository_candidates = [ cloned_repo ] else : repository_candidates = [ template , os . path . join ( clone_to_dir , template ) ] for repo_candidate in repository_candidates : if repository_has_cookiecutter_json ( repo_candidate ) : return repo_candidate raise RepositoryNotFound ( u'A valid repository for "{}" could not be found in the following locations:\n{}' . format ( template , u'\n' . join ( repository_candidates ) ) )
locate the repository directory from a template reference .