Remove integerTypes, it's just an int now
This commit is contained in:
parent
9825553e06
commit
20b1e06100
@ -33,7 +33,7 @@ from fontTools.ufoLib.validators import (
|
|||||||
)
|
)
|
||||||
from fontTools.misc import etree
|
from fontTools.misc import etree
|
||||||
from fontTools.ufoLib import _UFOBaseIO
|
from fontTools.ufoLib import _UFOBaseIO
|
||||||
from fontTools.ufoLib.utils import integerTypes, numberTypes
|
from fontTools.ufoLib.utils import numberTypes
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@ -681,11 +681,11 @@ def _writeAdvance(glyphObject, element, validate):
|
|||||||
|
|
||||||
def _writeUnicodes(glyphObject, element, validate):
|
def _writeUnicodes(glyphObject, element, validate):
|
||||||
unicodes = getattr(glyphObject, "unicodes", None)
|
unicodes = getattr(glyphObject, "unicodes", None)
|
||||||
if validate and isinstance(unicodes, integerTypes):
|
if validate and isinstance(unicodes, int):
|
||||||
unicodes = [unicodes]
|
unicodes = [unicodes]
|
||||||
seen = set()
|
seen = set()
|
||||||
for code in unicodes:
|
for code in unicodes:
|
||||||
if validate and not isinstance(code, integerTypes):
|
if validate and not isinstance(code, int):
|
||||||
raise GlifLibError("unicode values must be int")
|
raise GlifLibError("unicode values must be int")
|
||||||
if code in seen:
|
if code in seen:
|
||||||
continue
|
continue
|
||||||
|
@ -5,7 +5,6 @@ import warnings
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
|
|
||||||
integerTypes = int
|
|
||||||
numberTypes = (int, float)
|
numberTypes = (int, float)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import fs.base
|
|||||||
import fs.osfs
|
import fs.osfs
|
||||||
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from fontTools.ufoLib.utils import integerTypes, numberTypes
|
from fontTools.ufoLib.utils import numberTypes
|
||||||
|
|
||||||
|
|
||||||
# -------
|
# -------
|
||||||
@ -42,7 +42,7 @@ def genericIntListValidator(values, validValues):
|
|||||||
if valuesSet - validValuesSet:
|
if valuesSet - validValuesSet:
|
||||||
return False
|
return False
|
||||||
for value in values:
|
for value in values:
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def genericNonNegativeIntValidator(value):
|
|||||||
"""
|
"""
|
||||||
Generic. (Added at version 3.)
|
Generic. (Added at version 3.)
|
||||||
"""
|
"""
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
if value < 0:
|
if value < 0:
|
||||||
return False
|
return False
|
||||||
@ -207,7 +207,7 @@ def fontInfoOpenTypeOS2WeightClassValidator(value):
|
|||||||
"""
|
"""
|
||||||
Version 2+.
|
Version 2+.
|
||||||
"""
|
"""
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
if value < 0:
|
if value < 0:
|
||||||
return False
|
return False
|
||||||
@ -217,7 +217,7 @@ def fontInfoOpenTypeOS2WidthClassValidator(value):
|
|||||||
"""
|
"""
|
||||||
Version 2+.
|
Version 2+.
|
||||||
"""
|
"""
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
if value < 1:
|
if value < 1:
|
||||||
return False
|
return False
|
||||||
@ -234,7 +234,7 @@ def fontInfoVersion2OpenTypeOS2PanoseValidator(values):
|
|||||||
if len(values) != 10:
|
if len(values) != 10:
|
||||||
return False
|
return False
|
||||||
for value in values:
|
for value in values:
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
# XXX further validation?
|
# XXX further validation?
|
||||||
return True
|
return True
|
||||||
@ -248,7 +248,7 @@ def fontInfoVersion3OpenTypeOS2PanoseValidator(values):
|
|||||||
if len(values) != 10:
|
if len(values) != 10:
|
||||||
return False
|
return False
|
||||||
for value in values:
|
for value in values:
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
if value < 0:
|
if value < 0:
|
||||||
return False
|
return False
|
||||||
@ -264,7 +264,7 @@ def fontInfoOpenTypeOS2FamilyClassValidator(values):
|
|||||||
if len(values) != 2:
|
if len(values) != 2:
|
||||||
return False
|
return False
|
||||||
for value in values:
|
for value in values:
|
||||||
if not isinstance(value, integerTypes):
|
if not isinstance(value, int):
|
||||||
return False
|
return False
|
||||||
classID, subclassID = values
|
classID, subclassID = values
|
||||||
if classID < 0 or classID > 14:
|
if classID < 0 or classID > 14:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user