# Path: pykern/pkinspect.py
# _VALID_IDENTIFIER_RE = re.compile(r'^[a-z_]\w*$', re.IGNORECASE)
# class Call(PKDict):
#     def __init__(self, frame_or_log):
#     def __str__(self):
# def caller(ignore_modules=None, exclude_first=True):
# def caller_module(exclude_first=True):
# def is_caller_main():
# def is_valid_identifier(string):
# def module_basename(obj):
# def module_name_join(names):
# def module_name_split(obj):
# def module_functions(func_prefix, module=None):
# def root_package(obj):
# def submodule_name(obj):
# def this_module():
# 
# Path: pykern/pkio.py
# TEXT_ENCODING = 'utf-8'
# def atomic_write(path, contents, **kwargs):
# def exception_is_not_found(exc):
# def expand_user_path(path):
# def has_file_extension(filename, to_check):
# def mkdir_parent(path):
# def mkdir_parent_only(path):
# def open_text(filename, **kwargs):
# def py_path(path=None):
# def random_base62(length=16):
# def read_binary(filename):
# def read_text(filename):
# def save_chdir(dirname, mkdir=False, is_pkunit_prefix=False):
# def sorted_glob(path, key=None):
#     def _path_sort_attr(path):
# def unchecked_remove(*paths):
# def walk_tree(dirname, file_re=None):
#     def _walk(dirname):
# def write_binary(path, contents):
# def write_text(path, contents):
# 
# Path: pykern/pksetup.py
# PACKAGE_DATA = 'package_data'
# TOX_INI_FILE = 'tox.ini'
# SCRIPTS_DIR = 'scripts'
# TESTS_DIR = 'tests'
# _VERSION_RE = r'(\d{8}\.\d+)'
# class NullCommand(distutils.cmd.Command, object):
# class PKDeploy(NullCommand):
# class SDist(setuptools.command.sdist.sdist, object):
# class Test(setuptools.command.test.test, object):
# class Tox(setuptools.Command, object):
#     def initialize_options(*args, **kwargs):
#     def finalize_options(*args, **kwargs):
#     def run(*args, **kwargs):
#     def run(self):
#     def __assert_env(self, key, default=None):
#     def __is_unique_version(self, fn, repo):
#     def __run_cmd(self, cmd_name, **kwargs):
#     def __run_twine(self, **kwargs):
#     def check_readme(self, *args, **kwargs):
#     def finalize_options(self):
#     def run_tests(self):
#     def initialize_options(self, *args, **kwargs):
#     def finalize_options(self, *args, **kwargs):
#     def run(self, *args, **kwargs):
#     def _distribution_to_dict(self):
#     def _pyenv(self, params):
# def install_requires():
# def setup(**kwargs):
# def _check_output(*args, **kwargs):
# def _entry_points(pkg_name):
# def _extras_require(base):
# def _find_files(dirname):
# def _git_exists():
# def _git_ls_files(extra_args):
# def _merge_kwargs(base, kwargs):
# def _packages(name):
#     def _fullsplit(path, result=None):
# def _read(filename):
# def _readme():
# def _readthedocs_fixup():
# def _remove(path):
# def _sphinx_apidoc(base):
# def _state(base, kwargs):
# def _version(base):
# def _version_float(value):
# def _version_from_git(base):
# def _version_from_pkg_info(base):
# def _write(filename, content):


