Fix colorspace determinism with OrderedDict

pull/129/head
Quentin Pradet 2018-03-06 11:23:32 +04:00
parent 3e6cc20cb2
commit 0ce9a29f83
No known key found for this signature in database
GPG Key ID: 89964D54095F813B
1 changed files with 13 additions and 14 deletions

View File

@ -1,4 +1,4 @@
import collections
from .psparser import LIT from .psparser import LIT
import six #Python 2+3 compatibility import six #Python 2+3 compatibility
@ -21,17 +21,16 @@ class PDFColorSpace(object):
return '<PDFColorSpace: %s, ncomponents=%d>' % (self.name, self.ncomponents) return '<PDFColorSpace: %s, ncomponents=%d>' % (self.name, self.ncomponents)
PREDEFINED_COLORSPACE = {} PREDEFINED_COLORSPACE = collections.OrderedDict()
for (name, n) in six.iteritems({ for (name, n) in [
'CalRGB': 3, ('CalRGB', 3),
'CalGray': 1, ('CalGray', 1),
'Lab': 3, ('Lab', 3),
'DeviceRGB': 3, ('DeviceRGB', 3),
'DeviceCMYK': 4, ('DeviceCMYK', 4),
'DeviceGray': 1, ('DeviceGray', 1),
'Separation': 1, ('Separation', 1),
'Indexed': 1, ('Indexed', 1),
'Pattern': 1, ('Pattern', 1),
}) : ]:
PREDEFINED_COLORSPACE[name]=PDFColorSpace(name, n) PREDEFINED_COLORSPACE[name]=PDFColorSpace(name, n)