summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-08-24 11:08:05 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2016-08-24 11:14:41 +0300
commite9e2f54f27baeecc009c1f6a30baf80143d9ca2d (patch)
tree30e281cd3ef975bd83a4f08c3ca73330045ec69f
parentccefd3b1c3c4a712eb34313f6841ac36dc2f76da (diff)
downloadastroid-git-e9e2f54f27baeecc009c1f6a30baf80143d9ca2d.tar.gz
Export two helpers for verifying the type of a spec.
-rw-r--r--astroid/modutils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/astroid/modutils.py b/astroid/modutils.py
index 80a88e68..bbfaf81b 100644
--- a/astroid/modutils.py
+++ b/astroid/modutils.py
@@ -630,3 +630,10 @@ def _has_init(directory):
if os.path.exists(mod_or_pack + '.' + ext):
return mod_or_pack + '.' + ext
return None
+
+
+def is_namespace(specobj):
+ return specobj.type == spec.ModuleType.PY_NAMESPACE
+
+def is_directory(specobj):
+ return specobj.type == spec.ModuleType.PKG_DIRECTORY