@@ -120,15 +120,15 @@ def _make_output(
120120 assert 0, f'Expected prefix `fd:`, `path:`. `path+:` or `logging:` in {text=}.'
121121
122122 if fd is not None:
123- ret = open(fd, mode='w', closefd=False)
123+ ret = io. open(fd, mode='w', closefd=False)
124124 elif stream is not None:
125125 assert hasattr(stream, 'write')
126126 assert hasattr(stream, 'flush')
127127 ret = stream
128128 elif path is not None:
129- ret = open(path, 'w')
129+ ret = io. open(path, 'w')
130130 elif path_append is not None:
131- ret = open(path_append, 'a')
131+ ret = io. open(path_append, 'a')
132132 elif (0
133133 or pylogging is not None
134134 or pylogging_logger is not None
@@ -2010,7 +2010,7 @@ def make_subarch(entries, mount, fmt):
20102010 elif os.path.isfile(content):
20112011 assert isinstance(path, str) and path != '', \
20122012 f'Need name for binary content, but {path=}.'
2013- with open(content) as f:
2013+ with io. open(content, 'rb' ) as f:
20142014 ff = f.read()
20152015 self._add_treeitem(ff, path)
20162016 return make_subarch([path], None, 'tree')
@@ -2055,7 +2055,7 @@ def make_subarch(entries, mount, fmt):
20552055 self._add_treeitem(data, name, path=path)
20562056 elif isinstance(data, str):
20572057 if os.path.isfile(data):
2058- with open(data, 'rb') as f:
2058+ with io. open(data, 'rb') as f:
20592059 ff = f.read()
20602060 self._add_treeitem(ff, name, path=path)
20612061 else:
@@ -7559,7 +7559,7 @@ def build_subset(buffer, unc_set, gid_set):
75597559 ]
75607560
75617561 # store glyph ids or unicodes as file
7562- with open(f"{tmp_dir}/uncfile.txt", "w", encoding='utf8') as unc_file:
7562+ with io. open(f"{tmp_dir}/uncfile.txt", "w", encoding='utf8') as unc_file:
75637563 if 0xFFFD in unc_set: # error unicode exists -> use glyphs
75647564 args.append(f"--gids-file={uncfile_path}")
75657565 gid_set.add(189)
@@ -7574,7 +7574,7 @@ def build_subset(buffer, unc_set, gid_set):
75747574 unc_file.write("%04x\n" % unc)
75757575
75767576 # store fontbuffer as a file
7577- with open(oldfont_path, "wb") as fontfile:
7577+ with io. open(oldfont_path, "wb") as fontfile:
75787578 fontfile.write(buffer)
75797579 try:
75807580 os.remove(newfont_path) # remove old file
0 commit comments