End a span. Update the span_id in SpanContext to the current span's
        parent span id; Update the current span.
769924
def end_span(self, *args, **kwargs):
        
        cur_span = self.current_span()
        if cur_span is None and self._spans_list:
            cur_span = self._spans_list[-1]

        if cur_span is None:
            logging.warning('No active span, cannot do end_span.')
            return

        cur_span.finish()
        self.span_context.span_id = cur_span.parent_span.span_id if \
            cur_span.parent_span else None

        if isinstance(cur_span.parent_span, trace_span.Span):
            execution_context.set_current_span(cur_span.parent_span)
        else:
            execution_context.set_current_span(None)

        with self._spans_list_condition:
            if cur_span in self._spans_list:
                span_datas = self.get_span_datas(cur_span)
                self.exporter.export(span_datas)
                self._spans_list.remove(cur_span)

        return cur_span
450825
function elementEnd() {
    if (isParent) {
        isParent = false;
    }
    else {
        ngDevMode && assertHasParent();
        previousOrParentNode = getParentLNode(previousOrParentNode);
    }
    ngDevMode && assertNodeType(previousOrParentNode, 3 /* Element */);
    var queries = previousOrParentNode.queries;
    queries && queries.addNode(previousOrParentNode);
    queueLifecycleHooks(previousOrParentNode.tNode.flags, tView);
    currentElementNode = null;
}
598607
public function _finishSpan(ClientSpan $span) {
        if (!$this->_enabled) {
            return;
        }

        $span->setEndMicros($this->_util->nowMicros());
        $full = $this->pushWithMax($this->_spanRecords, $span->toThrift(), $this->_options["max_span_records"]);
        if ($full) {
            $this->_counters['dropped_spans']++;
        }

        $this->flushIfNeeded();
    }
948274
def end_span
      return unless (span = current_spans.pop)

      span.done

      enqueue.call span

      span
    end
310075
public function spanContext()
    {
        $context = Context::current();
        return new SpanContext(
            $context->value('traceId'),
            $context->value('spanId'),
            $context->value('enabled'),
            $context->value('fromHeader')
        );
    }
1259104
private static void endTenantFlow() {
        Stack<TenantContextDataHolder> contextDataStack = parentHolderInstanceStack.get();
        if (contextDataStack != null) {
            holderInstance.set(contextDataStack.pop());
        }
    }
230274
def update_extent(self, operation):
        """"""
        #Operations represent continuous lines of code.
        #The last operation to be executed is still the current one.
        line, col = operation.start
        operation.context.module.update_elements(line, col, operation.length,
                                                 operation.docdelta)
622226
function (e) {
        if (e && e.prevValue === e.newValue) {
            return;
        }

        var last = this.paginator.getTotalPages(),
            par  = this.current ? this.current.parentNode : null;

        if (this.paginator.getCurrentPage() !== last) {
            if (par && this.current === this.span) {
                par.replaceChild(this.link,this.current);
                this.current = this.link;
            }
        } else if (this.current === this.link) {
            if (par) {
                par.replaceChild(this.span,this.current);
                this.current = this.span;
            }
        }
    }
875842
def handle_endtag(self, tag):
        """"""
        if tag in self.stroke_after_elements:
            if self.text.endswith(self.stroke_text):
                # Only add a stroke if there isn't already a stroke posted
                # In this case, there was no content between the tags, so
                # remove the starting stroke
                self.text = self.text[:-len(self.stroke_text)]
            else:
                # If there's no linebreak before the stroke, add one!
                if not self.text.endswith('\n'):
                    self.text += '\n'
                self.text += self.stroke_text
        if tag == 'a':
            # If it's a link, add a footnote
            self.text += '[{}]'.format(len(self.links))
        elif tag == 'br' and self.text and not self.text.endswith('\n'):
            # If it's a break, check if there's no break at the end of the
            # content. If there's none, add one!
            self.text += '\n'
        # Reset the lasttag, otherwise this parse can geht confused, if the
        # next element is not wrapped in a new tag.
        if tag == self.lasttag:
            self.lasttag = None
1005908
def endElement(self, name):
        
        if self.current:
            # we have nested elements
            obj = self.current
        else:
            # text only node
            text = ''.join(self.chardata).strip()
            obj = self._parse_node_data(text)
        newcurrent, self.chardata = self.stack.pop()
        self.current = self._element_to_node(newcurrent, name, obj)
489363
def get_parent_id(element):
        """"""
        if 'parent' in element.attrib:
            return element.attrib['parent']
        else:
            return element.getparent().attrib[add_ns('id')]
876861
def format_span_json(span):
    
    span_json = {
        'displayName': utils.get_truncatable_str(span.name),
        'spanId': span.span_id,
        'startTime': span.start_time,
        'endTime': span.end_time,
        'childSpanCount': len(span._child_spans)
    }

    parent_span_id = None

    if span.parent_span is not None:
        parent_span_id = span.parent_span.span_id

    if parent_span_id is not None:
        span_json['parentSpanId'] = parent_span_id

    if span.attributes:
        span_json['attributes'] = attributes.Attributes(
            span.attributes).format_attributes_json()

    if span.stack_trace is not None:
        span_json['stackTrace'] = span.stack_trace.format_stack_trace_json()

    if span.time_events:
        span_json['timeEvents'] = {
            'timeEvent': [time_event.format_time_event_json()
                          for time_event in span.time_events]
        }

    if span.links:
        span_json['links'] = {
            'link': [
                link.format_link_json() for link in span.links]
        }

    if span.status is not None:
        span_json['status'] = span.status.format_status_json()

    if span.same_process_as_parent_span is not None:
        span_json['sameProcessAsParentSpan'] = \
            span.same_process_as_parent_span

    return span_json
68332
def update(self):
        
        diff = self._diff()
        if not diff:
            # Nothing to do!
            return
        self.parent.update_node(self, diff)
1325314
private void endMainBlock() {
        BlockTabRec btr = blockTab[0];
        btr.tPosContentsEnd = templateText.length();
        btr.tPosEnd = templateText.length();
        btr.definitionIsOpen = false;
        currentNestingLevel--;
    }
719704
def end_container(self, cancel=None):
        """"""
        if not self._containers:
            return
        container = self._containers.pop()
        if len(self._containers) >= 1:
            parent = self._containers[-1]
        else:
            parent = self._doc.text
        if not cancel:
            parent.addElement(container)
930124
function(e){
	    // Check if we are talking about self or parent.
	    if( this === e.target ||
		container_id === jQuery(e.target).parent().attr('id') ||
		container_id === jQuery(e.target).attr('id') ){
    		_update_start_pos(e);
    		// Bind to moving.
    		jQuery(container_div).bind('mousemove', _scroller);
	    }
    	}
457938
public function updateId()
    {
        if (empty($this->parentNode->key)) {
            $this->id = "{$this->keyDelimiter}$this->key{$this->keyDelimiter}";
        } else {
            $this->id = "{$this->parentNode->id}$this->keyDelimiter{$this->key}$this->keyDelimiter";
        }
        $this->id = preg_replace('/[#]{2,}/', self::DEFAULT_KEY_DELIMITER, $this->id);
    }