

def _replace_github_issue_references(self, line):
    valid_name = '[\\w\\._-]+'
    issue_pattern = '#(\\d+)'

    def replace_issue_number(match):
        issue_url = self._github_base_url
        if match.group(1):
            path = match.group(1)
            issue_url += path
        else:
            path = ''
            issue_url += self._github_path
        issue_number = match.group(2)
        issue_url += ('/issues/' + issue_number)
        return ('`%s#%s <%s>`_' % (path, issue_number, issue_url))
    line = re.sub((('(%s/%s)?' % (valid_name, valid_name)) + issue_pattern), replace_issue_number, line)
    return line

dataset/ETHPy150Open ros-infrastructure/catkin_pkg/src/catkin_pkg/changelog_generator_vcs.py GitClient._replace_github_issue_references/original