taukit/utils.py
def make_filepath(filename, dirpath, inc_if_taken=True, **kwds):
    """Make filepath for a given filename.

    This function allows for not overwriting existing files
    and incrementing filename counter instead.
    In such a case the filename must be a formattable string
    with a named placeholder `{n}`. Other named placeholder may be
    filled through `**kwds`.

    Parameters
    ----------
    filename : str
        File name.
    dirpath : str
        Directory path.
    inc_if_taken : bool
        Should file counter be used and incremented if a name is already taken.
    **kwds :
        Optional keyword arguments passed to the format string.
    """
    n = 0
    _filepath = os.path.join(dirpath, filename)
    filepath = _filepath
    while inc_if_taken:
        n += 1
        filepath = _filepath.format(n=n, **kwds)
        if not os.path.exists(filepath):
            break
    return filepath
Make filepath for a given filename.

    This function allows for not overwriting existing files
    and incrementing filename counter instead.
    In such a case the filename must be a formattable string
    with a named placeholder `{n}`. Other named placeholder may be
    filled through `**kwds`.

    Parameters
    ----------
    filename : str
        File name.
    dirpath : str
        Directory path.
    inc_if_taken : bool
        Should file counter be used and incremented if a name is already taken.
    **kwds :
        Optional keyword arguments passed to the format string.
    
Make filepath for a given filename.
This function allows for not overwriting existing files
and incrementing filename counter instead.
In such a case the filename must be a formattable string
with a named placeholder `{n}`. Other named placeholder may be
filled through `**kwds`.

Parameters

filename : str
File name.
dirpath : str
Directory path.
inc_if_taken : bool
Should file counter be used and incremented if a name is already taken.
kwds :
Optional keyword arguments passed to the format string.
Make filepath for a given filename . This function allows for not overwriting existing files and incrementing filename counter instead . In such a case the filename must be a formattable string with a named placeholder ` { n } ` . Other named placeholder may be filled through ` ** kwds ` . Parameters filename : str File name . dirpath : str Directory path . inc_if_taken : bool Should file counter be used and incremented if a name is already taken . kwds : Optional keyword arguments passed to the format string .
def make_filepath(filename, dirpath, inc_if_taken=True, **kwds):
    n = 0
    _filepath = os.path.join(dirpath, filename)
    filepath = _filepath
    while inc_if_taken:
        n += 1
        filepath = _filepath.format(n=n, **kwds)
        if not os.path.exists(filepath):
            break
    return filepath
def make_filepath ( filename , dirpath , inc_if_taken = True , ** kwds ) : n = 0 _filepath = os . path . join ( dirpath , filename ) filepath = _filepath while inc_if_taken : n += 1 filepath = _filepath . format ( n = n , ** kwds ) if not os . path . exists ( filepath ) : break return filepath
Make filepath for a given filename.
Make filepath for a given filename .
"""Make filepath for a given filename.

    This function allows for not overwriting existing files
    and incrementing filename counter instead.
    In such a case the filename must be a formattable string
    with a named placeholder `{n}`. Other named placeholder may be
    filled through `**kwds`.

    Parameters
    ----------
    filename : str
        File name.
    dirpath : str
        Directory path.
    inc_if_taken : bool
        Should file counter be used and incremented if a name is already taken.
    **kwds :
        Optional keyword arguments passed to the format string.
    """
filename
dirpath
inc_if_taken