Browse Source

Intermediate changes
commit_hash:6c65b2ed290900c658e42d7818d9bd50d568a8ba

robot-piglet 1 month ago
parent
commit
409081f7ca

+ 3 - 2
contrib/python/cachetools/py3/.dist-info/METADATA

@@ -1,6 +1,6 @@
-Metadata-Version: 2.1
+Metadata-Version: 2.2
 Name: cachetools
-Version: 5.5.0
+Version: 5.5.1
 Summary: Extensible memoizing collections and decorators
 Home-page: https://github.com/tkem/cachetools/
 Author: Thomas Kemmer
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Requires-Python: >=3.7
 License-File: LICENSE

+ 1 - 1
contrib/python/cachetools/py3/cachetools/__init__.py

@@ -13,7 +13,7 @@ __all__ = (
     "cachedmethod",
 )
 
-__version__ = "5.5.0"
+__version__ = "5.5.1"
 
 import collections
 import collections.abc

+ 1 - 1
contrib/python/cachetools/py3/ya.make

@@ -2,7 +2,7 @@
 
 PY3_LIBRARY()
 
-VERSION(5.5.0)
+VERSION(5.5.1)
 
 LICENSE(MIT)
 

+ 21 - 4
contrib/python/fonttools/.dist-info/METADATA

@@ -1,6 +1,6 @@
-Metadata-Version: 2.1
+Metadata-Version: 2.2
 Name: fonttools
-Version: 4.55.3
+Version: 4.55.4
 Summary: Tools to manipulate font files
 Home-page: http://github.com/fonttools/fonttools
 Author: Just van Rossum
@@ -72,6 +72,18 @@ Requires-Dist: sympy; extra == "all"
 Requires-Dist: xattr; sys_platform == "darwin" and extra == "all"
 Requires-Dist: skia-pathops>=0.5.0; extra == "all"
 Requires-Dist: uharfbuzz>=0.23.0; extra == "all"
+Dynamic: author
+Dynamic: author-email
+Dynamic: classifier
+Dynamic: description
+Dynamic: home-page
+Dynamic: license
+Dynamic: maintainer
+Dynamic: maintainer-email
+Dynamic: platform
+Dynamic: provides-extra
+Dynamic: requires-python
+Dynamic: summary
 
 |CI Build Status| |Coverage Status| |PyPI| |Gitter Chat|
 
@@ -377,9 +389,15 @@ Have fun!
 Changelog
 ~~~~~~~~~
 
-4.55.3 (released 2024-12-10)
+4.55.4 (released 2025-01-21)
 ----------------------------
 
