src/cowsay/__init__.py
def read_dot_cow(f: TextIO, escapes: dict[str, str]=None) -> str:
    """
    Reads and parses a .cow file to a string. Unescapes characters in doing
    so. This function will search for a heredoc in the .cow file. If found,
    it will extract the cow in the heredoc, otherwise the whole file is used.

    :param f: The File to read from
    :param escapes: A dictionary mapping escape codes to their respective
        characters
    :return: The cow
    """
    if escapes is None:
        escapes=ESCAPES
    the_cow = f.read()
    match = HEREDOC_PATTERN.search(the_cow)
    if match is not None:
        the_cow = match.group('the_cow')
    for escape, replacement in escapes.items():
        the_cow = the_cow.replace(escape, replacement)
    return the_cow.strip('\r\n')

    Reads and parses a .cow file to a string. Unescapes characters in doing
    so. This function will search for a heredoc in the .cow file. If found,
    it will extract the cow in the heredoc, otherwise the whole file is used.

    :param f: The File to read from
    :param escapes: A dictionary mapping escape codes to their respective
        characters
    :return: The cow
    
Reads and parses a .cow file to a string. Unescapes characters in doing
so. This function will search for a heredoc in the .cow file. If found,
it will extract the cow in the heredoc, otherwise the whole file is used.
Reads and parses a . cow file to a string . Unescapes characters in doing so . This function will search for a heredoc in the . cow file . If found it will extract the cow in the heredoc otherwise the whole file is used .
def read_dot_cow(f: TextIO, escapes: dict[str, str]=None) -> str:
    if escapes is None:
        escapes=ESCAPES
    the_cow = f.read()
    match = HEREDOC_PATTERN.search(the_cow)
    if match is not None:
        the_cow = match.group('the_cow')
    for escape, replacement in escapes.items():
        the_cow = the_cow.replace(escape, replacement)
    return the_cow.strip('\r\n')
def read_dot_cow ( f : TextIO , escapes : dict [ str , str ] = None ) -> str : if escapes is None : escapes = ESCAPES the_cow = f . read ( ) match = HEREDOC_PATTERN . search ( the_cow ) if match is not None : the_cow = match . group ( 'the_cow' ) for escape , replacement in escapes . items ( ) : the_cow = the_cow . replace ( escape , replacement ) return the_cow . strip ( '\r\n' )
Reads and parses a .cow file to a string.
Reads and parses a . cow file to a string .
"""
    Reads and parses a .cow file to a string. Unescapes characters in doing
    so. This function will search for a heredoc in the .cow file. If found,
    it will extract the cow in the heredoc, otherwise the whole file is used.

    :param f: The File to read from
    :param escapes: A dictionary mapping escape codes to their respective
        characters
    :return: The cow
    """
None
f
TextIO
The File to read from
The File to read from
escapes
dict[str, str]
A dictionary mapping escape codes to their respective
characters
A dictionary mapping escape codes to their respective characters