MCPcopy Create free account
hub / github.com/aws/aws-cli / dump

Method dump

awscli/formatter.py:120–133  ·  view source on GitHub ↗
(self, value, stream)

Source from the content-addressed store, hash-verified

118 self._yaml.representer.default_flow_style = False
119
120 def dump(self, value, stream):
121 if self._is_json_scalar(value) or isinstance(value, datetime):
122 # YAML will attempt to disambiguate scalars by ending the stream
123 # with an elipsis. While this is technically valid YAML,
124 # it's not particularly useful. Unfortunately there's no
125 # universal way around this, so instead we just json dump the
126 # values. Also note that datetimes are explicitly not supported
127 # - the json dumper will complain if you pass them in. datetime
128 # values should respect the cli timestamp format, which is
129 # impossible to do from the Formatter.
130 json.dump(value, stream, ensure_ascii=False, default=json_encoder)
131 stream.write('\n')
132 else:
133 self._yaml.dump(value, stream)
134
135 def _is_json_scalar(self, value):
136 if value is None:

Callers 15

update_metadataMethod · 0.45
update_metadataFunction · 0.45
setUpMethod · 0.45
setUpMethod · 0.45
setUpMethod · 0.45
setUpMethod · 0.45
test_dump_intMethod · 0.45
test_dump_floatMethod · 0.45
test_dump_boolMethod · 0.45
test_dump_strMethod · 0.45
test_dump_structureMethod · 0.45
test_dump_listMethod · 0.45

Calls 2

_is_json_scalarMethod · 0.95
writeMethod · 0.45

Tested by 12

setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
test_dump_intMethod · 0.36
test_dump_floatMethod · 0.36
test_dump_boolMethod · 0.36
test_dump_strMethod · 0.36
test_dump_structureMethod · 0.36
test_dump_listMethod · 0.36
setUpMethod · 0.36