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,8 +590,7 @@ class ClassDefBuilder(object):
def canAdd(self, glyphs): def canAdd(self, glyphs):
if isinstance(glyphs, (set, frozenset)): if isinstance(glyphs, (set, frozenset)):
glyphs = tuple(sorted(glyphs)) glyphs = sorted(glyphs)
elif not isinstance(glyphs, tuple):
glyphs = tuple(glyphs) glyphs = tuple(glyphs)
if glyphs in self.classes_: if glyphs in self.classes_:
return True return True
@ -602,8 +601,7 @@ class ClassDefBuilder(object):
def add(self, glyphs): def add(self, glyphs):
if isinstance(glyphs, (set, frozenset)): if isinstance(glyphs, (set, frozenset)):
glyphs = tuple(sorted(glyphs)) glyphs = sorted(glyphs)
elif not isinstance(glyphs, tuple):
glyphs = tuple(glyphs) glyphs = tuple(glyphs)
if glyphs in self.classes_: if glyphs in self.classes_:
return return