Commit Graph

49 Commits

Author SHA1 Message Date
Kovid Goyal d7c31f4a81 Automated fixes from ruff 2023-01-09 18:13:56 +05:30
luz paz df439bedd1 FIx typos
Found via `codespell -q 3 -S./Changelog.*,./resources/dictionaries  -L alo,ans,pard,ro`
2022-07-18 21:52:03 -04:00
Eli Schwartz 887f620406 py3 porting cleanup: remove unneeded indirect import of builtins
filter, map, range, and zip were proxied through polyglot.builtins to
ensure that their `future_builtins` forms were used. In python3 this is
no longer needed and they don't need to be imported at all, from
anywhere. So, don't.
2021-10-20 21:43:43 -04:00
Zbigniew Jędrzejewski-Szmek 9d63b6ae56 Drop (object) from class definitions
Python2 had old-style classes (no "(object)"), and new style classes (with
"object"). Under Py3 this is a noop, so let's drop it to make the code
a bit shorter.
2021-09-30 09:23:56 +02:00
Scott Talbert 2e272a39d0 Fix building with Python 3.10 2021-06-16 14:19:40 -04:00
Kovid Goyal 9ff27782de Remove useless __future__ imports
Not needed on python3
2020-08-22 18:47:55 +05:30
Kovid Goyal 29cd8d64ea Change shebangs to python from python2
Also remove a few other miscellaneous references to python2
2020-08-22 18:47:51 +05:30
Kovid Goyal 746381d179 A few more etree.fromstring 2019-12-29 22:02:16 +05:30
Kovid Goyal fe066ce2d6 Conversion: CSS selectors with unknown pseudo-elements should not match any tags. See #1827700 (Private bug) 2019-11-07 14:15:46 +05:30
Kovid Goyal f6087f7929 Micro-optimization 2019-11-07 10:42:06 +05:30
Kovid Goyal e25d26a628 Micro-optimization
Also dont use plain asserts in tests
2019-11-07 10:36:08 +05:30
Kovid Goyal 2d41f863b7 pep8 2019-11-07 09:59:27 +05:30
Kovid Goyal 054752d956 ... 2019-11-07 09:53:48 +05:30
Kovid Goyal 36ff1b15b8 py3: port a bunch of places where individual byes are accessed from a bytestring 2019-07-12 05:52:07 +05:30
Eli Schwartz 45ca4c7934 py3: merge multiline __future__ imports to not confuse 2to3 2019-05-27 00:41:14 -04:00
Kovid Goyal 152689812a py3: Port use of Exception.message 2019-04-02 15:04:26 +05:30
Kovid Goyal 305a1bab29 py3: port use of isinstance(str) 2019-04-01 15:14:44 +05:30
Kovid Goyal 40491089f1 py3: Port use of maketrans 2019-04-01 14:06:54 +05:30
Eli Schwartz 4f545af415 autopep8 2019-03-24 01:18:27 -04:00
Eli Schwartz a623717d96 python3: apply various fixes from python-modernize "dict_six"
Imports were then fixed and consolidated to derive from the internal
polyglot.builtins
2019-03-24 01:18:27 -04:00
Kovid Goyal 2d21a8efa2 Some more fixes for the unicode type
Now replaced in all dynamically loaded code. Recipes/metadata
sources/etc. In the case of recipes, since they get compiled by calibre
we simply make the unicode/unichr names available, no need for any
changes to the actual recipes themselves.
2019-03-13 12:04:47 +05:30
Flaviu Tamas 01fbf09c0b Undo redundant imports & new-style raises
New-style rasies need to be redone in a py2-friendly way, and the
redudant imports are redudnant and can safely be removed
2018-09-10 12:11:29 +05:30
Flaviu Tamas 0889ee85ec Fix syntax errors
Command used:

futurize --no-diffs -f libfuturize.fixes.fix_print_with_import -f lib2to3.fixes.fix_throw -f lib2to3.fixes.fix_numliterals -f lib2to3.fixes.fix_except -f lib2to3.fixes.fix_exec -f lib2to3.fixes.fix_raise -f lib2to3.fixes.fix_tuple_params -f lib2to3.fixes.fix_ne -j20 -w -n setup recipes src manual setup.py recipes/*.recipe

And manual adjustments of print((...)) -> print(...)
2018-09-10 12:11:28 +05:30
Kovid Goyal 01a71dbbb5 Remove WebKit based tests in css_selectors since WebKit is going away 2016-06-21 22:24:09 +05:30
Kovid Goyal f7460f138e Conversion: Fix regression that caused pseudo-selectors that cannot be resolved such as :hover, :visited, etc. to be removed during conversion 2015-04-10 11:01:04 +05:30
Kovid Goyal 4989be9377 Conversion: Fix error when converting a document that contains an invalid function based CSS selector without parentheses. Fixes #1440278 [Conversion Error - TypeError: select_nth_last_child() takes exactly 3 arguments (2 given)](https://bugs.launchpad.net/calibre/+bug/1440278) 2015-04-04 09:23:45 +05:30
Kovid Goyal 1de3706bff Expose set of inappropriate pseudo selectors 2015-02-22 13:16:51 +05:30
Kovid Goyal fc37cc1aea ... 2015-02-22 10:10:02 +05:30
Kovid Goyal 70585e8c3e ... 2015-02-22 09:14:19 +05:30
Kovid Goyal b10feb7273 Some more documentation 2015-02-21 11:31:29 +05:30
Kovid Goyal fd002b6680 ... 2015-02-21 10:57:23 +05:30
Kovid Goyal bd3b162d7a Allow restricting results to descendants of a particular tag 2015-02-21 10:56:24 +05:30
Kovid Goyal e7caf265c1 Add a has_matches() method for convenience 2015-02-21 10:47:31 +05:30
Kovid Goyal 880391ce34 ... 2015-02-21 10:40:30 +05:30
Kovid Goyal 3420913923 Allow easily ignoring the UI and non-element pseudo-selectors 2015-02-21 10:26:19 +05:30
Kovid Goyal bd0313c357 Rename css_selectors.parse to css_selectors.parser 2015-02-21 09:41:06 +05:30
Kovid Goyal afd1550e7c ... 2015-02-20 18:43:24 +05:30
Kovid Goyal 3c8984d2a5 Allow passing ElementTree to Select() 2015-02-20 18:21:23 +05:30
Kovid Goyal ee214d6df5 Micro optimization 2015-02-20 17:38:59 +05:30
Kovid Goyal 21f5455c05 Add import statement to docs 2015-02-20 16:33:47 +05:30
Kovid Goyal 6758fba212 ... 2015-02-20 16:32:10 +05:30
Kovid Goyal 2d90b5695f Finish up implementation of css_selectors 2015-02-20 16:29:07 +05:30
Kovid Goyal 5ff7bfe564 ... 2015-02-20 15:00:47 +05:30
Kovid Goyal 6150a664c2 Add some documentation for css_selectors
Also allow the Select class to work with other tree implementations
2015-02-20 09:03:02 +05:30
Kovid Goyal 77726d774a Implement :lang() selector 2015-02-20 08:12:27 +05:30
Kovid Goyal 1e33241401 ... 2015-02-19 21:40:46 +05:30
Kovid Goyal 730ab1098e Implement attribute selectors 2015-02-19 21:36:18 +05:30
Kovid Goyal f4dc77b839 Import the basic tests from cssselect 2015-02-19 19:17:31 +05:30
Kovid Goyal e007dcedb9 Start work on replacement for the unmaintained cssselect library 2015-02-19 18:27:37 +05:30