Repository navigation
Simplified and faster encoding.py & doc building - #138
Conversation
adbar
commented
Feb 7, 2020
- code cleaning: regexes + LookupError unnecessary as fix_charset() returns a default value
- faster encoding detection with cchardet, made optional in encoding.py and setup.py
|
The conflict comes from setup.py, please review it |
|
| def _parse(self, input): | ||
| doc, self.encoding = build_doc(input) | ||
| if isinstance(input, (_ElementTree, HtmlElement)): | ||
| doc = input |
There was a problem hiding this comment.
This option doesn't set self.encoding which was set in another branch.
Users might be relying on it.
So please add
self.endoding = 'utf-8'
to match the expectations in the best way and we'll publish it then.
There was a problem hiding this comment.
Also, you have no deepcopy as we have discussed.
Any thoughts on this?
._parse method could be run several times, devastating the document after the first iteration and thus reducing the found subtree quality.
See
python-readability/readability/readability.py
Line 219 in 4dcd6f9
python-readability/readability/readability.py
Line 197 in 4dcd6f9
and etc.
There was a problem hiding this comment.
I added the encoding attribute, for the deepcopy issue I'm not sure what to do, passing already existing trees is experimental anyway
|
@buriy Could you please accept or amend the PR? All tests pass and we could keep the |