/
snap
/
core22
/
2437
/
usr
/
lib
/
python3
/
dist-packages
/
cloudinit
/
/snap/core22/2437/usr/lib/python3/dist-packages/cloudinit
mkdir
upload
Name
Size
Mode
Actions
analyze/
-
0755
rm
cmd/
-
0755
rm
config/
-
0755
rm
distros/
-
0755
rm
filters/
-
0755
rm
handlers/
-
0755
rm
log/
-
0755
rm
mergers/
-
0755
rm
net/
-
0755
rm
reporting/
-
0755
rm
sources/
-
0755
rm
__pycache__/
-
0755
rm
apport.py
8496
0644
edit
dl
rm
atomic_helper.py
2860
0644
edit
dl
rm
cloud.py
3296
0644
edit
dl
rm
dmi.py
8002
0644
edit
dl
rm
event.py
2051
0644
edit
dl
rm
features.py
5763
0644
edit
dl
rm
gpg.py
8186
0644
edit
dl
rm
helpers.py
16547
0644
edit
dl
rm
importer.py
2485
0644
edit
dl
rm
lifecycle.py
7979
0644
edit
dl
rm
netinfo.py
24646
0644
edit
dl
rm
performance.py
3175
0644
edit
dl
rm
persistence.py
2583
0644
edit
dl
rm
registry.py
1022
0644
edit
dl
rm
safeyaml.py
10349
0644
edit
dl
rm
settings.py
2172
0644
edit
dl
rm
signal_handler.py
3027
0644
edit
dl
rm
simpletable.py
1976
0644
edit
dl
rm
socket.py
5991
0644
edit
dl
rm
ssh_util.py
22983
0644
edit
dl
rm
stages.py
42526
0644
edit
dl
rm
subp.py
12658
0644
edit
dl
rm
templater.py
7930
0644
edit
dl
rm
temp_utils.py
3013
0644
edit
dl
rm
type_utils.py
703
0644
edit
dl
rm
url_helper.py
39164
0644
edit
dl
rm
user_data.py
14784
0644
edit
dl
rm
util.py
92907
0644
edit
dl
rm
version.py
564
0644
edit
dl
rm
warnings.py
3853
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/snap/core22/2437/usr/lib/python3/dist-packages/cloudinit/simpletable.py
(1976B)
# Copyright (C) 2017 Amazon.com, Inc. or its affiliates # # Author: Ethan Faust <efaust@amazon.com> # Author: Andrew Jorgensen <ajorgens@amazon.com> # # This file is part of cloud-init. See LICENSE file for license information. class SimpleTable: """A minimal implementation of PrettyTable for distribution with cloud-init. """ def __init__(self, fields): self.fields = fields self.rows = [] # initialize list of 0s the same length # as the number of fields self.column_widths = [0] * len(self.fields) self.update_column_widths(fields) def update_column_widths(self, values): for i, value in enumerate(values): self.column_widths[i] = max(len(value), self.column_widths[i]) def add_row(self, values): if len(values) > len(self.fields): raise TypeError("too many values") values = [str(value) for value in values] self.rows.append(values) self.update_column_widths(values) def _hdiv(self): """Returns a horizontal divider for the table.""" return ( "+" + "+".join(["-" * (w + 2) for w in self.column_widths]) + "+" ) def _row(self, row): """Returns a formatted row.""" return ( "|" + "|".join( [ col.center(self.column_widths[i] + 2) for i, col in enumerate(row) ] ) + "|" ) def __str__(self): """Returns a string representation of the table with lines around. +-----+-----+ | one | two | +-----+-----+ | 1 | 2 | | 01 | 10 | +-----+-----+ """ lines = [self._hdiv(), self._row(self.fields), self._hdiv()] lines += [self._row(r) for r in self.rows] + [self._hdiv()] return "\n".join(lines) def get_string(self): return self.__str__()
Save
cmd:
run