allensdk.config.manifest module

class allensdk.config.manifest.Manifest(config=None, relative_base_dir='.', version=None)[source]

Bases: object

Manages the location of external files referenced in an Allen SDK configuration

DIR = 'dir'
DIRNAME = 'dir_name'
FILE = 'file'
VERSION = 'manifest_version'
add_file(file_key, file_name, dir_key=None, path_format=None)[source]

Insert a new file entry.

Parameters:
file_keystring

Reference to the entry.

file_namestring

Subtitutions of the %s, %d style allowed.

dir_keystring

Reference to the parent directory entry.

path_formatstring, optional

File type for further parsing.

add_path(key, path, path_type='dir', absolute=True, path_format=None, parent_key=None)[source]

Insert a new entry.

Parameters:
keystring

Identifier for referencing the entry.

pathstring

Specification for a path using %s, %d style substitution.

path_typestring enumeration

‘dir’ (default) or ‘file’

absoluteboolean

Is the spec relative to the process current directory.

path_formatstring, optional

Indicate a known file type for further parsing.

parent_keystring

Refer to another entry.

add_paths(path_info)[source]

add information about paths stored in the manifest.

Parameters
path_infodict

Information about the new paths

as_dataframe()[source]
check_dir(path_key, do_exit=False)[source]

Verify a directories existence or optionally exit.

Parameters:
path_keystring

Reference to the entry.

do_exitboolean

What to do if the directory is not present.

create_dir(path_key)[source]

Make a directory for an entry.

Parameters:
path_keystring

Reference to the entry.

get_format(path_key)[source]

Retrieve the type of a path entry.

Parameters:
path_keystring

reference to the entry

Returns:
string

File type.

get_path(path_key, *args)[source]

Retrieve an entry with substitutions.

Parameters:
path_keystring

Refer to the entry to retrieve.

argsany types, optional

arguments to be substituted into the path spec for %s, %d, etc.

Returns:
string

Path with parent structure and substitutions applied.

load_config(config, version=None)[source]

Load paths into the manifest from an Allen SDK config section.

Parameters:
configConfig

Manifest section of an Allen SDK config.

log = <Logger allensdk.config.manifest (WARNING)>
resolve_paths(description_dict, suffix='_key')[source]

Walk input items and expand those that refer to a manifest entry.

Parameters:
description_dictdict

Any entries with key names ending in suffix will be expanded.

suffixstring

Indicates the entries to be expanded.

classmethod safe_make_parent_dirs(file_name)[source]

Create a parent directories for file.

Parameters:
file_namestring
Returns:
leftmoststring

most rootward directory created

classmethod safe_mkdir(directory)[source]

Create path if not already there.

Parameters:
directorystring

create it if it doesn’t exist

Returns:
leftmoststring

most rootward directory created

exception allensdk.config.manifest.ManifestVersionError(message, version, found_version)[source]

Bases: Exception

property outdated