File: __init__.py

package info (click to toggle)
python-weblogo 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,764 kB
  • sloc: xml: 14,455; python: 11,164; sh: 140; makefile: 67
file content (20 lines) | stat: -rwxr-xr-x 407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from io import StringIO
from typing import TextIO

import importlib_resources


def data_string(name: str) -> bytes:
    ref = data_ref(name)
    with ref.open() as f:
        data = f.read()
    return data


def data_stream(name: str) -> TextIO:
    return StringIO(data_string(name))


def data_ref(name: str):
    ref = importlib_resources.files(__name__).joinpath("data").joinpath(name)
    return ref