13 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Behdad Esfahbod
f056c124e5 [misc.classifyTools] Make classification order stable
Sets don't have a welldefined comparison function, so sort them...

Not the most efficient implementation, but good enough.

Fixes https://github.com/fonttools/fonttools/issues/927
2017-04-18 15:57:14 -07:00
Cosimo Lupo
09d2983fbb [classifyTools] rename 'sorted' -> 'sort' to avoid confusions with the built-in name 2016-04-08 22:08:21 +01:00
Cosimo Lupo
020acf168b [classifyTools] fixup tests after reverting commit 34d43aa 2016-04-08 21:59:05 +01:00
Cosimo Lupo
20320494de Revert "[classifyTools] 'sorted' keyword argument should be boolean"
This reverts commit 34d43aa797c8b9e4ff42782bfdd7abde7711835d.

See 34d43aa797 (commitcomment-17012817)
2016-04-08 21:54:56 +01:00
Cosimo Lupo
1aa92de366 [classifyTools] must sub-class from 'object' to use new-style classes on py2 2016-04-07 12:09:28 +01:00
Cosimo Lupo
c9db89a851 [classifyTools] fix doctest failing on pypy
It seems like sets are hashed differently in CPython and PyPy.
Because of this, the returned list of class sets may have a different sort
order (within each class size) between the two implementations.

For now, I make the test pass on both CPython and PyPy by casting the returned
list of sets into a set of (frozen) sets, and asserting that its *content* is
correct, without considering the *order* of the sets in the list.
2016-04-07 11:54:53 +01:00
Cosimo Lupo
d2aab877bb [classifyTools] fix CI doctest failures on python 3
set objects have different __repr__ on python 2 and 3

Python 3:
    >>> {1, 2, 3}
    {1, 2, 3}

Python 2
    >>> {1, 2, 3}
    set([1, 2, 3])

(one among the several reasons I don't particularly like doctest...)
2016-04-07 10:00:49 +01:00
Cosimo Lupo
69bee48a8f [classifyTools] semicolon 2016-04-07 09:33:02 +01:00
Cosimo Lupo
34d43aa797 [classifyTools] 'sorted' keyword argument should be boolean
or at least that's what the signature and the docstring imply.
2016-04-07 09:31:12 +01:00
Behdad Esfahbod
552b5d97fc Add fontTools.misc.classifyTools, helpers to classify things into classes
To be extended with more features / API.  API might change.
2016-04-06 18:15:43 -07:00