MCPcopy Index your code
hub / github.com/saltstack/salt / write

Method write

tests/unit/modules/test_hosts.py:180–194  ·  view source on GitHub ↗
(self, s, *args)

Source from the content-addressed store, hash-verified

178 return ret
179
180 def write(self, s, *args):
181 if "b" in self.mode:
182 if not isinstance(s, bytes):
183 # Make this act like a binary filehandle
184 raise TypeError(
185 "a bytes-like object is required, not 'str'"
186 )
187 # The StringIO wants a str type, it won't take
188 # bytes. Convert before writing to it.
189 return super().write(salt.utils.stringutils.to_str(s), *args)
190 else:
191 if not isinstance(s, str):
192 # Make this act like a non-binary filehandle
193 raise TypeError("write() argument must be str, not bytes")
194 return super().write(s, *args)
195
196 def readlines(self):
197 ret = super().readlines()

Calls

no outgoing calls

Tested by

no test coverage detected