Print torrent details
540129
def print_details(self):
		""""""
		print("Title:", self.title)
		print("Category:", self.category)
		print("Page: ", self.page)
		print("Size: ", self.size)
		print("Files: ", self.files)
		print("Age: ", self.age)
		print("Seeds:", self.seeders)
		print("Leechers: ", self.leechers)
		print("Magnet: ", self.magnet)
		print("Download: ", self.download)
		print("Verified:", self.isVerified)
321698
def run_it():
    """"""
    initialize()
    parser = get_parser()
    args = None
    first_parse = True
    while(True):
        if first_parse is True:
            first_parse = False
            args = parser.parse_args()
        else:
            print(textwrap.dedent(
                '''\
                Search again like in the beginning.
                  -- You can either choose best rated or list mode.
                  -- This time, you can insert the search string without double quotes.
                  Remember the list mode options!
                    0: torrent project.
                    1: the pirate bay.
                    2: 1337x.
                    3: eztv.
                    4: limetorrents.
                    5: isohunt.
                '''))

            print('Or.. if you want to exit just write "' +
                  Colors.LRED + 'Q' + Colors.ENDC + '" or "' +
                  Colors.LRED + 'q' + Colors.ENDC + '".')
            input_parse = input('>> ').replace("'", "").replace('"', '')
            if input_parse in ['Q', 'q']:
                sys.exit(1)

            args = parser.parse_args(input_parse.split(' ', 2))

        if args.str_search.strip() == "":
            print('Please insert an appropiate non-empty string.')
        else:
            auto = AutoPy(*insert(args))
            auto.get_content()
            auto.select_torrent()
            auto.download_torrent()
149963
public function result()
    {
        if ($this->_res === false) {
            return false;
        }

        $rows = [];

        $rows[] = array(
            'type' => 'header',
            'columns' => array(
                'Torrent',
                array(1, 'Done', '10%'),
                'State',
                'Have',
                'Uploaded',
                'Time Left',
                'Ratio',
                'Up',
                'Down',
            ),
        );

        if (count($this->_torrents) == 0) {
            $rows[] = array(
                'type' => 'none',
                'columns' => array(
                    array(9, 'None found'),
                ),
            );
        } else {

            $status_tally = [];

            $status_tally['Downloaded'] = 0;
            $status_tally['Uploaded'] = 0;

            foreach ($this->_torrents as $torrent) {

                $status_tally[$torrent['state']] = !array_key_exists($torrent['state'], $status_tally) ? 1 : $status_tally[$torrent['state']] + 1;
                $have_bytes = $torrent['have'];
                $uploaded_bytes = $torrent['uploaded'];

                if (is_numeric($have_bytes) && $have_bytes > 0 && is_numeric($uploaded_bytes) && $uploaded_bytes > 0) {
                    $status_tally['Downloaded'] += $have_bytes;
                    $status_tally['Uploaded'] += $uploaded_bytes;
                }

                $rows[] = array(
                    'type' => 'values',
                    'columns' => array(
                        wordwrap(htmlspecialchars($torrent['torrent']), 50, ' ', true),

                        '<div class="bar_chart">
                          <div class="bar_inner" style="width: '.(int) $torrent['done'].'%;">
                            <div class="bar_text">
                              '.($torrent['done'] ? $torrent['done'].'%' : '0%').'
                            </div>
                          </div>
                        </div>',

                        $torrent['state'],
                        $have_bytes !== false ? Common::byteConvert($have_bytes) : $torrent['have'],
                        $uploaded_bytes !== false ? Common::byteConvert($uploaded_bytes) : 'None',
                        $torrent['eta'] == -1 ? 'N/A' : Common::secondsConvert($torrent['eta']),
                        max(0, $torrent['ratio']),
                        Common::byteConvert($torrent['up']).'/s',
                        Common::byteConvert($torrent['down']).'/s',
                    ),
                );
            }

            $status_tally['Ratio'] = $status_tally['Downloaded'] > 0 && $status_tally['Uploaded'] > 0 ? round($status_tally['Uploaded'] / $status_tally['Downloaded'], 2) : 'N/A';
            $status_tally['Downloaded'] = $status_tally['Downloaded'] > 0 ? Common::byteConvert($status_tally['Downloaded']) : 'None';
            $status_tally['Uploaded'] = $status_tally['Uploaded'] > 0 ? Common::byteConvert($status_tally['Uploaded']) : 'None';

            if (count($status_tally) > 0) {

                $tally_contents = [];

                foreach ($status_tally as $state => $tally) {
                    $tally_contents[] = $state.': '.$tally;
                }

                $rows[] = array(
                    'type' => 'values',
                    'columns' => array(
                        array(9, implode(', ', $tally_contents)),
                    ),
                );
            }
        }

        if (
            is_array($this->_stats) &&
            array_key_exists('downloaded-bytes', $this->_stats) &&
            array_key_exists('uploaded-bytes', $this->_stats) &&
            array_key_exists('seconds-active', $this->_stats
        )) {
            $extra_vals = array(
                'title' => 'Transmission Stats',
                'values' => array(
                    array('Total Downloaded', Common::byteConvert($this->_stats['downloaded-bytes'])),
                    array('Total Uploaded', Common::byteConvert($this->_stats['uploaded-bytes'])),
                    $this->_stats['uploaded-bytes'] > 0 && $this->_stats['downloaded-bytes'] > 0 ? array('Total Ratio', round($this->_stats['uploaded-bytes'] / $this->_stats['downloaded-bytes'], 3)) : false,
                    array('Duration', Common::secondsConvert($this->_stats['seconds-active'])),
                ),
            );
        } else {
            $extra_vals = false;
        }

        return array(
            'root_title' => 'Transmission Torrents',
            'rows' => $rows,
            'extra_type' => 'k->v',
            'extra_vals' => $extra_vals,
        );
    }
