Coverage for appr/display.py: 56%

# Coverage for appr/display.py : 56%

## 34 statements 19 run 15 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | from __future__ import absolute_import, division, print_function from tabulate import tabulate from appr.utils import colorize, get_media_type def print_packages(packages, registry_host=""): header = ['app', 'release', 'downloads', 'manifests'] table = [] for package in packages: release = package["default"] manifests = ", ".join(package['manifests']) table.append([ registry_host + "/" + package['name'], release, str(package.get('downloads', '-')), manifests]) return tabulate(table, header) def print_package_info(packages, extended=False): header = ["release", "manifest", "digest"] if extended: header = header + ["created_at", "size", "downloads"] table = [] for package in packages: row = [ package['release'], get_media_type(package['content']['mediaType']), package['content']['digest'], ] if extended: row = row + [ package['created_at'], package['content']['size'], package.get('downloads', '-'), ] table.append(row) return tabulate(table, header) def print_channels(channels): header = ['channel', 'release'] table = [] for channel in channels: table.append([channel['name'], channel['current']]) return tabulate(table, header) def print_deploy_result(table): header = ["package", "release", "type", "name", "namespace", "status"] for r in table: status = r.pop() r.append(colorize(status)) return tabulate(table, header)