Add node.
A node is added to the node_list.
Parameters: | path : str, optional
node_type : str, optional {“run”, “project”}
name : str, optional children : list, optional parents : list, optional strategy : str, optional
|
---|---|
Returns: | node_list |
Add run node to node_list.
Parameters: | path : str
tag : str, optional
name : str, optional
comment : str, optional
|
---|
Make the node belong to the project specified by project id.
We realize “tagging” feature by project nodes.
Parameters: | node_path : str
project_id: str
|
---|
Add comment to node spedcified path.
Parameters: | comment : str
node_path : str
|
---|
Examples
>>> node_list = [{"path": "/path/to/hoge"},
... {"path": "/path/to/hogehoge"}]
>>> add(node_list, "some comments", "/path/to/hoge") == [
... {"path": "/path/to/hoge", "comment": "some comments"},
... {"path": "/path/to/hogehoge"}]
True
>>> add(node_list, "some comments aho", "/path/to/hogehom")
Traceback (most recent call last):
...
DataProcessorError: 'There is no node with specified path: /path/to/hogehom'
Get filetype from path (filename extension).
Parameters: | path: str
|
---|---|
Returns: | filetype as a string. |
Load configure
Parameters: | filename : str
section : str
|
---|
Examples
>>> load(node_list, "configure.conf")
>>> # Change load section.
>>> load(node_list, "configure.conf", "defaults")
Load configure
Parameters: | filename : str
split_char : str
comment_char : str
|
---|
Examples
>>> no_section(node_list, "foo.conf")
>>> # Change deliminator and comment line signal
>>> no_section(node_list, "foo.conf", split_char=":", comment_char="!")
...
Parse .ini and .conf to dictionary
Parameters: | confpath : str
section : str
|
---|---|
Returns: | Specified section as a dictionary. |
Move node like as UNIX mv.
Change path of a node and related nodes. Coresponding directories are also moved or renamed.
Parameters: | from_path : str
dest : str
|
---|---|
Raises: | DataProcessorError
|
Scan directories as nodes.
Scan nodes from all directories under the directory ‘root’.
If one directory has properties of both of ‘run’ and ‘project’, type of the directory is set to ‘run’.
Parameters: | root : str
whitelist : list of str or str
followlinks : {‘False’, ‘True’}, optional
|
---|---|
Returns: | node_list |
Examples
>>> # Initialize node_list.
>>> node_list = directory([], "scandir_path", ["data/hoge*", "*foo*"])
>>> # Rescan node_list.
>>> node_list = [
... {'path': '/tmp/scan_dir/run0',
... 'parents': [], # empty
... 'children': [], # empty
... 'name': 'run0',
... 'type': 'run'}]
>>> node_list = directory([], "scandir_path", ["*.conf"])
Show project list.
Parameters: | show_format : str, optional
|
---|---|
Returns: | node_list |
Show run list.
Parameters: | project : str or [str], optional
show_format: str, optional
parameters: [str], optional
|
---|---|
Returns: | node_list |
Untag the node.
Parameters: | path : str
project_id : str
|
---|---|
Raises: | DataProcessorError
|
@pipes