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_key : string

Reference to the entry.

file_name : string

Subtitutions of the %s, %d style allowed.

dir_key : string

Reference to the parent directory entry.

path_format : string, 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:
key : string

Identifier for referencing the entry.

path : string

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

path_type : string enumeration

‘dir’ (default) or ‘file’

absolute : boolean

Is the spec relative to the process current directory.

path_format : string, optional

Indicate a known file type for further parsing.

parent_key : string

Refer to another entry.

add_paths(path_info)[source]

add information about paths stored in the manifest.

Parameters
path_info : dict
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_key : string

Reference to the entry.

do_exit : boolean

What to do if the directory is not present.

create_dir(path_key)[source]

Make a directory for an entry.

Parameters:
path_key : string

Reference to the entry.

get_format(path_key)[source]

Retrieve the type of a path entry.

Parameters:
path_key : string

reference to the entry

Returns:
string

File type.

get_path(path_key, *args)[source]

Retrieve an entry with substitutions.

Parameters:
path_key : string

Refer to the entry to retrieve.

args : any 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:
config : Config

Manifest section of an Allen SDK config.

log = <logging.Logger object>
resolve_paths(description_dict, suffix='_key')[source]

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

Parameters:
description_dict : dict

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

suffix : string

Indicates the entries to be expanded.

classmethod safe_make_parent_dirs(file_name)[source]

Create a parent directories for file.

Parameters:
file_name : string
classmethod safe_mkdir(directory)[source]

Create path if not already there.

Parameters:
directory : string

create it if it doesn’t exist

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

Bases: exceptions.Exception