otlLib.builder: don't specialcase tuple as it's immutable and returns itself

https://github.com/fonttools/fonttools/pull/793#discussion_r94358989
This commit is contained in:
Cosimo Lupo 2017-01-04 13:13:36 +01:00
parent 1d28abdb65
commit dd0cf31d4e
No known key found for this signature in database
GPG Key ID: B61AAAD0B53A6419

View File

@ -590,9 +590,8 @@ class ClassDefBuilder(object):
def canAdd(self, glyphs):
if isinstance(glyphs, (set, frozenset)):
glyphs = tuple(sorted(glyphs))
elif not isinstance(glyphs, tuple):
glyphs = tuple(glyphs)
glyphs = sorted(glyphs)
glyphs = tuple(glyphs)
if glyphs in self.classes_:
return True
for glyph in glyphs:
@ -602,9 +601,8 @@ class ClassDefBuilder(object):
def add(self, glyphs):
if isinstance(glyphs, (set, frozenset)):
glyphs = tuple(sorted(glyphs))
elif not isinstance(glyphs, tuple):
glyphs = tuple(glyphs)
glyphs = sorted(glyphs)
glyphs = tuple(glyphs)
if glyphs in self.classes_:
return
self.classes_.add(glyphs)