lisc.io.db.create_file_structure¶
- lisc.io.db.create_file_structure(base=None, name='lisc_db', structure={1: {'base': ['terms', 'logs', 'data', 'figures']}, 2: {'data': ['counts', 'words']}, 3: {'words': ['raw', 'summary']}})[source]¶
Create the file structure for a SCANR database.
- Parameters
- basestr or Path or None
Base path for the database directory. If None, the structure is created in the current directory.
- namestr, optional, default: ‘lisc_db’
The name of the root folder of the directory structure.
- Returns
- dbSCDB
A database object for the file structure that was created.
Examples
Create a temporary file structure for a
SCDB
object:>>> import os >>> from tempfile import TemporaryDirectory >>> with TemporaryDirectory() as dirpath: ... db = create_file_structure(dirpath) ... for path, _, _ in os.walk(dirpath): ... print(path[len(dirpath)+1:]) lisc_db lisc_db/figures lisc_db/data lisc_db/data/words lisc_db/data/words/summary lisc_db/data/words/raw lisc_db/data/counts lisc_db/logs lisc_db/terms