Table Of Contents

Previous topic

core.transforms.affines

Next topic

io.files

This Page

io.datasource

Module: io.datasource

Inheritance diagram for nipy.io.datasource:

Classes

Cache

class nipy.io.datasource.Cache(cachepath=None)

Bases: object

A file cache. The path of the cache can be specified or else use ~/.nipy/cache by default.

__init__(cachepath=None)
cache(uri)

Copy a file into the cache.

Returns:None
clear()

Delete all files in the cache.

Returns:None
filename(uri)

Return the complete path + filename within the cache.

Returns:string
filepath(uri)
Return the complete path + filename within the cache.
iscached(uri)

Check if a file exists in the cache.

Returns:bool
retrieve(uri)

Retrieve a file from the cache. If not already there, create the file and add it to the cache.

Returns:file
tempfile(suffix='', prefix='')
Return an temporary file name in the cache

DataSource

class nipy.io.datasource.DataSource(cachepath='.')

Bases: object

__init__(cachepath='.')
cache(pathstr)
exists(pathstr)
filename(pathstr)
open(pathstr, mode='r')
tempfile(suffix='', prefix='')
Return an temporary file name in the cache

Repository

class nipy.io.datasource.Repository(baseurl, cachepath=None)

Bases: nipy.io.datasource.DataSource

DataSource with an implied root.

__init__(baseurl, cachepath=None)
exists(pathstr)
filename(pathstr)
open(pathstr, mode='r')

Functions

nipy.io.datasource.ensuredirs(directory)

Ensure that the given directory path actually exists. If it doesn’t, create it.

Returns:None
nipy.io.datasource.isurl(pathstr)

Check whether a given string can be parsed as a URL.

Parameters:
pathstr : string

The string to be checked.

Returns:

bool

nipy.io.datasource.iswritemode(mode)

Test if the given mode will open a file for writing.

Parameters:
mode : string

The mode to be checked

Returns:

bool

nipy.io.datasource.iszip(filename)

Is this filename a zip file.

Returns:bool
nipy.io.datasource.splitzipext(filename)
return (base, zip_extension) from filename. If filename does not have a zip extention then base = filename and zip_extension = None
nipy.io.datasource.unzip(filename)

Unzip the given file into another file. Return the new file’s name.

Returns:string