<commit_before>"""
Elixir-related Ultisnips snippet helper functions.
"""
import re

_DASHES_AND_UNDERSCORES = re.compile("[-_]")
_MODULE_FILEPATH = re.compile(r"lib\/([^\/]+)\/([\w+\/]+)*\/([^\/]+).ex")

def closing_character(tabstop):
    """
    Return closing character for a tabstop containing an opening character.
    """
    if tabstop.startswith("{"):
        return "}"
    if tabstop.startswith("["):
        return "]"
    if tabstop.startswith("\""):
        return "\""

    return ""

def module_path_match(path, regex=_MODULE_FILEPATH):
    """
    Return match data for an Elixir module from a file path.
    """
    return re.search(regex, path)

def outer_module_name(path):
    """
    Return name for an outer Elixir module from a file path.
    """
    outer_module_path = module_path_match(path).group(1)
    return to_module_name(outer_module_path)

def to_module_name(string):<commit_msg>Give closing_character method the option to return closing parentheses<commit_after>"""
Elixir-related Ultisnips snippet helper functions.
NOTE: Changes to this file require restarting Vim!
"""
import re

_DASHES_AND_UNDERSCORES = re.compile("[-_]")
_MODULE_FILEPATH = re.compile(r"lib\/([^\/]+)\/([\w+\/]+)*\/([^\/]+).ex")

def closing_character(tabstop):
    """
    Return closing character for a tabstop containing an opening character.
    """
    if tabstop.startswith("("):
        return ")"
    if tabstop.startswith("{"):
        return "}"
    if tabstop.startswith("["):
        return "]"
    if tabstop.startswith("\""):
        return "\""

    return ""

def module_path_match(path, regex=_MODULE_FILEPATH):
    """
    Return match data for an Elixir module from a file path.
    """
    return re.search(regex, path)

def outer_module_name(path):
    """
    Return name for an outer Elixir module from a file path.
    """
    outer_module_path = module_path_match(path).group(1)
    return to_module_name(outer_module_path)

def to_module_name(string):
{'fraction_non_alphanumeric': 0.14710327455919395, 'fraction_numerical': 0.0010075566750629723, 'mean_word_length': 3.4529147982062782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1758028', 'n_tokens_mistral': 653, 'n_tokens_neox': 648, 'n_words': 158}