141579
def download_message(self):
    """"""

    print('Failed to find any ImageNet %s files'% self.subset)
    print('')
    print('If you have already downloaded and processed the data, then make '
          'sure to set --data_dir to point to the directory containing the '
          'location of the sharded TFRecords.\n')
    print('If you have not downloaded and prepared the ImageNet data in the '
          'TFRecord format, you will need to do this at least once. This '
          'process could take several hours depending on the speed of your '
          'computer and network connection\n')
    print('Please see README.md for instructions on how to build '
          'the ImageNet dataset using download_and_preprocess_imagenet.\n')
    print('Note that the raw data size is 300 GB and the processed data size '
          'is 150 GB. Please ensure you have at least 500GB disk space.')
916811
public static void main(String[] args) {
		BasicConfigurator.configure(new ConsoleAppender(
			new PatternLayout("%d [%-25t] %-5p: %m%n")));

		CmdLineParser parser = new CmdLineParser();
		CmdLineParser.Option help = parser.addBooleanOption('h', "help");
		CmdLineParser.Option port = parser.addIntegerOption('p', "port");

		try {
			parser.parse(args);
		} catch (CmdLineParser.OptionException oe) {
			System.err.println(oe.getMessage());
			usage(System.err);
			System.exit(1);
		}

		// Display help and exit if requested
		if (Boolean.TRUE.equals((Boolean)parser.getOptionValue(help))) {
			usage(System.out);
			System.exit(0);
		}

		Integer portValue = (Integer)parser.getOptionValue(port,
			Integer.valueOf(Tracker.DEFAULT_TRACKER_PORT));

		String[] otherArgs = parser.getRemainingArgs();

		if (otherArgs.length > 1) {
			usage(System.err);
			System.exit(1);
		}

		// Get directory from command-line argument or default to current
		// directory
		String directory = otherArgs.length > 0
			? otherArgs[0]
			: ".";

		FilenameFilter filter = new FilenameFilter() {
			@Override
			public boolean accept(File dir, String name) {
				return name.endsWith(".torrent");
			}
		};

		try {
			Tracker t = new Tracker(portValue);

			File parent = new File(directory);
			for (File f : parent.listFiles(filter)) {
				logger.info("Loading torrent from " + f.getName());
				t.announce(TrackedTorrent.load(f));
			}

			logger.info("Starting tracker with {} announced torrents...",
				t.getTrackedTorrents().size());
			t.start(true);
		} catch (Exception e) {
			logger.error("{}", e.getMessage(), e);
			System.exit(2);
		}
	}
226533
def _printDescription(self, hrlinetop=True):
        """"""
        if hrlinetop:
            self._print("----------------")
        NOTFOUND = "[not found]"
        if self.currentEntity:
            obj = self.currentEntity['object']
            label = obj.bestLabel() or NOTFOUND
            description = obj.bestDescription() or NOTFOUND
            print(Style.BRIGHT + "OBJECT TYPE: " + Style.RESET_ALL +
                  Fore.BLACK + uri2niceString(obj.rdftype) + Style.RESET_ALL)
            print(Style.BRIGHT + "URI        : " + Style.RESET_ALL +
                  Fore.GREEN + "<" + unicode(obj.uri) + ">" + Style.RESET_ALL)
            print(Style.BRIGHT + "TITLE      : " + Style.RESET_ALL +
                  Fore.BLACK + label + Style.RESET_ALL)
            print(Style.BRIGHT + "DESCRIPTION: " + Style.RESET_ALL +
                  Fore.BLACK + description + Style.RESET_ALL)

        else:
            self._clear_screen()
            self._print("Graph: <" + self.current['fullpath'] + ">", 'TIP')
            self._print("----------------", "TIP")
            self._printStats(self.current['graph'])
            for obj in self.current['graph'].all_ontologies:
                print(Style.BRIGHT + "Ontology URI: " + Style.RESET_ALL +
                      Fore.RED + "<%s>" % str(obj.uri) + Style.RESET_ALL)
                # self._print("==> Ontology URI: <%s>" % str(obj.uri), "IMPORTANT")
                # self._print("----------------", "TIP")
                label = obj.bestLabel() or NOTFOUND
                description = obj.bestDescription() or NOTFOUND
                print(Style.BRIGHT + "Title       : " + Style.RESET_ALL +
                      Fore.BLACK + label + Style.RESET_ALL)
                print(Style.BRIGHT + "Description : " + Style.RESET_ALL +
                      Fore.BLACK + description + Style.RESET_ALL)
        self._print("----------------", "TIP")
780379
def main(show_details:['-l']=False, cols:['-w', '--width']='', *files):
    '''
    
    '''
    print(files)
    print(show_details)
    print(cols)
1016854
def do_create(config, config_dir):
    
    if os.path.exists(config_dir):
        print "Configuration '{}' already exists.".format(config)
        exit(1)
    os.makedirs(config_dir)
    print "Configuration directory created."

    url = raw_input("RSS URL for processing []: ")
    torrent_dir = raw_input("Output directory for found .torrent files [{}]: "\
        .format(DEFAULT_TORRRENT_DIR)) or DEFAULT_TORRRENT_DIR
    update_interval = raw_input("Update interval (mins) [{}]: "\
        .format(DEFAULT_UPDATE_INTERVAL)) or DEFAULT_UPDATE_INTERVAL

    editor = os.environ["EDITOR"]

    config_filter = os.path.join(config_dir, 'filter')
    if confirm("Do you want to create filters list?", False):
        call([editor, config_filter])
        print "Filter configuration has been saved."

    config_blacklist = os.path.join(config_dir, 'blacklist')
    if confirm("Do you want to create blacklist?", False):
        call([editor, config_filter])
        print "Blacklist configuration has been saved."

    config_file = os.path.join(config_dir, 'config')
    config_data = json.dumps({
        "url": url,
        "torrent_dir": torrent_dir,
        "update_interval": update_interval
    }, sort_keys=True, indent=4, separators=(',', ': '))
    with open(config_file, 'w') as f:
        f.write(config_data)

    ct = CronTab(user=True)
    cmd = "{} {} -e {}".format(sys.executable,
                               os.path.abspath(__file__),
                               config)
    job = ct.new(command=cmd)
    job.minute.every(update_interval)
    job.enable()
    ct.write()
    print "Crontab updated."

    print "Config '{}' has been saved.".format(config)
154078
def print_info(ds, ds_path=None):
    ""

    if ds_path is None:
        bname = ''
    else:
        bname = basename(ds_path)

    dashes = '-' * len(bname)
    print('\n{}\n{}\n{:full}'.format(dashes, bname, ds))

    return
1065639
def list(self, verbose=True):
        
        self._check()

        for tarinfo in self:
            if verbose:
                print(filemode(tarinfo.mode), end=' ')
                print("%s/%s" % (tarinfo.uname or tarinfo.uid,
                                 tarinfo.gname or tarinfo.gid), end=' ')
                if tarinfo.ischr() or tarinfo.isblk():
                    print("%10s" % ("%d,%d" \
                                    % (tarinfo.devmajor, tarinfo.devminor)), end=' ')
                else:
                    print("%10d" % tarinfo.size, end=' ')
                print("%d-%02d-%02d %02d:%02d:%02d" \
                      % time.localtime(tarinfo.mtime)[:6], end=' ')

            print(tarinfo.name + ("/" if tarinfo.isdir() else ""), end=' ')

            if verbose:
                if tarinfo.issym():
                    print("->", tarinfo.linkname, end=' ')
                if tarinfo.islnk():
                    print("link to", tarinfo.linkname, end=' ')
            print()
