33 Commits

Author SHA1 Message Date
Simon Cozens
9acbd12637
Better failure mode for sstruct (#3500)
* Check format fits and give sensible error if not

* sstruct.getformat now returns dictionaries, merge them
2024-05-07 14:01:46 +01:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02:00
Khaled Hosny
383e70fc39 [sstruct] Accept pad byte format character
The list of format characters that sstruct accepts was missing “x” for
ignored pad bytes.
2021-07-05 01:33:16 +02:00
Khaled Hosny
bdd462f066 [sstruct] Accept bool format character
The list of format characters that sstruct accepts was missing “x” for
ignored pad booleans.
2021-07-03 13:50:08 +02:00
Khaled Hosny
617aee7f03 [sstruct] Minor
To reduce the noise in the next commits.
2021-07-03 13:49:53 +02: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
Chris Simpkins
7abf2e4c75
transition basestring to str
https://github.com/fonttools/fonttools/issues/2232
2021-03-27 10:23:29 -04:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Miguel Sousa
ddff29cb5d Fix DeprecationWarning: invalid escape sequence 2019-04-01 14:04:14 -07:00
Cosimo Lupo
3a97f425b8 [sstruct] handle format strings with unicode_literals
properly fixes issue with struct module in python < 2.7.7

https://github.com/fonttools/fonttools/issues/993
2017-10-20 11:09:04 +02:00
Behdad Esfahbod
b30e12ae00 More whitespace 2015-04-26 02:01:01 -04:00
Behdad Esfahbod
1ae29591ef from __future__ import absolute_import
Such that our Python 2 is closer to Python 3.

Part of https://github.com/behdad/fonttools/issues/77
2014-01-14 15:07:50 +08:00
Behdad Esfahbod
b8e1afa809 Use struct format 'Q' to read/write 64bit integers 2013-12-06 17:26:09 -05:00
Behdad Esfahbod
153ec40209 Fix a few pychecker warnings
Fixes https://github.com/behdad/fonttools/issues/58
2013-12-04 01:15:46 -05:00
Behdad Esfahbod
3fa26d783f py23 Use fixedToFloat() for fixed version numbers 2013-11-28 18:53:30 -05:00
Behdad Esfahbod
e388db566b py23 Use new-style classes
Such that we get the same semantics in both Python 2 and 3.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
faaca764a1 py23 Fixup isinstance(..., str) issues 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
1fcd04db70 py23 Fix sstruct exception format 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
a0cd41ddf0 py23 Automatically convert str/bytes types in sstruct.pack/unpack 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
32c10eecff py23 from __future__ import division and adjust divisions 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
30e691edd0 py23 from __future__ import print_function 2013-11-27 17:27:45 -05:00
Behdad Esfahbod
7ed91eca1e py23 import in all nontrivial source files and unused import cleanup 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
b774f9f684 2to3 --fix=types manual additions
Don't know why the tool didn't catch these.
2013-11-27 14:01:44 -05:00
Behdad Esfahbod
3ec6a25823 2to3 --fix=print with manual fixup 2013-11-27 04:57:33 -05:00
Behdad Esfahbod
002c32fd0d 2to3 --fix=types with manual fixups 2013-11-27 04:48:20 -05:00
Behdad Esfahbod
ac1b435946 2to3 --fix=idioms 2013-11-27 04:15:34 -05:00
Behdad Esfahbod
dc7e6f3e55 2to3 --fix=repr 2013-11-27 02:44:56 -05:00
Behdad Esfahbod
cd5aad92f2 2to3 --fix=raise 2013-11-27 02:42:28 -05:00
Behdad Esfahbod
180ace6a5f 2to3 --fix=ne 2013-11-27 02:40:30 -05:00
Behdad Esfahbod
bc5e1cb195 2to3 --fix=has_key 2013-11-27 02:33:03 -05:00
Behdad Esfahbod
66214cbe8c 2to3 --fix=apply 2013-11-27 02:18:18 -05:00
Behdad Esfahbod
8413c108d2 Move sstruct under fontTools.misc
Our footprint in the Python module namespace is all under
fontTools now.  User code importing sstruct should be updated
to say "from fontTools.misc import sstruct".
2013-09-17 16:59:39 -04:00