File tree Expand file tree Collapse file tree 5 files changed +4
-10
lines changed Expand file tree Collapse file tree 5 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,6 @@ def from_bytes(
175
175
prioritized_encodings .append ("utf_8" )
176
176
177
177
for encoding_iana in prioritized_encodings + IANA_SUPPORTED :
178
-
179
178
if cp_isolation and encoding_iana not in cp_isolation :
180
179
continue
181
180
@@ -318,7 +317,9 @@ def from_bytes(
318
317
bom_or_sig_available and strip_sig_or_bom is False
319
318
):
320
319
break
321
- except UnicodeDecodeError as e : # Lazy str loading may have missed something there
320
+ except (
321
+ UnicodeDecodeError
322
+ ) as e : # Lazy str loading may have missed something there
322
323
logger .log (
323
324
TRACE ,
324
325
"LazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %s" ,
Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ def alphabet_languages(
140
140
source_have_accents = any (is_accentuated (character ) for character in characters )
141
141
142
142
for language , language_characters in FREQUENCIES .items ():
143
-
144
143
target_have_accents , target_pure_latin = get_target_features (language )
145
144
146
145
if ignore_non_latin and target_pure_latin is False :
Original file line number Diff line number Diff line change @@ -147,7 +147,6 @@ def cli_detect(argv: Optional[List[str]] = None) -> int:
147
147
x_ = []
148
148
149
149
for my_file in args .files :
150
-
151
150
matches = from_fp (my_file , threshold = args .threshold , explain = args .verbose )
152
151
153
152
best_guess = matches .best ()
@@ -222,7 +221,6 @@ def cli_detect(argv: Optional[List[str]] = None) -> int:
222
221
)
223
222
224
223
if args .normalize is True :
225
-
226
224
if best_guess .encoding .startswith ("utf" ) is True :
227
225
print (
228
226
'"{}" file does not need to be normalized, as it already came from unicode.' .format (
Original file line number Diff line number Diff line change @@ -311,7 +311,6 @@ def range_scan(decoded_sequence: str) -> List[str]:
311
311
312
312
313
313
def cp_similarity (iana_name_a : str , iana_name_b : str ) -> float :
314
-
315
314
if is_multi_byte_encoding (iana_name_a ) or is_multi_byte_encoding (iana_name_b ):
316
315
return 0.0
317
316
@@ -351,7 +350,6 @@ def set_logging_handler(
351
350
level : int = logging .INFO ,
352
351
format_string : str = "%(asctime)s | %(levelname)s | %(message)s" ,
353
352
) -> None :
354
-
355
353
logger = logging .getLogger (name )
356
354
logger .setLevel (level )
357
355
@@ -371,7 +369,6 @@ def cut_sequence_chunks(
371
369
is_multi_byte_decoder : bool ,
372
370
decoded_payload : Optional [str ] = None ,
373
371
) -> Generator [str , None , None ]:
374
-
375
372
if decoded_payload and is_multi_byte_decoder is False :
376
373
for i in offsets :
377
374
chunk = decoded_payload [i : i + chunk_size ]
@@ -397,7 +394,6 @@ def cut_sequence_chunks(
397
394
# multi-byte bad cutting detector and adjustment
398
395
# not the cleanest way to perform that fix but clever enough for now.
399
396
if is_multi_byte_decoder and i > 0 :
400
-
401
397
chunk_partial_size_chk : int = min (chunk_size , 16 )
402
398
403
399
if (
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ pytest-cov==4.0.0
6
6
build==0.10.0
7
7
wheel==0.38.4
8
8
9
- black==22.12 .0
9
+ black==23.1 .0
10
10
mypy==1.0.1
11
11
Flask==2.2.3
12
12
pytest==7.2.1
You can’t perform that action at this time.
0 commit comments