def format_name(display_name, prefix, prefixes, prefix_format_func=None):
if prefix is not None and prefix_format_func is not None:
prefix = prefix_format_func(prefix)
# Default multi -> '' if no format func given
if prefix_format_func is None and prefix == cr_constants.MULTI_REFS_PREFIX:
prefix = ''
if len(prefixes) > 1 or '%s' in display_name:
display_name = add_prefix(prefix, display_name)
# Replace underscores w/ spaces
display_name = display_name.replace('_', ' ')
# Collapse whitespace
display_name = re.sub('\s+', ' ', display_name)
return display_name
评论列表
文章目录