class_docstr: Store a set of contour lines or filled regions.
  
  User-callable method: `~.Axes.clabel`
  
  Parameters
  ----------
  ax : `~matplotlib.axes.Axes`
  
  levels : [level0, level1, ..., leveln]
      A list of floating point numbers indicating the contour levels.
  
  allsegs : [level0segs, level1segs, ...]
      List of all the polygon segments for all the *levels*.
      For contour lines ``len(allsegs) == len(levels)``, and for
      filled contour regions ``len(allsegs) = len(levels)-1``. The lists
      should look like ::
  
          level0segs = [polygon0, polygon1, ...]
          polygon0 = [[x0, y0], [x1, y1], ...]
  
  allkinds : ``None`` or [level0kinds, level1kinds, ...]
      Optional list of all the polygon vertex kinds (code types), as
      described and used in Path. This is used to allow multiply-
      connected paths such as holes within filled polygons.
      If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
      should look like ::
  
          level0kinds = [polygon0kinds, ...]
          polygon0kinds = [vertexcode0, vertexcode1, ...]
  
      If *allkinds* is not ``None``, usually all polygons for a
      particular contour level are grouped together so that
      ``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.
  
  **kwargs
      Keyword arguments are as described in the docstring of
      `~.Axes.contour`.
  
  %(contour_set_attributes)s
class_docstr_tok: ["Store","a","set","of","contour","lines","or","filled","regions",".","User-callable","method",":","`","~.Axes.clabel","`","Parameters","--","--","--","--","--","ax",":","`","~matplotlib.axes.Axes","`","levels",":","[","level0",",","level1",",","...",",","leveln","]","A","list","of","floating","point","numbers","indicating","the","contour","levels",".","allsegs",":","[","level0segs",",","level1segs",",","...","]","List","of","all","the","polygon","segments","for","all","the","*","levels","*",".","For","contour","lines","``","len","(","allsegs",")","==","len","(","levels",")","``",",","and","for","filled","contour","regions","``","len","(","allsegs",")","=","len","(","levels",")","-1","``",".","The","lists","should","look","like",":",":","level0segs","=","[","polygon0",",","polygon1",",","...","]","polygon0","=","[","[","x0",",","y0","]",",","[","x1",",","y1","]",",","...","]","allkinds",":","``","None","``","or","[","level0kinds",",","level1kinds",",","...","]","Optional","list","of","all","the","polygon","vertex","kinds","(","code","types",")",",","as","described","and","used","in","Path",".","This","is","used","to","allow","multiply-","connected","paths","such","as","holes","within","filled","polygons",".","If","not","``","None","``",",","``","len","(","allkinds",")","==","len","(","allsegs",")","``",".","The","lists","should","look","like",":",":","level0kinds","=","[","polygon0kinds",",","...","]","polygon0kinds","=","[","vertexcode0",",","vertexcode1",",","...","]","If","*","allkinds","*","is","not","``","None","``",",","usually","all","polygons","for","a","particular","contour","level","are","grouped","together","so","that","``","level0segs","=","[","polygon0","]","``","and","``","level0kinds","=","[","polygon0kinds","]","``",".","*","*","kwargs","Keyword","arguments","are","as","described","in","the","docstring","of","`","~.Axes.contour","`",".","%","(","contour_set_attributes",")","s"]
docstr: Assign values to :attr:`layers` based on :attr:`levels`,
  adding extended layers as needed if contours are filled.
  
  For line contours, layers simply coincide with levels;
  a line is a thin layer.  No extended levels are needed
  with line contours.
docstr_tok: ["Assign","values","to",":","attr",":","`","layers","`","based","on",":","attr",":","`","levels","`",",","adding","extended","layers","as","needed","if","contours","are","filled",".","For","line","contours",",","layers","simply","coincide","with","levels",";","a","line","is","a","thin","layer",".","No","extended","levels","are","needed","with","line","contours","."]
code: def _process_levels(self):
      """
      Assign values to :attr:`layers` based on :attr:`levels`,
      adding extended layers as needed if contours are filled.
  
      For line contours, layers simply coincide with levels;
      a line is a thin layer.  No extended levels are needed
      with line contours.
      """
      # Make a private _levels to include extended regions; we
      # want to leave the original levels attribute unchanged.
      # (Colorbar needs this even for line contours.)
      self._levels = list(self.levels)
  
      if self.logscale:
          lower, upper = 1e-250, 1e250
      else:
          lower, upper = -1e250, 1e250
  
      if self.extend in ("both", "min"):
          self._levels.insert(0, lower)
      if self.extend in ("both", "max"):
          self._levels.append(upper)
      self._levels = np.asarray(self._levels)
  
      if not self.filled:
          self.layers = self.levels
          return
  
      # Layer values are mid-way between levels in screen space.
      if self.logscale:
          # Avoid overflow by taking sqrt before multiplying.
          self.layers = np.sqrt(self._levels[:-1]) * np.sqrt(
              self._levels[1:]
          )
      else:
          self.layers = 0.5 * (self._levels[:-1] + self._levels[1:])
  
imports: from contextlib import ExitStack
  import functools
  import math
  from numbers import Integral
  import numpy
  from numpy import ma
  import matplotlib
  from matplotlib import _api, _docstring
  from matplotlib.backend_bases import MouseButton
  from matplotlib.lines import Line2D
  from matplotlib.path import Path
  from matplotlib.text import Text
  import matplotlib.ticker
  import matplotlib.cm
  import matplotlib.colors
  import matplotlib.collections
  import matplotlib.font_manager
  import matplotlib.cbook
  import matplotlib.patches
  import matplotlib.transforms
label_desc: Use image node_id 14 for calling the ContourSet obj's underlying member method code with example usage: obj._process_levels() without return types