mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
Switch from codecs.getreader to io.TextIOWrapper, refs #230
This commit is contained in:
parent
726219c350
commit
1e9eb875a6
2 changed files with 4 additions and 4 deletions
|
|
@ -105,9 +105,9 @@ class UpdateWrapper:
|
|||
|
||||
@contextlib.contextmanager
|
||||
def file_progress(file, silent=False, **kwargs):
|
||||
if silent or file.raw.fileno() == 0: # 0 = stdin
|
||||
if silent or file.fileno() == 0: # 0 = stdin
|
||||
yield file
|
||||
else:
|
||||
file_length = os.path.getsize(file.raw.name)
|
||||
file_length = os.path.getsize(file.name)
|
||||
with click.progressbar(length=file_length, **kwargs) as bar:
|
||||
yield UpdateWrapper(file, bar.update)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue