kitir/_libs/file_utils.py
def write_file(file_name, contents=None, filemode='w', rotate=False, **kwargs):
    """
    create, or append to a file, optionally with content, return file_name
    :param file_name:
    :param contents:
    :param filemode:
    :param rotate:
    :return: the filename that was written
    """
    check_makedir(os.path.dirname(file_name))
    if rotate:
        file_name = file_rotation(file_name, rotate_rx=kwargs.get('rotate_rx', '_rx_'))
    with open(file_name, filemode) as f:
        if contents:
            if isinstance(contents, list) and isinstance(contents[0], str):
                f.writelines(contents)
            else:
                if not isinstance(contents, str):
                    contents = str(contents)
                f.write(contents)
    return file_name

    create, or append to a file, optionally with content, return file_name
    :param file_name:
    :param contents:
    :param filemode:
    :param rotate:
    :return: the filename that was written
    
create, or append to a file, optionally with content, return file_name
create or append to a file optionally with content return file_name
def write_file(file_name, contents=None, filemode='w', rotate=False, **kwargs):
    check_makedir(os.path.dirname(file_name))
    if rotate:
        file_name = file_rotation(file_name, rotate_rx=kwargs.get('rotate_rx', '_rx_'))
    with open(file_name, filemode) as f:
        if contents:
            if isinstance(contents, list) and isinstance(contents[0], str):
                f.writelines(contents)
            else:
                if not isinstance(contents, str):
                    contents = str(contents)
                f.write(contents)
    return file_name
def write_file ( file_name , contents = None , filemode = 'w' , rotate = False , ** kwargs ) : check_makedir ( os . path . dirname ( file_name ) ) if rotate : file_name = file_rotation ( file_name , rotate_rx = kwargs . get ( 'rotate_rx' , '_rx_' ) ) with open ( file_name , filemode ) as f : if contents : if isinstance ( contents , list ) and isinstance ( contents [ 0 ] , str ) : f . writelines ( contents ) else : if not isinstance ( contents , str ) : contents = str ( contents ) f . write ( contents ) return file_name
create, or append to a file, optionally with content, return file_name
create or append to a file optionally with content return file_name
"""
    create, or append to a file, optionally with content, return file_name
    :param file_name:
    :param contents:
    :param filemode:
    :param rotate:
    :return: the filename that was written
    """
the filename that was written
the filename that was written
file_name
None
contents
None
filemode
None
rotate
None