Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit28c91c2

Browse files
[BUG FIX] xxxOperations::_read__text_with_encoding opens a file as text
LocalOps uses "open(filename, mode='r', encoding=encoding)"RemoteOps uses "io.TextIOWrapper(io.BytesIO(binaryData), encoding=encoding)"It solves a problem on Windows.
1 parent4e23e03 commit28c91c2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎testgres/operations/local_ops.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,10 @@ def read(self, filename, encoding=None, binary=False):
286286
def_read__text_with_encoding(self,filename,encoding):
287287
asserttype(filename)==str# noqa: E721
288288
asserttype(encoding)==str# noqa: E721
289-
content=self._read__binary(filename)
290-
asserttype(content)==bytes# noqa: E721
291-
content_s=content.decode(encoding)
292-
asserttype(content_s)==str# noqa: E721
293-
returncontent_s
289+
withopen(filename,mode='r',encoding=encoding)asfile:# open in a text mode
290+
content=file.read()
291+
asserttype(content)==str# noqa: E721
292+
returncontent
294293

295294
def_read__binary(self,filename):
296295
asserttype(filename)==str# noqa: E721

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp