WIP reformat some of the docstrings.

This commit is contained in:
Erik van Blokland 2018-05-25 15:22:00 +02:00
parent b774d8c3e8
commit 1f7f4e42ab

View File

@ -178,16 +178,14 @@ class RuleDescriptor(SimpleDescriptor):
def evaluateRule(rule, location): def evaluateRule(rule, location):
""" Return True if any of the rule's conditionsets matches the """ Return True if any of the rule's conditionsets matches the given location."""
given location.
"""
return any(evaluateConditions(c, location) for c in rule.conditionSets) return any(evaluateConditions(c, location) for c in rule.conditionSets)
def evaluateConditions(conditions, location): def evaluateConditions(conditions, location):
""" Return True if all the conditions matches the given location. """ Return True if all the conditions matches the given location.
If a condition has no minimum, check for < maximum. If a condition has no minimum, check for < maximum.
If a condition has no maximum, check for > minimum. If a condition has no maximum, check for > minimum.
""" """
for cd in conditions: for cd in conditions:
value = location[cd['name']] value = location[cd['name']]
@ -885,49 +883,27 @@ class BaseDocReader(object):
instanceObject.lib = from_plist(libElement[0]) instanceObject.lib = from_plist(libElement[0])
def readInfoElement(self, infoElement, instanceObject): def readInfoElement(self, infoElement, instanceObject):
""" Read the info element. """ Read the info element."""
::
<info/>
Let's drop support for a different location for the info. Never needed it.
"""
infoLocation = self.locationFromElement(infoElement) infoLocation = self.locationFromElement(infoElement)
instanceObject.info = True instanceObject.info = True
def readKerningElement(self, kerningElement, instanceObject): def readKerningElement(self, kerningElement, instanceObject):
""" Read the kerning element. """ Read the kerning element."""
::
Make kerning at the location and with the masters specified at the instance level.
<kerning/>
"""
kerningLocation = self.locationFromElement(kerningElement) kerningLocation = self.locationFromElement(kerningElement)
instanceObject.addKerning(kerningLocation) instanceObject.addKerning(kerningLocation)
def readGlyphElement(self, glyphElement, instanceObject): def readGlyphElement(self, glyphElement, instanceObject):
""" """
Read the glyph element. Read the glyph element.
::
<glyph name="b" unicode="0x62"/> <glyph name="b" unicode="0x62"/>
<glyph name="b"/> <glyph name="b"/>
<glyph name="b"> <glyph name="b">
<master location="location-token-bbb" source="master-token-aaa2"/> <master location="location-token-bbb" source="master-token-aaa2"/>
<master glyphname="b.alt1" location="location-token-ccc" source="master-token-aaa3"/> <master glyphname="b.alt1" location="location-token-ccc" source="master-token-aaa3"/>
<note> <note>
This is an instance from an anisotropic interpolation. This is an instance from an anisotropic interpolation.
</note> </note>
</glyph> </glyph>
""" """
glyphData = {} glyphData = {}
glyphName = glyphElement.attrib.get('name') glyphName = glyphElement.attrib.get('name')