# -*- coding: utf-8 -*-

"""
yaspin.spinners
~~~~~~~~~~~~~~~

A collection of cli spinners.
"""

import codecs
import os
from collections import namedtuple

try:
    import simplejson as json
except ImportError:
    import json


THIS_DIR = os.path.dirname(os.path.realpath(__file__))
SPINNERS_PATH = os.path.join(THIS_DIR, "data/spinners.json")


def _hook(dct):
    return namedtuple("Spinner", dct.keys())(*dct.values())


with codecs.open(SPINNERS_PATH, encoding="utf-8") as f:
    Spinners = json.load(f, object_hook=_hook)

# -*- coding: utf-8 -*-

"""
yaspin.spinners
~~~~~~~~~~~~~~~

A collection of cli spinners.
"""

import codecs
import pkgutil
from collections import namedtuple

try:
    import simplejson as json
except ImportError:
    import json


THIS_DIR = os.path.dirname(os.path.realpath(__file__))
SPINNERS_DATA = pkgutil.get_data(__package__, "data/spinners.json").decode("utf-8")


def _hook(dct):
    return namedtuple("Spinner", dct.keys())(*dct.values())


Spinners = json.loads(SPINNERS_DATA, object_hook=_hook)

Allow use inside zip bundled package
Allow use inside zip bundled package