Merge pull request #974 from khaledhosny/warnings

Use logging module for a couple of warnings
This commit is contained in:
Cosimo Lupo 2017-05-24 09:46:54 +01:00 committed by GitHub
commit a3d199e06c
2 changed files with 2 additions and 4 deletions

View File

@ -17,7 +17,6 @@ from fontTools.otlLib import builder as otl
from contextlib import contextmanager from contextlib import contextmanager
from operator import setitem from operator import setitem
import logging import logging
import warnings
class MtiLibError(Exception): pass class MtiLibError(Exception): pass
class ReferenceNotFoundError(MtiLibError): pass class ReferenceNotFoundError(MtiLibError): pass
@ -1074,7 +1073,7 @@ class Tokenizer(object):
if len(line) == 1 and not line[0]: if len(line) == 1 and not line[0]:
del line[0] del line[0]
if line and not line[-1]: if line and not line[-1]:
warnings.warn('trailing tab found on line %d: %s' % (self.lineno, self.line)) log.warn('trailing tab found on line %d: %s' % (self.lineno, self.line))
while line and not line[-1]: while line and not line[-1]:
del line[-1] del line[-1]
return line return line

View File

@ -30,7 +30,6 @@ from fontTools.ttLib.tables import otTables as ot
from fontTools.varLib import builder, designspace, models from fontTools.varLib import builder, designspace, models
from fontTools.varLib.merger import VariationMerger, _all_equal from fontTools.varLib.merger import VariationMerger, _all_equal
from collections import OrderedDict from collections import OrderedDict
import warnings
import os.path import os.path
import logging import logging
from pprint import pformat from pprint import pformat
@ -219,7 +218,7 @@ def _add_gvar(font, model, master_ttfs, tolerance=.5):
allControls = [d[1] for d in allData] allControls = [d[1] for d in allData]
control = allControls[0] control = allControls[0]
if (any(c != control for c in allControls)): if (any(c != control for c in allControls)):
warnings.warn("glyph %s has incompatible masters; skipping" % glyph) log.warn("glyph %s has incompatible masters; skipping" % glyph)
continue continue
del allControls del allControls