Functions
Functions:
|
Returns the regex equivalent of the filepattern. |
|
Returns a guess of a pattern given path to a directory of files or a list of files. |
- get_regex(filepattern, suppress_warnings=False)
Returns the regex equivalent of the filepattern.
- Parameters
filepattern (
str) – A filepattern to get the regex equivalent of.suppress_warnings – True to suppress warnings (Defaults False)
- Return type
str- Returns
String containing the regex equivalent of the filepattern
- infer_pattern(path='', files=[], variables='', block_size='')
Returns a guess of a pattern given path to a directory of files or a list of files.
This function takes in either a path to a directory or a list of filenames to provide a guess of the filepattern. The optional argument variables will provide names for the variables. If variable names are not given, default variable names will be used. If a block_size is specified, this method will only used the specified amount of RAM.
- Parameters
path (
str) – The path to a directory of files. Defaults to “”.files (
list) – A list of files. Defaults to [].variables (
str) – A string of variables. If an empty string, variable names will be provided. Defaults to “”.block_size (
str) – An string that specifies a maximum amount of RAM to consume. If “”, no limit will be imposed. Defaults to “”.
- Returns
A string that is a guess of the pattern for the supplied filenames.