get_fname¶
-
sknano.core.io.get_fname(fname=None, ext=None, outpath='/home/androo/projects/scikit-nano/scikit-nano/doc/source', overwrite=False, add_fnum=True, fnum=None, verbose=False, **kwargs)[source] [edit on github][source]¶ Generate modified
fnamestring based on chosen parameters.Parameters: - fname (str) – Name of file, with or without an extension.
- ext (str, optional) – File extension to append to
fname. Ifextis None, thenfnameis analyzed to see if it likely already has an extension. An extension is set to the last element in the list of strings returned byfname.split('.')if this list has more than 1 element. Otherwise,extwill be set to an empty string''. Ifextis not None and is a valid string, thenfnameis analyzed to see if it already ends withext. Iffname.endswith(ext)isTruefrom the start, thenextwill not be duplicately appended. - outpath (str, optional) – Absolute or relative path for generated output file.
Default is the absolute path returned by
os.getcwd(). - overwrite (bool, optional) – If
True, overwrite an existing file if it has the same generated file path. - add_fnum (bool, optional) – Append integer number to output file name, starting with 1.
- fnum ({None, int}, optional) –
Starting file number to append if
add_fnumisTrue.If the generated file path exists and
overwriteis False, setting this parameter has no effect. - verbose (bool, optional) – Show verbose output.
Returns: fname – Updated
fname.Return type: