<commit_before>"""S3pac command line tool.

Usage:
  s3pac [--server=<url>] add <repo> <pkgfile> [<sigfile>]
  s3pac [--server=<url>] remove <repo> <arch> <name>
  s3pac [--server=<url>] show <repo> <arch> <name>
  s3pac [--server=<url>] list [--full] <repo> [<key>=<value>]...

Options:
  -h --help         Show this screen.
  --version         Show version.
  -s --server=<url> Use URL a base server (default http://127.0.0.1:9111/).
  --full            Display full metadata for each package.
"""
import os, sys
import json
import requests
from dateutil import parser as dateparser
from docopt import docopt
from urllib import parse as urlparse

DEFAULT_SERVER = "http://127.0.0.1:9111/"

UNITS = ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')

def _human_readable_size(size):
    unit = 0
    while size > 2048.0 and unit+1 < len(UNITS):
        size /= 1024.0
        unit += 1
    return "%.2f %s" % (size, UNITS[unit])

def _make_url(opts, urlpath):
    server = opts.get('server', DEFAULT_SERVER)
    return urlparse.urljoin(server, urlpath)

def _print_package(pkg):
    NEWLINE = "\n" + " " * 17
    validations = []
    if pkg['md5sum']:
        validations.append("MD5 Sum")
    if pkg['sha256sum']:
        validations.append("SHA256 Sum")
    if pkg['pgpsig']:
        validations.append("Signature")<commit_msg>cli: Fix --server option not being honored<commit_after>"""S3pac command line tool.

Usage:
  s3pac [--server=<url>] add <repo> <pkgfile> [<sigfile>]
  s3pac [--server=<url>] remove <repo> <arch> <name>
  s3pac [--server=<url>] show <repo> <arch> <name>
  s3pac [--server=<url>] list [--full] <repo> [<key>=<value>]...

Options:
  -h --help         Show this screen.
  --version         Show version.
  -s --server=<url> Use URL a base server (default http://127.0.0.1:9111/).
  --full            Display full metadata for each package.
"""
import os, sys
import json
import requests
from dateutil import parser as dateparser
from docopt import docopt
from urllib import parse as urlparse

DEFAULT_SERVER = "http://127.0.0.1:9111/"

UNITS = ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')

def _human_readable_size(size):
    unit = 0
    while size > 2048.0 and unit+1 < len(UNITS):
        size /= 1024.0
        unit += 1
    return "%.2f %s" % (size, UNITS[unit])

def _make_url(opts, urlpath):
    server = opts['--server'] or DEFAULT_SERVER
    return urlparse.urljoin(server, urlpath)

def _print_package(pkg):
    NEWLINE = "\n" + " " * 17
    validations = []
    if pkg['md5sum']:
        validations.append("MD5 Sum")
    if pkg['sha256sum']:
        validations.append("SHA256 Sum")
    if pkg['pgpsig']:
        validations.append("Signature")
{'fraction_non_alphanumeric': 0.17078568793803026, 'fraction_numerical': 0.03614902250092217, 'mean_word_length': 3.0417287630402385, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3042462', 'n_tokens_mistral': 1061, 'n_tokens_neox': 971, 'n_words': 274}