Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
parser = ArgumentParser()
parser.add_argument("dist_name")
parser.add_argument("--index-url", "-i")
parser.add_argument("--extra-index-url")
parser.add_argument("--for-python", "-p", dest="env", type=python_interpreter)
parser.add_argument("--verbose", "-v", default=1, type=int, choices=range(3))
debug = {
"sys.argv": sys.argv,
"sys.executable": sys.executable,
"sys.version": sys.version,
"sys.path": sys.path,
"pip.__version__": pip.__version__,
"pip.__file__": pip.__file__,
}
args = parser.parse_args()
configure_logging(verbosity=args.verbose)
log.debug("runtime info", **debug)
result = get(dist_name=args.dist_name, index_url=args.index_url, env=args.env, extra_index_url=args.extra_index_url)
text = json.dumps(result, indent=2, sort_keys=True, separators=(",", ": "))
print(text)
parser.add_argument("req", help="The project name or requirement specifier")
parser.add_argument("--index-url", "-i")
parser.add_argument("--extra-index-url")
parser.add_argument(
"--output-format",
"-o",
choices=["human", "json", "yaml", "python", "toml", "pinned"],
default="human",
)
parser.add_argument(
"--no-deps", help="Don't recurse the dependency tree", dest="recurse", action="store_false"
)
parser.add_argument(
"--fields", "-f", nargs="*", default=default_fields, choices=list(FIELDS) + ["ALL"]
)
parser.add_argument("--for-python", "-p", dest="env", type=python_interpreter)
parser.add_argument("--verbose", "-v", default=1, type=int, choices=range(3))
parser.add_argument("--version", action="version", version="%(prog)s v{}".format(johnnydep.__version__))
args = parser.parse_args()
if "ALL" in args.fields:
args.fields = list(FIELDS)
configure_logging(verbosity=args.verbose)
dist = JohnnyDist(args.req, index_url=args.index_url, env=args.env, extra_index_url=args.extra_index_url)
print(dist.serialise(fields=args.fields, format=args.output_format, recurse=args.recurse))