From 0ce9a29f83bb9c87df04f49b5e927d7a6aa4c53c Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 6 Mar 2018 11:23:32 +0400 Subject: [PATCH] Fix colorspace determinism with OrderedDict --- pdfminer/pdfcolor.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pdfminer/pdfcolor.py b/pdfminer/pdfcolor.py index 6fe6eaa..582e34d 100644 --- a/pdfminer/pdfcolor.py +++ b/pdfminer/pdfcolor.py @@ -1,4 +1,4 @@ - +import collections from .psparser import LIT import six #Python 2+3 compatibility @@ -21,17 +21,16 @@ class PDFColorSpace(object): return '' % (self.name, self.ncomponents) -PREDEFINED_COLORSPACE = {} -for (name, n) in six.iteritems({ - 'CalRGB': 3, - 'CalGray': 1, - 'Lab': 3, - 'DeviceRGB': 3, - 'DeviceCMYK': 4, - 'DeviceGray': 1, - 'Separation': 1, - 'Indexed': 1, - 'Pattern': 1, -}) : +PREDEFINED_COLORSPACE = collections.OrderedDict() +for (name, n) in [ + ('CalRGB', 3), + ('CalGray', 1), + ('Lab', 3), + ('DeviceRGB', 3), + ('DeviceCMYK', 4), + ('DeviceGray', 1), + ('Separation', 1), + ('Indexed', 1), + ('Pattern', 1), +]: PREDEFINED_COLORSPACE[name]=PDFColorSpace(name, n) - \ No newline at end of file