class_docstr: Filtering PointPen that tries to determine whether an on-curve point
  should be "smooth", ie. that it's a "tangent" point or a "curve" point.
class_docstr_tok: ["Filtering","PointPen","that","tries","to","determine","whether","an","on-curve","point","should","be","``","smooth","''",",","ie",".","that","it","'s","a","``","tangent","''","point","or","a","``","curve","''","point","."]
code: def _flushContour(self):
      if self._points is None:
          raise PenError("Path not begun")
      points = self._points
      nPoints = len(points)
      if not nPoints:
          return
      if points[0][1] == "move":
          # Open path.
          indices = range(1, nPoints - 1)
      elif nPoints > 1:
          # Closed path. To avoid having to mod the contour index, we
          # simply abuse Python's negative index feature, and start at -1
          indices = range(-1, nPoints - 1)
      else:
          # closed path containing 1 point (!), ignore.
          indices = []
      for i in indices:
          pt, segmentType, _, name, kwargs = points[i]
          if segmentType is None:
              continue
          prev = i - 1
          next = i + 1
          if (
              points[prev][1] is not None
              and points[next][1] is not None
          ):
              continue
          # At least one of our neighbors is an off-curve point
          pt = points[i][0]
          prevPt = points[prev][0]
          nextPt = points[next][0]
          if pt != prevPt and pt != nextPt:
              dx1, dy1 = pt[0] - prevPt[0], pt[1] - prevPt[1]
              dx2, dy2 = nextPt[0] - pt[0], nextPt[1] - pt[1]
              a1 = math.atan2(dy1, dx1)
              a2 = math.atan2(dy2, dx2)
              if abs(a1 - a2) < self._error:
                  points[i] = pt, segmentType, True, name, kwargs
  
      for pt, segmentType, smooth, name, kwargs in points:
          self._outPen.addPoint(pt, segmentType, smooth, name, **kwargs)
  
imports: import math
  from typing import Any, Optional, Tuple, Dict
  from fontTools.pens.basePen import AbstractPen, PenError
  from fontTools.misc.transform import DecomposedTransform
label_desc: Use image node_id 2 for calling the GuessSmoothPointPen obj's underlying member method code with example usage: obj._flushContour() without return types