Module refinery.lib.resources

A wrapper module to read local data resources.

Expand source code Browse git
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A wrapper module to read local data resources.
"""
from importlib import resources

import sys


def datapath(name: str):
    if sys.version_info >= (3, 9):
        from refinery import data
        return resources.files(data).joinpath(name)
    with resources.path('refinery', 'data') as data:
        return data / name

Functions

def datapath(name)
Expand source code Browse git
def datapath(name: str):
    if sys.version_info >= (3, 9):
        from refinery import data
        return resources.files(data).joinpath(name)
    with resources.path('refinery', 'data') as data:
        return data / name