@@ -137,7 +137,7 @@ def _make_new_book(self, book):
137137 def _extract_paragraph (self , p ):
138138 for p_exclude in self .exclude_translate_tags .split ("," ):
139139 # for issue #280
140- if type (p ) == NavigableString :
140+ if type (p ) is NavigableString :
141141 continue
142142 for pt in p .find_all (p_exclude ):
143143 pt .extract ()
@@ -154,7 +154,7 @@ def _process_paragraph(self, p, new_p, index, p_to_save_len):
154154 t_text = self .translate_model .batch_translate (index )
155155 else :
156156 t_text = self .translate_model .translate (new_p .text )
157- if type (p ) == NavigableString :
157+ if type (p ) is NavigableString :
158158 new_p = t_text
159159 self .p_to_save .append (new_p )
160160 else :
@@ -198,7 +198,7 @@ def _process_combined_paragraph(self, p_block, index, p_to_save_len):
198198 else :
199199 p = p_block [i ]
200200
201- if type (p ) == NavigableString :
201+ if type (p ) is NavigableString :
202202 p = t
203203 else :
204204 p .string = t
@@ -220,7 +220,7 @@ def translate_paragraphs_acc(self, p_list, send_num):
220220
221221 for p_exclude in self .exclude_translate_tags .split ("," ):
222222 # for issue #280
223- if type (p ) == NavigableString :
223+ if type (p ) is NavigableString :
224224 continue
225225 for pt in temp_p .find_all (p_exclude ):
226226 pt .extract ()
@@ -381,7 +381,7 @@ def process_item(
381381 fixstart = None ,
382382 fixend = None ,
383383 ):
384- if self .only_filelist != "" and not item .file_name in self .only_filelist .split (
384+ if self .only_filelist != "" and item .file_name not in self .only_filelist .split (
385385 ","
386386 ):
387387 return index
@@ -587,7 +587,7 @@ def _save_temp_book(self):
587587 # PR welcome here
588588 if index < p_to_save_len :
589589 new_p = copy (p )
590- if type (p ) == NavigableString :
590+ if type (p ) is NavigableString :
591591 new_p = self .p_to_save [index ]
592592 else :
593593 new_p .string = self .p_to_save [index ]
0 commit comments