How to use the pybase64.get_version function in pybase64

To help you get started, we’ve selected a few pybase64 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 mayeut / pybase64 / pybase64 / __main__.py View on Github external
def main(args=None):
    # main parser
    parser = argparse.ArgumentParser(
        prog=__package__,
        description=__package__ + ' command-line tool.')
    parser.add_argument(
        '-V', '--version',
        action='version',
        version=__package__ + ' ' + pybase64.get_version())
    parser.add_argument(
        '--license',
        action=LicenseAction,
        license=pybase64.get_license_text())
    # create sub-parsers
    subparsers = parser.add_subparsers(help='tool help')
    # benchmark parser
    benchmark_parser = subparsers.add_parser('benchmark', help='-h for usage')
    benchmark_parser.add_argument(
        '-d', '--duration',
        metavar='D',
        dest='duration',
        type=float,
        default=1.0,
        help='expected duration for a single encode or decode test')
    benchmark_parser.add_argument(
github mayeut / pybase64 / pybase64 / __main__.py View on Github external
def benchmark(args):
    print(__package__ + ' ' + pybase64.get_version())
    data = readall(args.input)
    for altchars in [None, b'-_']:
        for validate in [False, True]:
            print('bench: altchars={0:s}, validate={1:s}'.format(
                  repr(altchars), repr(validate)))
            bench_one(args.duration,
                      data,
                      pybase64.b64encode,
                      pybase64.b64decode,
                      pybase64.encodebytes,
                      altchars,
                      validate)
            bench_one(args.duration,
                      data,
                      base64.b64encode,
                      b64decodeValidate,