+- [bezierTools] Fixed ``splitCubicAtT`` sometimes not returning identical start/end points as result of numerical precision (#3742, #3743).
+- [feaLib/ast] Fixed docstring of ``AlternateSubstStatement`` (#3735).
+- [transform] Typing fixes (#3734).
+
+4.55.3 (released 2024-12-10)
+----------------------------
 
 - [Docs] fill out ttLib table section [#3716]
 - [feaLib] More efficient inline format 4 lookups [#3726]
@@ -403,7 +421,6 @@ Changelog
 4.55.0 (released 2024-11-14)
 ----------------------------
 
-
 - [cffLib.specializer] Adjust stack use calculation (#3689)
 - [varLib] Lets not add mac names if the rest of name doesn't have them (#3688)
 - [ttLib.reorderGlyphs] Update CFF table charstrings and charset (#3682)

+ 1 - 1
contrib/python/fonttools/fontTools/__init__.py

@@ -3,6 +3,6 @@ from fontTools.misc.loggingTools import configLogger
 
 log = logging.getLogger(__name__)
 
-version = __version__ = "4.55.3"
+version = __version__ = "4.55.4"
 
 __all__ = ["version", "log", "configLogger"]

+ 2 - 2
contrib/python/fonttools/fontTools/feaLib/ast.py

@@ -595,8 +595,8 @@ class MarkClassDefinition(Statement):
 class AlternateSubstStatement(Statement):
     """A ``sub ... from ...`` statement.
 
-    ``prefix``, ``glyph``, ``suffix`` and ``replacement`` should be lists of
-    `glyph-containing objects`_. ``glyph`` should be a `one element list`."""
+    ``glyph`` and ``replacement`` should be `glyph-containing objects`_.
+    ``prefix`` and ``suffix`` should be lists of `glyph-containing objects`_."""
 
     def __init__(self, prefix, glyph, suffix, replacement, location=None):
         Statement.__init__(self, location)

+ 8 - 1
contrib/python/fonttools/fontTools/misc/bezierTools.py

@@ -631,7 +631,14 @@ def splitCubicAtT(pt1, pt2, pt3, pt4, *ts):
         ((77.3438, 56.25), (85.9375, 43.75), (93.75, 25), (100, 0))
     """
     a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
-    return _splitCubicAtT(a, b, c, d, *ts)
+    split = _splitCubicAtT(a, b, c, d, *ts)
+
+    # the split impl can introduce floating point errors; we know the first
+    # segment should always start at pt1 and the last segment should end at pt4,
+    # so we set those values directly before returning.
+    split[0] = (pt1, *split[0][1:])
+    split[-1] = (*split[-1][:-1], pt4)
+    return split
 
 
 @cython.locals(

+ 13 - 15
contrib/python/fonttools/fontTools/misc/transform.py

@@ -52,6 +52,8 @@ translate, rotation, scale, skew, and transformation-center components.
 	>>>
 """
 
+from __future__ import annotations
+
 import math
 from typing import NamedTuple
 from dataclasses import dataclass
@@ -65,7 +67,7 @@ _ONE_EPSILON = 1 - _EPSILON
 _MINUS_ONE_EPSILON = -1 + _EPSILON
 
 
-def _normSinCos(v):
+def _normSinCos(v: float) -> float:
     if abs(v) < _EPSILON:
         v = 0
     elif v > _ONE_EPSILON:
@@ -214,7 +216,7 @@ class Transform(NamedTuple):
         xx, xy, yx, yy = self[:4]
         return [(xx * dx + yx * dy, xy * dx + yy * dy) for dx, dy in vectors]
 
-    def translate(self, x=0, y=0):
+    def translate(self, x: float = 0, y: float = 0):
         """Return a new transformation, translated (offset) by x, y.
 
         :Example:
@@ -225,7 +227,7 @@ class Transform(NamedTuple):
         """
         return self.transform((1, 0, 0, 1, x, y))
 
-    def scale(self, x=1, y=None):
+    def scale(self, x: float = 1, y: float | None = None):
         """Return a new transformation, scaled by x, y. The 'y' argument
         may be None, which implies to use the x value for y as well.
 
@@ -241,7 +243,7 @@ class Transform(NamedTuple):
             y = x
         return self.transform((x, 0, 0, y, 0, 0))
 
-    def rotate(self, angle):
+    def rotate(self, angle: float):
         """Return a new transformation, rotated by 'angle' (radians).
 
         :Example:
@@ -251,13 +253,11 @@ class Transform(NamedTuple):
                 <Transform [0 1 -1 0 0 0]>
                 >>>
         """
-        import math
-
         c = _normSinCos(math.cos(angle))
         s = _normSinCos(math.sin(angle))
         return self.transform((c, s, -s, c, 0, 0))
 
-    def skew(self, x=0, y=0):
+    def skew(self, x: float = 0, y: float = 0):
         """Return a new transformation, skewed by x and y.
 
         :Example:
@@ -267,8 +267,6 @@ class Transform(NamedTuple):
                 <Transform [1 0 1 1 0 0]>
                 >>>
         """
-        import math
-
         return self.transform((1, math.tan(y), math.tan(x), 1, 0, 0))
 
     def transform(self, other):
@@ -336,7 +334,7 @@ class Transform(NamedTuple):
         dx, dy = -xx * dx - yx * dy, -xy * dx - yy * dy
         return self.__class__(xx, xy, yx, yy, dx, dy)
 
-    def toPS(self):
+    def toPS(self) -> str:
         """Return a PostScript representation
 
         :Example:
@@ -352,7 +350,7 @@ class Transform(NamedTuple):
         """Decompose into a DecomposedTransform."""
         return DecomposedTransform.fromTransform(self)
 
-    def __bool__(self):
+    def __bool__(self) -> bool:
         """Returns True if transform is not identity, False otherwise.
 
         :Example:
@@ -374,14 +372,14 @@ class Transform(NamedTuple):
         """
         return self != Identity
 
-    def __repr__(self):
+    def __repr__(self) -> str:
         return "<%s [%g %g %g %g %g %g]>" % ((self.__class__.__name__,) + self)
 
 
 Identity = Transform()
 
 
-def Offset(x=0, y=0):
+def Offset(x: float = 0, y: float = 0) -> Transform:
     """Return the identity transformation offset by x, y.
 
     :Example:
@@ -392,7 +390,7 @@ def Offset(x=0, y=0):
     return Transform(1, 0, 0, 1, x, y)
 
 
-def Scale(x, y=None):
+def Scale(x: float, y: float | None = None) -> Transform:
     """Return the identity transformation scaled by x, y. The 'y' argument
     may be None, which implies to use the x value for y as well.
 
@@ -492,7 +490,7 @@ class DecomposedTransform:
             0,
         )
 
-    def toTransform(self):
+    def toTransform(self) -> Transform:
         """Return the Transform() equivalent of this transformation.
 
         :Example:

+ 5 - 0
contrib/python/fonttools/fontTools/pens/statisticsPen.py

@@ -106,6 +106,7 @@ class StatisticsControlPen(StatisticsBase, BasePen):
 
     def _moveTo(self, pt):
         self._nodes.append(complex(*pt))
+        self._startPoint = pt
 
     def _lineTo(self, pt):
         self._nodes.append(complex(*pt))
@@ -119,12 +120,16 @@ class StatisticsControlPen(StatisticsBase, BasePen):
             self._nodes.append(complex(*pt))
 
     def _closePath(self):
+        p0 = self._getCurrentPoint()
+        if p0 != self._startPoint:
+            self._lineTo(self._startPoint)
         self._update()
 
     def _endPath(self):
         p0 = self._getCurrentPoint()
         if p0 != self._startPoint:
             raise OpenContourError("Glyph statistics not defined on open contours.")
+        self._update()
 
     def _update(self):
         nodes = self._nodes

+ 5 - 13
contrib/python/fonttools/fontTools/ttLib/tables/_n_a_m_e.py

@@ -48,6 +48,10 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
 
     dependencies = ["ltag"]
 
+    def __init__(self, tag=None):
+        super().__init__(tag)
+        self.names = []
+
     def decompile(self, data, ttFont):
         format, n, stringOffset = struct.unpack(b">HHH", data[:6])
         expectedStringOffset = 6 + n * nameRecordSize
@@ -78,10 +82,6 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
             self.names.append(name)
 
     def compile(self, ttFont):
-        if not hasattr(self, "names"):
-            # only happens when there are NO name table entries read
-            # from the TTX file
-            self.names = []
         names = self.names
         names.sort()  # sort according to the spec; see NameRecord.__lt__()
         stringData = b""
@@ -108,8 +108,6 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
     def fromXML(self, name, attrs, content, ttFont):
         if name != "namerecord":
             return  # ignore unknown tags
-        if not hasattr(self, "names"):
-            self.names = []
         name = NameRecord()
         self.names.append(name)
         name.fromXML(name, attrs, content, ttFont)
@@ -194,8 +192,6 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
         identified by the (platformID, platEncID, langID) triplet. A warning is issued
         to prevent unexpected results.
         """
-        if not hasattr(self, "names"):
-            self.names = []
         if not isinstance(string, str):
             if isinstance(string, bytes):
                 log.warning(
@@ -262,7 +258,7 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
         The nameID is assigned in the range between 'minNameID' and 32767 (inclusive),
         following the last nameID in the name table.
         """
-        names = getattr(self, "names", [])
+        names = self.names
         nameID = 1 + max([n.nameID for n in names] + [minNameID - 1])
         if nameID > 32767:
             raise ValueError("nameID must be less than 32768")
@@ -359,8 +355,6 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
         If the 'nameID' argument is None, the created nameID will not
         be less than the 'minNameID' argument.
         """
-        if not hasattr(self, "names"):
-            self.names = []
         if nameID is None:
             # Reuse nameID if possible
             nameID = self.findMultilingualName(
@@ -404,8 +398,6 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
         assert (
             len(platforms) > 0
         ), "'platforms' must contain at least one (platformID, platEncID, langID) tuple"
-        if not hasattr(self, "names"):
-            self.names = []
         if not isinstance(string, str):
             raise TypeError(
                 "expected str, found %s: %r" % (type(string).__name__, string)

Some files were not shown because too many files changed in this diff