def _process_values(self, b=None):
if b is None:<EOL><INDENT>b = self.boundaries<EOL><DEDENT>if b is not None:<EOL><INDENT>self._boundaries = np.asarray(b, dtype=float)<EOL>if self.values is None:<EOL><INDENT>self._values = <NUM_LIT:0.5>*(self._boundaries[:-<NUM_LIT:1>]<EOL>+ self._boundaries[<NUM_LIT:1>:])<EOL>if isinstance(self.norm, colors.NoNorm):<EOL><INDENT>self._values = (self._values + <NUM_LIT>).astype(np.int16)<EOL><DEDENT>return<EOL><DEDENT>self._values = np.array(self.values)<EOL>return<EOL><DEDENT>if self.values is not None:<EOL><INDENT>self._values = np.array(self.values)<EOL>if self.boundaries is None:<EOL><INDENT>b = np.zeros(len(self.values)+<NUM_LIT:1>, '<STR_LIT:d>')<EOL>b[<NUM_LIT:1>:-<NUM_LIT:1>] = <NUM_LIT:0.5>*(self._values[:-<NUM_LIT:1>] - self._values[<NUM_LIT:1>:])<EOL>b[<NUM_LIT:0>] = <NUM_LIT>*b[<NUM_LIT:1>] - b[<NUM_LIT:2>]<EOL>b[-<NUM_LIT:1>] = <NUM_LIT>*b[-<NUM_LIT:2>] - b[-<NUM_LIT:3>]<EOL>self._boundaries = b<EOL>return<EOL><DEDENT>self._boundaries = np.array(self.boundaries)<EOL>return<EOL><DEDENT>if isinstance(self.norm, colors.NoNorm):<EOL><INDENT>b = self._uniform_y(self.cmap.N+<NUM_LIT:1>) * self.cmap.N - <NUM_LIT:0.5><EOL>v = np.zeros((len(b)-<NUM_LIT:1>,), dtype=np.int16)<EOL>v[self._inside] = np.arange(self.cmap.N, dtype=np.int16)<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[<NUM_LIT:0>] = -<NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[-<NUM_LIT:1>] = self.cmap.N<EOL><DEDENT>self._boundaries = b<EOL>self._values = v<EOL>return<EOL><DEDENT>elif isinstance(self.norm, colors.BoundaryNorm):<EOL><INDENT>b = list(self.norm.boundaries)<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b = [b[<NUM_LIT:0>]-<NUM_LIT:1>] + b<EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b = b + [b[-<NUM_LIT:1>] + <NUM_LIT:1>]<EOL><DEDENT>b = np.array(b)<EOL>v = np.zeros((len(b)-<NUM_LIT:1>,), dtype=float)<EOL>bi = self.norm.boundaries<EOL>v[self._inside] = <NUM_LIT:0.5>*(bi[:-<NUM_LIT:1>] + bi[<NUM_LIT:1>:])<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[<NUM_LIT:0>] = b[<NUM_LIT:0>] - <NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[-<NUM_LIT:1>] = b[-<NUM_LIT:1>] + <NUM_LIT:1><EOL><DEDENT>self._boundaries = b<EOL>self._values = v<EOL>return<EOL><DEDENT>else:<EOL><INDENT>if not self.norm.scaled():<EOL><INDENT>self.norm.vmin = <NUM_LIT:0><EOL>self.norm.vmax = <NUM_LIT:1><EOL><DEDENT>b = self.norm.inverse(self._uniform_y(self.cmap.N+<NUM_LIT:1>))<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b[<NUM_LIT:0>] = b[<NUM_LIT:0>] - <NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b[-<NUM_LIT:1>] = b[-<NUM_LIT:1>] + <NUM_LIT:1><EOL><DEDENT><DEDENT>self._process_values(b)<EOL>
Set the :attr:`_boundaries` and :attr:`_values` attributes
based on the input boundaries and values.  Input boundaries
can be *self.boundaries* or the argument *b*.