Cleans up references to the plot after the plot has been
        deleted. Traverses through all plots cleaning up Callbacks and
        Stream subscribers.
19330
def cleanup(self):
        
        plots = self.traverse(lambda x: x, [BokehPlot])
        for plot in plots:
            if not isinstance(plot, (GenericCompositePlot, GenericElementPlot, GenericOverlayPlot)):
                continue
            streams = list(plot.streams)
            plot.streams = []
            plot._document = None

            if plot.subplots:
                plot.subplots.clear()

            if isinstance(plot, GenericElementPlot):
                for callback in plot.callbacks:
                    streams += callback.streams
                    callback.cleanup()

            for stream in set(streams):
                stream._subscribers = [
                    (p, subscriber) for p, subscriber in stream._subscribers
                    if get_method_owner(subscriber) not in plots
                ]

        if self.comm and self.root is self.handles.get('plot'):
            self.comm.close()
218269
void cleanUp() {
        Stream<Thing> rolePlayers = rolePlayers();
        boolean performDeletion = rolePlayers.noneMatch(thing -> thing != null && thing.id() != null);
        if (performDeletion) delete();
    }
372571
public void cleanup() {
        if (lineSource != null) {
            try {
                lineSource.close();
            } catch (Exception e) {
                // Ignore
            }
        }

        lineSource = null;
        line = null;
        number = 0;
    }
276334
public boolean cleanupDestination()
  throws 
    SIRollbackException, 
    SIConnectionLostException, 
    SIIncorrectCallException, 
    SIResourceException, 
    SIErrorException   
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "cleanupDestination");
  
    boolean cleanedUp = false;

    //Ensure any cleanup does not occur at the same time the link is being used.
    synchronized(this)
    {
      if (isToBeDeleted())
      {
        // Tidy up the state item streams first
        LocalTransaction siTran =
          txManager.createLocalTransaction(true);          
        removeStateItemStreams((Transaction) siTran); 
        siTran.commit();
      }
    }

    // Now tidy up the rest of the infrastructure    
    cleanedUp = cleanupBaseDestination();
   
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "cleanupDestination", Boolean.valueOf(cleanedUp));

    return cleanedUp;
  }
1204932
function cleanup()
    {
        // destroy loop variable(s)
        foreach ( $this->LoopVariablesNames as $varName )
            $this->Tpl->unsetVariable( $varName, $this->RootNamespace );
    }
1355412
def _cleanup(self, ref):
        ''
        self.transitor_states[self._weakref_holder[ref]] -= 1
        del self._weakref_holder[ref]
252734
public <T> void cleanNullReferencesAll() {
		for (Map<Object, Reference<Object>> objectMap : classMaps.values()) {
			cleanMap(objectMap);
		}
	}
455470
@Override
	public void cleanup() {
		manager = null;
		for (Callback callback : callbacks) {
			try {
				callback.cleanup();
			} catch (Exception e) {
				onManagerWarning("Callback cleanup error", e);
			}
		}
	}
282889
function () {
		var axis = this,
			chart = axis.chart,
			pointer = chart.pointer;

		// hide tooltip and hover states
		if (pointer.reset) {
			pointer.reset(true);
		}

		// render the axis
		axis.render();

		// move plot lines and bands
		each(axis.plotLinesAndBands, function (plotLine) {
			plotLine.render();
		});

		// mark associated series as dirty and ready for redraw
		each(axis.series, function (series) {
			series.isDirty = true;
		});

	}
368374
def clear_plot(self):
        """"""
        self.tab_plot.clear()
        self.tab_plot.draw()
        self.save_plot.set_enabled(False)
260696
function cleanup(client) {
  if(client.pubsub
    && client.pubsub.channels
    && client.pubsub.patterns
    && !client.pubsub.channels.length
    && !client.pubsub.patterns.length) {
    client.pubsub = null;
  }
}
729030
function (id) {
		var plotLinesAndBands = this.plotLinesAndBands,
			options = this.options,
			userOptions = this.userOptions,
			i = plotLinesAndBands.length;
		while (i--) {
			if (plotLinesAndBands[i].id === id) {
				plotLinesAndBands[i].destroy();
			}
		}
		each([options.plotLines || [], userOptions.plotLines || [], options.plotBands || [], userOptions.plotBands || []], function (arr) {
			i = arr.length;
			while (i--) {
				if (arr[i].id === id) {
					erase(arr, arr[i]);
				}
			}
		});

	}
602711
def _clearContents(self):
        
        self.titleLabel.setText('')
        self.plotItem.clear()
        self.plotItem.setLabel('left', '')
        self.plotItem.setLabel('bottom', '')
122719
def cleanup(self):
        """"""
        for item in self.server_map:
            self.member_del(item, reconfig=False)
        self.server_map.clear()
515815
def delete_reference(self, opaque_ref, global_ref=False):
        
        opaque_ref_value = self._get_reference_value(opaque_ref)
        if global_ref:
            del self.global_refs[opaque_ref_value]
        else:
            del self.local_refs[opaque_ref_value]
1087118
def cleanup(graph, subgraphs):
    
    for subgraph in subgraphs.values():
        update_node_helper(graph, subgraph)
        update_metadata(graph, subgraph)
201641
function removeUnreferencedElements() {

  var referencedIDs = findReferencedElements();

  var alwaysKeepTags = ['font', 'style', 'metadata', 'script', 'title', 'desc'];
  function removeUnreferencedElementsInTag(node) {
    _($(node).children()).each(function(node) {
      
      // scour:
      // > we only remove if it is not one of our tags we always keep (see above)
      if(_(alwaysKeepTags).indexOf(node.name) !== -1) {
        return;
      }
      var $node = $(node);
      var id = $node.attr('id');
      if(!_(referencedIDs).has(id)) {
        if(node.name == 'g') {
          // scour:
          // > we only inspect the children of a group in a defs if the group
          // > is not referenced anywhere else
          removeUnreferencedElementsInTag(node);
        } else {
          $(node).remove();
        }
      }
    });
  }
  // scour:
  // > Remove most unreferenced elements inside defs
  _($('defs')).each(removeUnreferencedElementsInTag);

  // scour:
  // > Remove certain unreferenced elements outside of defs
  var identifiedElements = $('* > linearGradient[id], * > radialGradient[id], * > pattern[id]');
  
  _(identifiedElements).each(function(node) {
    var id = $(node).attr('id');
    if(!_(referencedIDs).has(id)) {
      $(node).remove();
    }
  });

}