awcy_nfo/helpers.py
def temp_filename(suffix=None):
    """Context that introduces a temporary file.

    Creates a temporary file, yields the name, and on context exit, deletes it.
    (In contrast, tempfile.NamedTemporaryFile() provides a 'file' object and
    deletes the file as soon as the file object is closed, thus the temporary file
    cannot be safely re-opened by another library or process.)

    Args:
        suffix: desired filename extension (e.g. '.txt').

    Yields:
        The name of the temporary file.
    """

    import tempfile

    try:
        f = tempfile.NamedTemporaryFile(suffix=suffix, delete=False)
        f.readlines()
        tmp_name = f.name
        f.close()
        yield tmp_name
    finally:
        os.unlink(tmp_name)
Context that introduces a temporary file.

    Creates a temporary file, yields the name, and on context exit, deletes it.
    (In contrast, tempfile.NamedTemporaryFile() provides a 'file' object and
    deletes the file as soon as the file object is closed, thus the temporary file
    cannot be safely re-opened by another library or process.)

    Args:
        suffix: desired filename extension (e.g. '.txt').

    Yields:
        The name of the temporary file.
    
Context that introduces a temporary file.
Creates a temporary file, yields the name, and on context exit, deletes it.
(In contrast, tempfile.NamedTemporaryFile() provides a 'file' object and
deletes the file as soon as the file object is closed, thus the temporary file
cannot be safely re-opened by another library or process.)
Context that introduces a temporary file . Creates a temporary file yields the name and on context exit deletes it . ( In contrast tempfile . NamedTemporaryFile () provides a ' file ' object and deletes the file as soon as the file object is closed thus the temporary file cannot be safely re - opened by another library or process . )
def temp_filename(suffix=None):
    import tempfile
    try:
        f = tempfile.NamedTemporaryFile(suffix=suffix, delete=False)
        f.readlines()
        tmp_name = f.name
        f.close()
        yield tmp_name
    finally:
        os.unlink(tmp_name)
def temp_filename ( suffix = None ) : import tempfile try : f = tempfile . NamedTemporaryFile ( suffix = suffix , delete = False ) f . readlines ( ) tmp_name = f . name f . close ( ) yield tmp_name finally : os . unlink ( tmp_name )
Context that introduces a temporary file.
Context that introduces a temporary file .
"""Context that introduces a temporary file.

    Creates a temporary file, yields the name, and on context exit, deletes it.
    (In contrast, tempfile.NamedTemporaryFile() provides a 'file' object and
    deletes the file as soon as the file object is closed, thus the temporary file
    cannot be safely re-opened by another library or process.)

    Args:
        suffix: desired filename extension (e.g. '.txt').

    Yields:
        The name of the temporary file.
    """
The name of the temporary file.
The name of the temporary file .
suffix
desired filename extension .
desired filename extension .