oneibl.onelight¶
ONE light.
Functions
Interactive prompt to add a repository. |
|
Path to the config directory. |
|
Path to the config file. |
|
Return an empty configuration dictionary. |
|
Default download directory on the client computer, with {…} placeholders fields. |
|
Return the download directory. |
|
Download a file from HTTP and save it to a file. |
|
Perform a REST request against the figshare API. |
|
Iterate over all session directories found in a root directory. |
|
Iterate over all files within session directories found within a root directory. |
|
Replace the placeholder fields in the download directory by the appropriate values for a given session. |
|
Return the config file dictionary. |
|
Get the singleton One instance, loading it from the config file, or using the singleton instance if it has already been instantiated. |
|
Get a repository by its name. |
|
Return whether a file path is within a session directory. |
|
Return whether a path is a session directory. |
|
Load a single file. |
|
Make a root TSV file for an HTTP server. |
|
Path to the local directory of the repository. |
|
Get the current repository. |
|
Set the config file. |
|
Get or create a figshare repo with a given figshare URL. |
|
Set the current repository. |
|
Update a repository. |
|
Iterate over all files found within a root directory. |
|
Classes
A subclass of dictionary with an additional dot syntax. |
|
-
class
Bunch
(*args, **kwargs)[source]¶ Bases:
dict
A subclass of dictionary with an additional dot syntax.
Get or create a figshare repo with a given figshare URL.
-
is_session_dir
(path)[source]¶ Return whether a path is a session directory.
Example of a session dir: /path/to/root/mainenlab/Subjects/ZM_1150/2019-05-07/001/
-
find_session_files
(root)[source]¶ Iterate over all files within session directories found within a root directory.
-
make_http_root_file
(root, base_url, output)[source]¶ Make a root TSV file for an HTTP server.
Note: the session root directory needs to be the directory that contains the <lab> subdirectories, so that the relative file paths are correctly obtained.
-
download_file
(url, save_to, auth=None, log_level=10)[source]¶ Download a file from HTTP and save it to a file. If Basic HTTP authentication is needed, pass auth=(username, password).
-
default_download_dir
()[source]¶ Default download directory on the client computer, with {…} placeholders fields.
-
format_download_dir
(session, download_dir)[source]¶ Replace the placeholder fields in the download directory by the appropriate values for a given session.
-
class
FtpUploader
(host, login=None, password=None, port=21, remote_root=None)[source]¶ Bases:
object
-
class
HttpOne
(root_file=None, download_dir=None, auth=None)[source]¶ Bases:
object
-
search
(dataset_types=(), **kwargs)[source]¶ Search all sessions that have all requested dataset types.
-
-
class
LocalOne
(root_dir)[source]¶ Bases:
oneibl.onelight.HttpOne
Perform a REST request against the figshare API.
Bases:
object
Iterate over all ALF files of a given figshare article.
Upload to figshare all session files found in a root directory.
Clean up and publish the figshare article.
Bases:
oneibl.onelight.HttpOne
-
get_one
(private=False)[source]¶ Get the singleton One instance, loading it from the config file, or using the singleton instance if it has already been instantiated.