Commit Graph

63 Commits

Author SHA1 Message Date
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
Christian Clauss 3e81179175 Fix more typos 2021-10-02 17:15:24 +02: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
slowy07 125a5083a3 fix: fixing typo grammar 2021-08-02 07:54:49 +07:00
Kovid Goyal 2e235a9e7a pep8 2021-06-23 10:59:29 +05:30
Tim Gates eeb55f8a91 docs: fix simple typo, specal -> special
There is a small typo in src/tinycss/tests/tokenizing.py.

Should read `special` rather than `specal`.
2020-12-22 22:52:59 +11:00
Kovid Goyal 027bf97633 Move more extension modules to multi-phase initialization 2020-10-24 14:28:56 +05:30
Kovid Goyal c9f2ae20fc Replace some uses of plugins dict 2020-10-18 08:58:01 +05:30
Kovid Goyal 2a0bdcfcbb Use the importlib resource infrastructure to run tests from directories
That way the tests will work even in frozen builds
2020-10-03 09:05:36 +05:30
Kovid Goyal 9cab833728 Remove py2 code paths 2020-08-22 18:48:06 +05:30
Kovid Goyal 01b0fba8ad Auto fix excess blank lines 2020-08-22 18:47:56 +05:30
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
Zbigniew Jędrzejewski-Szmek 9480360bc8 py3: another warning about invalid escape 2019-07-19 16:26:02 +02:00
Eli Schwartz 45ca4c7934 py3: merge multiline __future__ imports to not confuse 2to3 2019-05-27 00:41:14 -04:00
Kovid Goyal 1473f4a83e Forgot to remove unused dot object 2019-05-01 17:14:05 +05:30
Kovid Goyal d324e776b5 Greatly simplify unicode_to_number
This also has the virtue of making number parsing locale independent, as
is required for parsing CSS literals
2019-05-01 17:10:21 +05:30
Kovid Goyal 3de9c83787 pep8 2019-05-01 16:42:43 +05:30
Kovid Goyal cf220e7372 ... 2019-04-02 15:12:27 +05:30
Kovid Goyal 152689812a py3: Port use of Exception.message 2019-04-02 15:04:26 +05:30
Kovid Goyal 6272e4db9d ... 2019-04-02 10:37:41 +05:30
Kovid Goyal ffb5160f3c py3: Fix parsing of numbers in tinycss tokenizer 2019-04-02 10:34:01 +05:30
Kovid Goyal f149427104 py3: Port use of (un)hexlify() 2019-03-30 14:34:48 +05:30
Kovid Goyal 5d46f5fbeb Get rid of iterkeys
dict.__iter__() is the same as iterkeys on both py2 and py3
2019-03-25 14:31:32 +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
Kovid Goyal dd7d8ea3c4 Switch from cssutils to css-parser
css-parser is a new fork of the unmaintained cssutils.
See https://github.com/ebook-utils/css-parser
2019-01-02 21:49:02 +05:30
Eli Schwartz 3fb2563d08 tokenizer: fix compile errors in merge of python3 port 2018-12-17 10:31:45 -05:00
Kovid Goyal 7463d23777 ... 2018-12-10 11:52:05 +05:30
Kovid Goyal 36647d4762 Merge branch 'ft-py3-tokenizer' of https://github.com/flaviut/calibre 2018-12-10 11:24:10 +05:30
Flaviu Tamas 5f420d7047 Fix number->size conversion 2018-12-08 17:24:28 -05:00
Flaviu Tamas cf576342e1 Build tokenizer on py3
- The actual unicode manipulation wasn't converted to the new 3.3+
style, since it would lead to lots of ifdefs and become quite ugly. This
can be done when py2 support is dropped. The drawbacks will be
temporary slower code (there will be extra copying required).
2018-12-08 17:24:18 -05:00
Kovid Goyal 5234e43f0e Port future_builtins to polyglot 2018-09-10 20:12:01 +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 aee8af31f3 Hide all symbols in the compiled python extensions on unix
They were already hidden on windows. Avoids the possibility of symbol
collisions and also means ld has to do less work when loading them
extensions.
2017-06-07 12:19:24 +05:30
Kovid Goyal 353e7c2b36 Fix subsetting of fonts whose names start with "and" not working
Caused by a bug in the font-family parsing routines of cssutils,
workaround by quoting the family name before passing it to cssutils.
2016-12-05 17:07:11 +05:30
Kovid Goyal cf04fd266d DRYer 2016-07-17 09:55:39 +05:30
Kovid Goyal 75690f41f8 ... 2016-06-30 14:48:48 +05:30
Kovid Goyal bb4fe4d924 Serialization of parsed fonts 2016-06-30 13:49:43 +05:30
Kovid Goyal bbaf9875cc Use the new font parsing code for normalize_css 2016-06-30 12:25:28 +05:30
Kovid Goyal b0b7a59afd Code to parse the font shorthand property 2016-06-30 11:07:51 +05:30
Kovid Goyal f1122ac05f Discard empty strings when parsing font-family 2016-06-30 08:24:17 +05:30
Kovid Goyal 0643da49e0 ... 2016-06-30 08:22:19 +05:30
Kovid Goyal 553137015e Code to parse font family values 2016-06-30 08:18:15 +05:30
Kovid Goyal 538f0a7186 A single entry point to run all tests 2016-06-21 23:12:06 +05:30
Kovid Goyal ef09e886b3 Change all shebangs to use python2 2015-01-23 19:08:21 +05:30
Kovid Goyal 1359f475af Edit Book: Live CSS: Fix clicking on link to go to style definition not working if the stylesheet contains CSS 3 media queries
Adds support for CSS 3 media query parsing to tinycss
2014-06-08 18:09:47 +05:30
Kovid Goyal 783b1d112b Use __slots__ for easy memory savings 2014-06-07 21:17:31 +05:30