Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# and block on stdin.
try:
sys.stdin.close()
except:
pass
if not args.http and args.module_name is None:
_eprint('No module name specified.')
sys.exit(1)
if args.template_dir is not None:
pdoc.tpl_lookup.directories.insert(0, args.template_dir)
# If PYTHONPATH is set, let it override everything if we want it to.
pypath = os.getenv('PYTHONPATH')
if args.only_pypath and pypath is not None and len(pypath) > 0:
pdoc.import_path = pypath.split(path.pathsep)
docfilter = None
if args.ident_name and len(args.ident_name.strip()) > 0:
search = args.ident_name.strip()
def docfilter(o):
rname = o.refname
if rname.find(search) > -1 or search.find(o.name) > -1:
return True
if isinstance(o, pdoc.Class):
return search in o.doc or search in o.doc_init
return False
# Try to do a real import first. I think it's better to prefer
# import paths over files. If a file is really necessary, then
# specify the absolute path, which is guaranteed not to be a