Data Paths (fixie_data.paths)

Manages paths for fixie data service.

fixie_data.paths.delete(path, user, token, **kwargs)[source]

Removes a path (and its file) from the server.

Parameters:

path : str

Path to remove.

user : str

Name of user to remove path for.

token : str

Token for a user.

kwargs : other key words

Passed into fixie.flock() when loading user paths file.

Returns:

status : bool

Whether the path can be fetched.

message : str

Status message, if needed.

fixie_data.paths.fetch(path, user, token, url=True, **kwargs)[source]

Retrieves a path from the server.

Parameters:

path : str

Path to retrieve.

user : str

Name of user to fetch a file for.

token : str

Token for a user.

url : boolean, optional

Whether to return a URL from which the file can be downloaded, or the bytes of the file itself.

kwargs : other key words

Passed into fixie.flock() when loading user paths file.

Returns:

url_or_file : str, bytes, or None

URL (relative to the server base) where the file may be downloaded (via GET), or the bytes of the file, or None if the status is False/

status : bool

Whether the path can be fetched.

message : str

Status message, if needed.

fixie_data.paths.gc(**kwargs)[source]

Cleans up paths & files that have past their holding time.

Parameters:

kwargs : other key words

Passed into fixie.flock() when loading user paths file.

Returns:

status : bool

Whether garbage collection completed.

message : str

Status message, if needed.

fixie_data.paths.info(user, token, paths=None, pattern=None, **kwargs)[source]

Retrieves metadata information for paths.

Parameters:

user : str

Name of user to list paths for.

token : str

Token for a user.

paths : str or list of str or None, optional

Only return info for specific paths. If non-empty, pattern must be empty.

pattern : str or None, optional

Glob string to match paths. If None or an empty string, all paths are returned. If non-empty, paths must be empty.

kwargs : other key words

Passed into fixie.flock() when loading user paths file.

Returns:

infos : list of dicts or None

Path infomation dicts. None if status is False.

status : bool

Whether the paths were correctly found.

message : str

Status message, if needed.

fixie_data.paths.listpaths(user, token, pattern=None, **kwargs)[source]

Lists paths for a user, matching a glob pattern if provided.

Parameters:

user : str

Name of user to list paths for.

token : str

Token for a user.

pattern : str or None, optional

Glob string to match paths. If None or an empty string, all paths are returned.

kwargs : other key words

Passed into fixie.flock() when loading user paths file.

Returns:

paths : list of str or None

Path names that matched the given pattern. None if status is False.

status : bool

Whether the paths were correctly found.

message : str

Status message, if needed.

fixie_data.paths.resolve_pending_paths(user, **kwargs)[source]

This function searches for any pending path files for a user and then adds their information into the users path file ($FIXIE_PATHS_DIR/user.json). This will return the contents of the paths file after the update. Pending path files must be names to match the glob: $FIXIE_PATHS_DIR/username*-pending-path.json. Additional keyword arguments are passed into fixie.flock(). Returns None if the user paths file could not be loaded.

fixie_data.paths.table(name, path, user, token, conds=None, format='dataframe', orient='columns', **kwargs)[source]

Retrieves a table from a path (which must represent a Cyclus database).

Parameters:

name : str

Name of table to retrieve.

path : str

Path to remove.

user : str

Name of user to remove path for.

token : str

Token for a user.

conds : list of 3-tuples or None, optional

Conditions to filter table rows with. See the Cyclus FullBackend for more information. The default (None) is to provide the complete table.

format : str, optional

Flag for type of object to return. If “dataframe” (default), a pandas DataFrame will be returned. If “json:dict”, a Python dict that is JSON serializable (via fixie.json) will be returned. If “json” or “json:str” a JSON string will be returned.

orient : str, optional

Flag for orientation that is passed into pandas.DataFrame.to_json() See this method for more documentation.

kwargs : other key words

Passed into fixie.flock() when loading user paths file.

Returns:

table : pandas.DataFrame or dict str or None

The contents of the table, structure depends on format and orient kwargs. None if table could not be loaded

status : bool

Whether the table could be loaded.

message : str

Status message, if needed.