neurotools.jobs.filenames module

Functions to validate filenames

neurotools.jobs.filenames.validate_argument_signature(sig)[source]

Determines whether a given argument signature can be used to cache things to disk. The argument signature must be hashable. It must consists of types that can be translated between python, numpy, and matlab convenctions.

Parameters:

sig (argument signature) – Not implemented

neurotools.jobs.filenames.is_dangerous_filename(filename)[source]

Checks whether a filename is safe to use on most modern filesystems. Filnames must be shorter than 255 characters, and contain no special characters or escape sequences. Filenames should be ASCII

Parameters:

filename (string) – String representing a filename. Should be in ASCII and not unicode format

Returns:

False if the filename is broadly compatible with most modern filesystems.

Return type:

bool

neurotools.jobs.filenames.check_filename(filename)[source]

Check if a filename is safe to use on most filesystems. More lenient than is_dangerous_filename.

Unicode filenames are permitted (in Python 3), but generate a warning in Pythoon 2.

Long filenames (over 255 chars) are ok on many modern filesystems and only trigger a warning

Only special characters that outright break windows will raise an error.

No return value.

Parameters:

filename (string) – String representing a filename.