def _trimSegmentsInCell(self, colIdx, cellIdx, segList, minPermanence,<EOL>minNumSyns):
<EOL>if minPermanence is None:<EOL><INDENT>minPermanence = self.connectedPerm<EOL><DEDENT>if minNumSyns is None:<EOL><INDENT>minNumSyns = self.activationThreshold<EOL><DEDENT>nSegsRemoved, nSynsRemoved = <NUM_LIT:0>, <NUM_LIT:0><EOL>segsToDel = [] <EOL>for segment in segList:<EOL><INDENT>synsToDel = [syn for syn in segment.syns if syn[<NUM_LIT:2>] < minPermanence]<EOL>if len(synsToDel) == len(segment.syns):<EOL><INDENT>segsToDel.append(segment) <EOL><DEDENT>else:<EOL><INDENT>if len(synsToDel) > <NUM_LIT:0>:<EOL><INDENT>for syn in synsToDel: <EOL><INDENT>segment.syns.remove(syn)<EOL>nSynsRemoved += <NUM_LIT:1><EOL><DEDENT><DEDENT>if len(segment.syns) < minNumSyns:<EOL><INDENT>segsToDel.append(segment)<EOL><DEDENT><DEDENT><DEDENT>nSegsRemoved += len(segsToDel)<EOL>for seg in segsToDel: <EOL><INDENT>self._cleanUpdatesList(colIdx, cellIdx, seg)<EOL>self.cells[colIdx][cellIdx].remove(seg)<EOL>nSynsRemoved += len(seg.syns)<EOL><DEDENT>return nSegsRemoved, nSynsRemoved<EOL>
This method goes through a list of segments for a given cell and
deletes all synapses whose permanence is less than minPermanence and deletes
any segments that have less than minNumSyns synapses remaining.

:param colIdx        Column index
:param cellIdx       Cell index within the column
:param segList       List of segment references
:param minPermanence Any syn whose permamence is 0 or < minPermanence will
                     be deleted.
:param minNumSyns    Any segment with less than minNumSyns synapses remaining
                     in it will be deleted.

:returns: tuple (numSegsRemoved, numSynsRemoved)