{ "cells": [ { "cell_type": "markdown", "id": "e93ec3be-9e45-4540-88fc-370310b3273b", "metadata": {}, "source": [ "# User directories\n", "\n", "The `h5rdmtoolbox` uses a couple of local directories to store temporary files or manage cache files." ] }, { "cell_type": "code", "execution_count": 1, "id": "2190644a-d72a-4aa4-b6b3-e61fe9f496e1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Failed to import module h5tbx\n" ] } ], "source": [ "import h5rdmtoolbox as h5tbx" ] }, { "cell_type": "markdown", "id": "c6a80526-de72-4c29-b484-82ba6ae4ad15", "metadata": {}, "source": [ "The `UserDir` variable manages the paths. The `__repr__` indicates the different paths:" ] }, { "cell_type": "code", "execution_count": 2, "id": "f9b2d695-b91e-486a-89d9-02d3b6a16c59", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "DirManger(root, tmp, convention, layouts, repository, standard_name_tables, cache)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h5tbx.UserDir" ] }, { "cell_type": "markdown", "id": "6efea3fa-b401-49d9-92b1-7c54456413f8", "metadata": {}, "source": [ "## Examples\n", "Temporary files, e.g. created when empty `h5tbx.File` objects are created, will be put here:" ] }, { "cell_type": "code", "execution_count": 6, "id": "8eb9f616-2efc-463a-9915-b668f64958e0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "WindowsPath('C:/Users/Matthias/AppData/Local/h5rdmtoolbox/h5rdmtoolbox/tmp/tmp_0')" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h5tbx.UserDir['tmp']" ] }, { "cell_type": "markdown", "id": "3c6b0e27-5236-4102-9fbe-ea0873bba947", "metadata": {}, "source": [ "Let's check it: " ] }, { "cell_type": "code", "execution_count": 10, "id": "a59dc11f-85b3-4db1-9642-5daa7a05307e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "WindowsPath('C:/Users/Matthias/AppData/Local/h5rdmtoolbox/h5rdmtoolbox/tmp/tmp_0/tmp2.hdf')" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "with h5tbx.File() as h5:\n", " filename = h5.hdf_filename\n", "filename" ] }, { "cell_type": "markdown", "id": "c50b5275-ce80-403b-91ce-88c904497b4d", "metadata": {}, "source": [ "Tokens for repositories, e.g. Zenodo, should be put here:" ] }, { "cell_type": "code", "execution_count": 7, "id": "ca53b6db-6f20-4500-91a7-1f738fd6bb5d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "WindowsPath('C:/Users/Matthias/AppData/Local/h5rdmtoolbox/h5rdmtoolbox/repository')" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h5tbx.UserDir['repository']" ] }, { "cell_type": "code", "execution_count": null, "id": "3f703cb7-7f4d-49b0-a12f-18b3a9fa9cd6", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.19" } }, "nbformat": 4, "nbformat_minor": 5 }