| 151 | |
| 152 | |
| 153 | class EncodedFile(io.TextIOWrapper): |
| 154 | __slots__ = () |
| 155 | |
| 156 | @property |
| 157 | def name(self) -> str: |
| 158 | # Ensure that file.name is a string. Workaround for a Python bug |
| 159 | # fixed in >=3.7.4: https://bugs.python.org/issue36015 |
| 160 | return repr(self.buffer) |
| 161 | |
| 162 | @property |
| 163 | def mode(self) -> str: |
| 164 | # TextIOWrapper doesn't expose a mode, but at least some of our |
| 165 | # tests check it. |
| 166 | return self.buffer.mode.replace("b", "") |
| 167 | |
| 168 | |
| 169 | class CaptureIO(io.TextIOWrapper): |