Lines Matching +full:helper +full:- +full:validator +full:- +full:identifier
2 glifLib.py -- Generic module for reading and writing the .glif format.
54 # ---------
56 # ---------
88 # ------------
90 # ------------
119 # ---------
121 # ---------
197 # network or in-memory FS may not map to the local one
202 self.dirName = fs.path.parts(path)[-1]
260 important for case-insensitive file systems.
400 (for example if the 'glyphObject' attribute is read-
430 # Re-raise with a note that gives extra context, describing where
436 # Network or in-memory FS may not map to a local path, so use
558 # dict-like support
634 # -----------------------
636 # -----------------------
651 # -----------------------
653 # -----------------------
693 (for example if the 'glyphObject' attribute is read-
748 """Return .glif data for a glyph as a UTF-8 encoded bytes string."""
794 # prevent lxml from writing self-closing tags
802 root, encoding="UTF-8", xml_declaration=True, pretty_print=True
816 encoding is always set to "UTF-8".
865 return data.decode("utf-8")
921 "image attribute must be a dict or dict-like object with the proper structure."
955 identifier = guideline.get("identifier")
956 if identifier is not None:
957 if validate and identifier in identifiers:
958 raise GlifLibError("identifier used more than once: %s" % identifier)
959 attrs["identifier"] = identifier
960 identifiers.add(identifier)
997 identifier = anchor.get("identifier")
998 if identifier is not None:
999 if validate and identifier in identifiers:
1000 raise GlifLibError("identifier used more than once: %s" % identifier)
1001 attrs["identifier"] = identifier
1002 identifiers.add(identifier)
1022 # -----------------------
1024 # -----------------------
1046 validator = dataValidationDict.get("valueValidator")
1048 # have specific options for the validator
1050 isValidValue = validator(value, valueOptions)
1053 if validator == genericTypeValidator:
1054 isValidValue = validator(value, valueType)
1056 isValidValue = validator(value)
1079 # -----------------
1081 # -----------------
1098 data = tobytes(aString, encoding="utf-8")
1365 # ----------------
1367 # ----------------
1369 contourAttributesFormat2 = {"identifier"}
1379 componentAttributesFormat2 = componentAttributesFormat1 | {"identifier"}
1381 pointAttributesFormat2 = pointAttributesFormat1 | {"identifier"}
1494 identifier = contour.get("identifier")
1495 if identifier is not None:
1497 if identifier in identifiers:
1499 "The identifier %s is used more than once." % identifier
1501 if not identifierValidator(identifier):
1503 "The contour identifier %s is not valid." % identifier
1505 identifiers.add(identifier)
1507 pen.beginPath(identifier=identifier)
1511 …"The beginPath method needs an identifier kwarg. The contour's identifier value has been discarded…
1529 identifier = point.get("identifier")
1530 if identifier is not None:
1532 if identifier in identifiers:
1534 "The identifier %s is used more than once." % identifier
1536 if not identifierValidator(identifier):
1537 raise GlifLibError("The identifier %s is not valid." % identifier)
1538 identifiers.add(identifier)
1545 identifier=identifier,
1550 … "The addPoint method needs an identifier kwarg. The point's identifier value has been discarded.",
1573 identifier = component.get("identifier")
1574 if identifier is not None:
1576 if identifier in identifiers:
1578 "The identifier %s is used more than once." % identifier
1580 if validate and not identifierValidator(identifier):
1581 raise GlifLibError("The identifier %s is not valid." % identifier)
1582 identifiers.add(identifier)
1584 pen.addComponent(baseGlyphName, tuple(transformation), identifier=identifier)
1588 …"The addComponent method needs an identifier kwarg. The component's identifier value has been disc…
1670 massaged = massaged[:-count]
1671 # validate the off-curves in the segments
1675 offCurvesCount = len(massaged) - 1 - lastOnCurvePoint
1682 # move and line can't be preceded by off-curves
1700 # ---------------------
1701 # Misc Helper Functions
1702 # ---------------------
1739 # --------------------
1741 # --------------------
1766 other = self._elementStack.pop(-1)
1791 and self._elementStack[-1] == "glyph"
1825 if name == "image" and self._elementStack and self._elementStack[-1] == "glyph":
1855 and self._elementStack[-1] == "outline"
1868 # --------------
1870 # --------------
1885 Helper class using the PointPen protocol to write the <outline>
1900 def beginPath(self, identifier=None, **kwargs): argument
1902 if identifier is not None and self.formatVersion.major >= 2:
1904 if identifier in self.identifiers:
1906 "identifier used more than once: %s" % identifier
1908 if not identifierValidator(identifier):
1910 "identifier not formatted properly: %s" % identifier
1912 attrs["identifier"] = identifier
1913 self.identifiers.add(identifier)
1919 if self.validate and self.prevPointTypes[-1] == "offcurve":
1921 # prevent lxml from writing self-closing tags
1930 self, pt, segmentType=None, smooth=None, name=None, identifier=None, **kwargs argument
1952 and self.prevPointTypes[-1] == "offcurve"
1974 # identifier
1975 if identifier is not None and self.formatVersion.major >= 2:
1977 if identifier in self.identifiers:
1979 "identifier used more than once: %s" % identifier
1981 if not identifierValidator(identifier):
1983 "identifier not formatted properly: %s" % identifier
1985 attrs["identifier"] = identifier
1986 self.identifiers.add(identifier)
1989 def addComponent(self, glyphName, transformation, identifier=None, **kwargs): argument
1996 if identifier is not None and self.formatVersion.major >= 2:
1998 if identifier in self.identifiers:
2000 "identifier used more than once: %s" % identifier
2002 if self.validate and not identifierValidator(identifier):
2004 "identifier not formatted properly: %s" % identifier
2006 attrs["identifier"] = identifier
2007 self.identifiers.add(identifier)