helpers: use pre-comiled patterns for PRs for small speedup.
bart -
r4203:8c331388 stable
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -1514,6 +1514,9
1514 return active_entries
1514 return active_entries
1515
1515
1516
1516
1517 pr_pattern_re = re.compile(r'(?:(?:^!)|(?: !))(\d+)')
1518
1519
1517 def process_patterns(text_string, repo_name, link_format='html', active_entries=None):
1520 def process_patterns(text_string, repo_name, link_format='html', active_entries=None):
1518
1521
1519 allowed_formats = ['html', 'rst', 'markdown',
1522 allowed_formats = ['html', 'rst', 'markdown',
@@ -1572,7 +1575,7
1572 pr_url_func = partial(
1575 pr_url_func = partial(
1573 _process_url_func, repo_name=repo_name, entry=pr_entry, uid=None,
1576 _process_url_func, repo_name=repo_name, entry=pr_entry, uid=None,
1574 link_format=link_format+'+hovercard')
1577 link_format=link_format+'+hovercard')
1575 new_text = re.compile(r'(?:(?:^!)|(?: !))(\d+)').sub(pr_url_func, new_text)
1578 new_text = pr_pattern_re.sub(pr_url_func, new_text)
1576 log.debug('processed !pr pattern')
1579 log.debug('processed !pr pattern')
1577
1580
1578 return new_text, issues_data
1581 return new_text, issues_data
Comments 0
You need to be logged in to leave comments. Login now