From 389cf7c56a5fa6dcfe5ad1ef28d475f12abcb076 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 4 Mar 2019 10:58:47 -0800 Subject: [PATCH] VariationModel: don't use mutable list default value for 'axisOrder' parameter --- Lib/fontTools/varLib/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/fontTools/varLib/models.py b/Lib/fontTools/varLib/models.py index f064c1628..b8a4bb53a 100644 --- a/Lib/fontTools/varLib/models.py +++ b/Lib/fontTools/varLib/models.py @@ -189,19 +189,19 @@ class VariationModel(object): 7: 0.6666666666666667}] """ - def __init__(self, locations, axisOrder=[]): + def __init__(self, locations, axisOrder=None): self.origLocations = locations - self.axisOrder = axisOrder + self.axisOrder = axisOrder if axisOrder else [] locations = [{k:v for k,v in loc.items() if v != 0.} for loc in locations] - keyFunc = self.getMasterLocationsSortKeyFunc(locations, axisOrder=axisOrder) + keyFunc = self.getMasterLocationsSortKeyFunc(locations, axisOrder=self.axisOrder) axisPoints = keyFunc.axisPoints self.locations = sorted(locations, key=keyFunc) # TODO Assert that locations are unique. self.mapping = [self.locations.index(l) for l in locations] # Mapping from user's master order to our master order self.reverseMapping = [locations.index(l) for l in self.locations] # Reverse of above - self._computeMasterSupports(axisPoints, axisOrder) + self._computeMasterSupports(axisPoints, self.axisOrder) self._subModels = {} def getSubModel(self, items):