summaryrefslogtreecommitdiff
path: root/astroid/interpreter/_import/util.py
blob: 87828a1d19bab8dc0ae2a87bfe7f10f223a2242e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Copyright (c) 2016, 2018 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2021 Neil Girdhar <mistersheik@gmail.com>

try:
    import pkg_resources
except ImportError:
    pkg_resources = None


def is_namespace(modname):
    return (
        pkg_resources is not None
        and hasattr(pkg_resources, "_namespace_packages")
        and modname in pkg_resources._namespace_packages
    )