How to use the vermin.printing.vprint function in vermin

To help you get started, we’ve selected a few vermin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netromdk / vermin / vermin / main.py View on Github external
# Detect paths, remove duplicates, and sort for deterministic results.
  vprint("Detecting python files..")
  paths = [abspath(p) for p in args["paths"]]
  paths = list(set(detect_paths(paths, args["hidden"])))
  paths.sort()

  amount = len(paths)
  if amount == 0:
    print("No files specified to analyze!")
    sys.exit(1)

  msg = "Analyzing"
  if amount > 1:
    msg += " {} files".format(amount)
  vprint("{} using {} processes..".format(msg, processes))

  try:
    processor = Processor()
    (mins, incomp, unique_versions, backports) = processor.process(paths, processes)
  except KeyboardInterrupt:
    print("Aborting..")
    sys.exit(1)

  if incomp and not config.ignore_incomp():
    nprint("Note: Some files had incompatible versions so the results might not be correct!")

  incomps = []
  reqs = []
  for i in range(len(mins)):
    ver = mins[i]
    if ver is None:
github netromdk / vermin / vermin / main.py View on Github external
config = Config.get()

  args = Arguments(sys.argv[1:]).parse()
  if "usage" in args:
    Arguments.print_usage(args["full"])
    sys.exit(args["code"])

  if args["code"] != 0:
    sys.exit(args["code"])

  processes = args["processes"]
  targets = args["targets"]
  no_tips = args["no-tips"]

  # Detect paths, remove duplicates, and sort for deterministic results.
  vprint("Detecting python files..")
  paths = [abspath(p) for p in args["paths"]]
  paths = list(set(detect_paths(paths, args["hidden"])))
  paths.sort()

  amount = len(paths)
  if amount == 0:
    print("No files specified to analyze!")
    sys.exit(1)

  msg = "Analyzing"
  if amount > 1:
    msg += " {} files".format(amount)
  vprint("{} using {} processes..".format(msg, processes))

  try:
    processor = Processor()
github netromdk / vermin / vermin / processor.py View on Github external
for ver in proc_res.mins:
        if ver is not None and ver > (0, 0):
          unique_versions.add(ver)

      # Indent subtext.
      subtext = ""
      if len(proc_res.text) > 0:
        # Keep newlines and throw away dups.
        lines = list(set(proc_res.text.splitlines(True)))
        lines.sort()
        subtext = "\n  " + "  ".join(lines)
        if not subtext.endswith("\n"):
          subtext += "\n"

      vprint("{:<12} {}{}".format(version_strings(proc_res.mins), proc_res.path, subtext))
      try:
        mins = combine_versions(mins, proc_res.mins)
      except InvalidVersionException:
        incomp = True
        print_incomp(proc_res.path)

    pool.close()

    unique_versions = list(unique_versions)
    unique_versions.sort()
    return (mins, incomp, unique_versions, all_backports)