Commit ff967e5
committed
Avoid the chardet.universaldetector deprecation warning
chardet 7 moved UniversalDetector to chardet.detector and turned the
old chardet.universaldetector import path into a stub that raises a
DeprecationWarning on import. Projects that run their test suites with
warnings turned into errors (like Flexget, per the linked issue) hit a
hard failure the moment html5lib falls back to chardet for encoding
detection.
Try the new import path first and fall back to the old one, so this
keeps working across both old and new chardet releases without
triggering the warning on the new ones. Fixes #601.1 parent fd4f032 commit ff967e5
3 files changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
487 | 490 | | |
488 | | - | |
489 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
490 | 496 | | |
491 | 497 | | |
492 | 498 | | |
| |||
0 commit comments