Convert all bytes args to str by decoding them using stdin encoding.
(
args: List[Union[str, bytes]],
stdin_encoding: str
)
| 283 | |
| 284 | |
| 285 | def decode_raw_args( |
| 286 | args: List[Union[str, bytes]], |
| 287 | stdin_encoding: str |
| 288 | ) -> List[str]: |
| 289 | """ |
| 290 | Convert all bytes args to str |
| 291 | by decoding them using stdin encoding. |
| 292 | |
| 293 | """ |
| 294 | return [ |
| 295 | arg.decode(stdin_encoding) |
| 296 | if type(arg) is bytes else arg |
| 297 | for arg in args |
| 298 | ] |