Source code for exatomic.exa.static

# -*- coding: utf-8 -*-
# Copyright (c) 2015-2022, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Static Data Directory
#############################################
Provide the location of the static data.
"""
import os


[docs]def staticdir(): """Return the location of the static data directory.""" root = os.path.abspath(os.path.dirname(__file__)) return os.path.join(root, "static")
[docs]def resource(name): """ Return the full path of a named resource in the static directory. If multiple files with the same name exist, **name** should contain the first directory as well. .. code-block:: python resource("myfile") resource("test01/test.txt") resource("test02/test.txt") """ for path, _, files in os.walk(staticdir()): if name in files: return os.path.abspath(os.path.join(path, name))