Source

shinypress / shinypress / lyrics / __init__.py

Full commit
from .parser import parse_lyrics
from .. import mime_utils

class LyricsConverter(object):
    input_mimetypes = [
        'text/plain',
    ]

    output_mimetypes = [
        'text/html',
        'text/x-tex',
    ]

    def save(self, file, mime):
        assert mime_utils.any_matches(mime, self.output_mimetypes)

    @classmethod
    def from_file(cls, file, mime):
        assert mime_utils.any_matches(mime, cls.input_mimetypes)

        info, verses = parse_lyrics(file)