def files(args):
    """List files from a device, with the option to filter them by a
    process that can access them."""
    # Setup logging
    if args.verbosity == 4:
        logging.basicConfig(level=logging.DEBUG)
    elif args.verbosity == 3:
        logging.basicConfig(level=logging.INFO)
    elif args.verbosity == 2:
        logging.basicConfig(level=logging.WARNING)
    elif args.verbosity == 1:
        logging.basicConfig(level=logging.ERROR)
    elif args.verbosity == 0:
        logging.basicConfig(level=logging.CRITICAL)
    # Start initialization
    # Create the device
    try:
        device = get_device(args.device, args.adb)
    except (__HOLE__, ValueError):
        sys.exit(1)
    # Workaround, make sure we propagate the device name
    if not args.device:
        args.device = device.name
    # End initialization

    if not args.pid and not args.process:
        # Just list all the files
        files_dict = device.get_files()
        print_files(args, None, files_dict, None)
    else:
        # Create the policy
        try:
            p = Policy(device)
        except (ValueError, RuntimeError):
            logging.critical("You need to provide a running Android device.")
            sys.exit(1)
        # Filter the files by process
        process = process_picker(args, device.get_processes())
        if process is None:
            if args.pid:
                logging.critical("There is no process with PID %s running "
                                 "on the device.", args.pid)
            elif args.process:
                logging.critical("There is no process \"%s\" running "
                                 "on the device", args.process)
            sys.exit(1)
        logging.info("The \"%s\" process with PID %s is running in the "
                     "\"%s\" context", process.name, process.pid,
                     process.context)
        files_dict = device.get_files()
        file_permissions = get_process_permissions(p, process, files_dict)
        print_files(args, process, files_dict, file_permissions)
dataset/ETHPy150Open seandroid-analytics/seal/seal.py/files