1
1
# -*- coding: utf-8 -*-
2
2
from __future__ import absolute_import , print_function , with_statement
3
3
from typing import Iterable
4
+ from typing import Iterator
4
5
from typing import Union
5
- from typing import Generator
6
6
7
7
import os
8
8
import re
@@ -97,7 +97,7 @@ def convert_text(source:str, to:str, format:str, extra_args:Iterable=(), encodin
97
97
cworkdir = cworkdir )
98
98
99
99
100
- def convert_file (source_file :Union [list , str , Path , Generator ], to :str , format :Union [str , None ]= None ,
100
+ def convert_file (source_file :Union [list , str , Path , Iterator ], to :str , format :Union [str , None ]= None ,
101
101
extra_args :Iterable = (), encoding :str = 'utf-8' , outputfile :Union [None , str , Path ]= None ,
102
102
filters :Union [Iterable , None ]= None , verify_format :bool = True , sandbox :bool = False ,
103
103
cworkdir :Union [str , None ]= None , sort_files = True ) -> str :
@@ -165,7 +165,7 @@ def convert_file(source_file:Union[list, str, Path, Generator], to:str, format:U
165
165
source_file = Path (source_file )
166
166
elif isinstance (source_file , list ):
167
167
source_file = [Path (x ) for x in source_file ]
168
- elif isinstance (source_file , Generator ):
168
+ elif isinstance (source_file , Iterator ):
169
169
source_file = [Path (x ) for x in source_file ]
170
170
171
171
@@ -175,7 +175,7 @@ def convert_file(source_file:Union[list, str, Path, Generator], to:str, format:U
175
175
# if it is, just use the absolute path
176
176
if isinstance (source_file , list ):
177
177
source_file = [x if x .is_absolute () else Path (cworkdir , x ) for x in source_file ]
178
- elif isinstance (source_file , Generator ):
178
+ elif isinstance (source_file , Iterator ):
179
179
source_file = (x if x .is_absolute () else Path (cworkdir , x ) for x in source_file )
180
180
# check ifjust a single path was given
181
181
elif isinstance (source_file , Path ):
0 commit comments