Merge pull request #2714 from fonttools/NotANone

[varLib.merge] fix NameError: 'NotANone'
This commit is contained in:
Cosimo Lupo 2022-07-29 12:54:31 +01:00 committed by GitHub
commit cf00320403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -120,6 +120,20 @@ class FoundANone(VarLibMergeError):
return f"{stack[0]}=={cause['got']}\n"
class NotANone(VarLibMergeError):
"""one of the values in a list was not empty when it should have been"""
@property
def offender(self):
index = [x is not None for x in self.cause["got"]].index(True)
return index, self._master_name(index)
@property
def details(self):
cause, stack = self.cause, self.stack
return f"{stack[0]}=={cause['got']}\n"
class MismatchedTypes(VarLibMergeError):
"""data had inconsistent types"""

View File

@ -31,6 +31,7 @@ from .errors import (
ShouldBeConstant,
FoundANone,
MismatchedTypes,
NotANone,
LengthsDiffer,
KeysDiffer,
InconsistentGlyphOrder,