import errno
import glob
import importlib
import os.path
import pkg_resources
from pykern import pkinspect
from pykern import pkio
from pykern import pksetup
        packages (List[str]): Packages to search.

    Returns:
        str: absolute path of the resource file
    """
    assert not os.path.isabs(relative_filename), \
        'must not be an absolute file name={}'.format(relative_filename)
    a = []
    for f, p in _files(relative_filename, caller_context, packages):
        a.append(p)
        if os.path.exists(f):
            return f
    _raise_no_file_found(a, relative_filename)


def glob_paths(relative_path, caller_context=None, packages=None):
    """Find all paths that match the relative path in all packages

    Args:
        relative_path(str): Path relative to package_data directory.
        caller_context (object): Any object from which to get the `root_package`.
        packages (List[str]): Packages to search.
    Returns:
        py.path: absolute paths of the matched files
    """
    r = []
    a = []
    for f, p in _files(relative_path, caller_context, packages):
        a.append(p)
        r.extend(glob.glob(f))

# Path: pykern/pkinspect.py
# _VALID_IDENTIFIER_RE = re.compile(r'^[a-z_]\w*$', re.IGNORECASE)
# class Call(PKDict):
#     def __init__(self, frame_or_log):
#     def __str__(self):
# def caller(ignore_modules=None, exclude_first=True):
# def caller_module(exclude_first=True):
# def is_caller_main():
# def is_valid_identifier(string):
# def module_basename(obj):
# def module_name_join(names):
# def module_name_split(obj):
# def module_functions(func_prefix, module=None):
# def root_package(obj):
# def submodule_name(obj):
# def this_module():
# 
# Path: pykern/pkio.py
# TEXT_ENCODING = 'utf-8'
# def atomic_write(path, contents, **kwargs):
# def exception_is_not_found(exc):
# def expand_user_path(path):
# def has_file_extension(filename, to_check):
# def mkdir_parent(path):
# def mkdir_parent_only(path):
# def open_text(filename, **kwargs):
# def py_path(path=None):
# def random_base62(length=16):
# def read_binary(filename):
# def read_text(filename):
# def save_chdir(dirname, mkdir=False, is_pkunit_prefix=False):
# def sorted_glob(path, key=None):
#     def _path_sort_attr(path):
# def unchecked_remove(*paths):
# def walk_tree(dirname, file_re=None):
#     def _walk(dirname):
# def write_binary(path, contents):
# def write_text(path, contents):
# 
# Path: pykern/pksetup.py
# PACKAGE_DATA = 'package_data'
# TOX_INI_FILE = 'tox.ini'
# SCRIPTS_DIR = 'scripts'
# TESTS_DIR = 'tests'
# _VERSION_RE = r'(\d{8}\.\d+)'
# class NullCommand(distutils.cmd.Command, object):
# class PKDeploy(NullCommand):
# class SDist(setuptools.command.sdist.sdist, object):
# class Test(setuptools.command.test.test, object):
# class Tox(setuptools.Command, object):
#     def initialize_options(*args, **kwargs):
#     def finalize_options(*args, **kwargs):
#     def run(*args, **kwargs):
#     def run(self):
#     def __assert_env(self, key, default=None):
#     def __is_unique_version(self, fn, repo):
#     def __run_cmd(self, cmd_name, **kwargs):
#     def __run_twine(self, **kwargs):
#     def check_readme(self, *args, **kwargs):
#     def finalize_options(self):
#     def run_tests(self):
#     def initialize_options(self, *args, **kwargs):
#     def finalize_options(self, *args, **kwargs):
#     def run(self, *args, **kwargs):
#     def _distribution_to_dict(self):
#     def _pyenv(self, params):
# def install_requires():
# def setup(**kwargs):
# def _check_output(*args, **kwargs):
# def _entry_points(pkg_name):
# def _extras_require(base):
# def _find_files(dirname):
# def _git_exists():
# def _git_ls_files(extra_args):
# def _merge_kwargs(base, kwargs):
# def _packages(name):
#     def _fullsplit(path, result=None):
# def _read(filename):
# def _readme():
# def _readthedocs_fixup():
# def _remove(path):
# def _sphinx_apidoc(base):
# def _state(base, kwargs):
# def _version(base):
# def _version_float(value):
# def _version_from_git(base):
# def _version_from_pkg_info(base):
# def _write(filename, content):


# Path: pykern/pkresource.py
import errno
import glob
import importlib
import os.path
import pkg_resources
from pykern import pkinspect
from pykern import pkio
from pykern import pksetup

        packages (List[str]): Packages to search.

    Returns:
        str: absolute path of the resource file
    """
    assert not os.path.isabs(relative_filename), \
        'must not be an absolute file name={}'.format(relative_filename)
    a = []
    for f, p in _files(relative_filename, caller_context, packages):
        a.append(p)
        if os.path.exists(f):
            return f
    _raise_no_file_found(a, relative_filename)


def glob_paths(relative_path, caller_context=None, packages=None):
    """Find all paths that match the relative path in all packages

    Args:
        relative_path(str): Path relative to package_data directory.
        caller_context (object): Any object from which to get the `root_package`.
        packages (List[str]): Packages to search.
    Returns:
        py.path: absolute paths of the matched files
    """
    r = []
    a = []
    for f, p in _files(relative_path, caller_context, packages):
        a.append(p)
        r.extend(glob.glob(f))

    return [pkio.py_path(f) for f in r]