933436
def print_info(self):
        
        table = PrettyTable()
        start_string = "DutSerial {} \n".format(self.name)
        row = []
        info_string = ""
        if self.config:
            info_string = info_string + "Configuration for this DUT:\n\n {} \n".format(self.config)
        if self.comport:
            table.add_column("COM port", [])
            row.append(self.comport)
        if self.port:
            if hasattr(self.port, "baudrate"):
                table.add_column("Baudrate", [])
                row.append(self.port.baudrate)
            if hasattr(self.port, "xonxoff"):
                table.add_column("XON/XOFF", [])
                row.append(self.port.xonxoff)
            if hasattr(self.port, "timeout"):
                table.add_column("Timeout", [])
                row.append(self.port.timeout)
            if hasattr(self.port, "rtscts"):
                table.add_column("RTSCTS", [])
                row.append(self.port.rtscts)
        if self.location:
            table.add_column("Location", [])
            row.append("X = {}, Y = {}".format(self.location.x_coord, self.location.y_coord))
        self.logger.info(start_string)
        self.logger.debug(info_string)
        table.add_row(row)
        print(table)
185293
def print_http_nfc_lease_info(info):
    
    print 'Lease timeout: {0.leaseTimeout}\n' \
          'Disk Capacity KB: {0.totalDiskCapacityInKB}'.format(info)
    device_number = 1
    if info.deviceUrl:
        for device_url in info.deviceUrl:
            print 'HttpNfcLeaseDeviceUrl: {1}\n' \
                  'Device URL Import Key: {0.importKey}\n' \
                  'Device URL Key: {0.key}\n' \
                  'Device URL: {0.url}\n' \
                  'Device URL Size: {0.fileSize}\n' \
                  'SSL Thumbprint: {0.sslThumbprint}\n'.format(device_url,
                                                               device_number)
            if not device_url.targetId:
                print "No targetId found for this device"
                print "Device is not eligible for export. This could be a mounted iso or img of some sort"
                print "It will NOT be downloaded\n"

            device_number += 1
    else:
        print 'No devices were found.'
629047
def toc_print(self):
        """"""
        res = self.toc()
        for n, k, v in res:
            logging.info('Batch: {:7d} {:30s} {:s}'.format(n, k, v))
190817
def files(self):
        
        files = []
        info = self._struct.get('info')

        if not info:
            return files

        if 'files' in info:
            base = info['name']

            for f in info['files']:
                files.append(TorrentFile(join(base, *f['path']), f['length']))

        else:
            files.append(TorrentFile(info['name'], info['length']))

        return files
513100
def prt_detail(self):
        
        screen = [
            "Detail info of %s: " % self.abspath,
            "total size = %s" % string_SizeInBytes(self.size_total),
            "number of sub folders = %s" % self.num_folder_total,
            "number of total files = %s" % self.num_file_total,
            "lvl 1 file size = %s" % string_SizeInBytes(self.size_current),
            "lvl 1 folder number = %s" % self.num_folder_current,
            "lvl 1 file number = %s" % self.num_file_current,
        ]
        print("\n".join(screen))
462277
def print_app_info(out=sys.stderr):
    """"""
    print("System info:", file=out)
    print(configuration.App, file=out)
    print("Python %(version)s on %(platform)s" %
                    {"version": sys.version, "platform": sys.platform}, file=out)
    stime = strtime(time.time())
    print("Local time:", stime, file=out)
    print("sys.argv", sys.argv, file=out)
1054169
def stream_info(self) -> None:
        """"""
        stream_names = [stream_name for stream_name in dir(self)
                        if 'stream' in stream_name and stream_name != 'stream_info']
        logging.info('Found %s stream candidates: %s', len(stream_names), stream_names)
        for stream_name in stream_names:
            try:
                stream_fn = getattr(self, stream_name)
                logging.info(stream_name)
                batch = next(iter(stream_fn()))
                rows = []
                for key, value in batch.items():
                        try:
                            value_arr = np.array(value)
                            row = [key, value_arr.dtype, value_arr.shape]
                            if value_arr.dtype.kind in 'bui':  # boolean, unsigned, integer
                                row.append('{} - {}'.format(value_arr.min(), value_arr.max()))
                            elif value_arr.dtype.kind is 'f':
                                row.append('{0:.2f} - {1:.2f}'.format(value_arr.min(), value_arr.max()))
                        except ValueError:  # np broadcasting failed (ragged array)
                            value_arr = None
                            row = [key, '{}'.format(type(value[0]).__name__), '({},)'.format(len(list(value)))]

                        if value_arr is None or \
                                (value_arr.ndim > 0 and value_arr.shape[1:] != np.array(value_arr[0]).shape):
                            logging.warning('*** stream source `%s` appears to be ragged (non-rectangular) ***', key)

                        rows.append(row)
                for line in tabulate.tabulate(rows, headers=['name', 'dtype', 'shape', 'range'],
                                              tablefmt='grid').split('\n'):
                    logging.info(line)
            except Exception:
                logging.warning('Exception was raised during checking stream `%s`, '
                                '(stack trace is displayed only with --verbose flag)', stream_name)
                logging.debug(traceback.format_exc())