Construct a new frame representing the given ancestry item.
968001
def __frame_factory(self, ancestry_item):
        """"""
        frame_class = Frame
        if ancestry_item is not None and ancestry_item.choice():
            frame_class = ChoiceFrame
        return frame_class(ancestry_item, self.__error,
            self.__extra_parameter_errors)
819603
function inset (frame, top, right, bottom, left) {
  var frameCopy = clone(frame);

  // inset(myFrame, 10, 0) => inset(myFrame, 10, 0, 10, 0)
  if (typeof bottom === 'undefined') {
    bottom = top;
    left = right;
  }

  // inset(myFrame, 10) => inset(myFrame, 10, 10, 10, 10)
  if (typeof right === 'undefined') {
    right = bottom = left = top;
  }

  frameCopy.x += left;
  frameCopy.y += top;
  frameCopy.height -= (top + bottom);
  frameCopy.width -= (left + right);

  return frameCopy;
}
1109454
private void visitImplicitFirstFrame() {
        // There can be at most descriptor.length() + 1 locals
        int frameIndex = startFrame(0, descriptor.length() + 1, 0);
        if ((access & Opcodes.ACC_STATIC) == 0) {
            if ((access & ACC_CONSTRUCTOR) == 0) {
                frame[frameIndex++] = Frame.OBJECT | cw.addType(cw.thisName);
            } else {
                frame[frameIndex++] = Frame.UNINITIALIZED_THIS;
            }
        }
        int i = 1;
        loop: while (true) {
            int j = i;
            switch (descriptor.charAt(i++)) {
            case 'Z':
            case 'C':
            case 'B':
            case 'S':
            case 'I':
                frame[frameIndex++] = Frame.INTEGER;
                break;
            case 'F':
                frame[frameIndex++] = Frame.FLOAT;
                break;
            case 'J':
                frame[frameIndex++] = Frame.LONG;
                break;
            case 'D':
                frame[frameIndex++] = Frame.DOUBLE;
                break;
            case '[':
                while (descriptor.charAt(i) == '[') {
                    ++i;
                }
                if (descriptor.charAt(i) == 'L') {
                    ++i;
                    while (descriptor.charAt(i) != ';') {
                        ++i;
                    }
                }
                frame[frameIndex++] = Frame.type(cw, descriptor.substring(j, ++i));
                break;
            case 'L':
                while (descriptor.charAt(i) != ';') {
                    ++i;
                }
                frame[frameIndex++] = Frame.OBJECT
                        | cw.addType(descriptor.substring(j + 1, i++));
                break;
            default:
                break loop;
            }
        }
        frame[1] = frameIndex - 3;
        endFrame();
    }
400786
def addItem(self, item):
        """"""
        try:
            self.tree.addItem(item)
        except AttributeError, e:
            raise VersionError('Saved versions are immutable')
434775
private void putFrame() {
    final int nLocal = currentFrame[1];
    final int nStack = currentFrame[2];
    if (symbolTable.getMajorVersion() < Opcodes.V1_6) {
      // Generate a StackMap attribute entry, which are always uncompressed.
      stackMapTableEntries.putShort(currentFrame[0]).putShort(nLocal);
      putAbstractTypes(3, 3 + nLocal);
      stackMapTableEntries.putShort(nStack);
      putAbstractTypes(3 + nLocal, 3 + nLocal + nStack);
      return;
    }
    final int offsetDelta =
        stackMapTableNumberOfEntries == 0
            ? currentFrame[0]
            : currentFrame[0] - previousFrame[0] - 1;
    final int previousNlocal = previousFrame[1];
    final int nLocalDelta = nLocal - previousNlocal;
    int type = Frame.FULL_FRAME;
    if (nStack == 0) {
      switch (nLocalDelta) {
        case -3:
        case -2:
        case -1:
          type = Frame.CHOP_FRAME;
          break;
        case 0:
          type = offsetDelta < 64 ? Frame.SAME_FRAME : Frame.SAME_FRAME_EXTENDED;
          break;
        case 1:
        case 2:
        case 3:
          type = Frame.APPEND_FRAME;
          break;
        default:
          // Keep the FULL_FRAME type.
          break;
      }
    } else if (nLocalDelta == 0 && nStack == 1) {
      type =
          offsetDelta < 63
              ? Frame.SAME_LOCALS_1_STACK_ITEM_FRAME
              : Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED;
    }
    if (type != Frame.FULL_FRAME) {
      // Verify if locals are the same as in the previous frame.
      int frameIndex = 3;
      for (int i = 0; i < previousNlocal && i < nLocal; i++) {
        if (currentFrame[frameIndex] != previousFrame[frameIndex]) {
          type = Frame.FULL_FRAME;
          break;
        }
        frameIndex++;
      }
    }
    switch (type) {
      case Frame.SAME_FRAME:
        stackMapTableEntries.putByte(offsetDelta);
        break;
      case Frame.SAME_LOCALS_1_STACK_ITEM_FRAME:
        stackMapTableEntries.putByte(Frame.SAME_LOCALS_1_STACK_ITEM_FRAME + offsetDelta);
        putAbstractTypes(3 + nLocal, 4 + nLocal);
        break;
      case Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED:
        stackMapTableEntries
            .putByte(Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED)
            .putShort(offsetDelta);
        putAbstractTypes(3 + nLocal, 4 + nLocal);
        break;
      case Frame.SAME_FRAME_EXTENDED:
        stackMapTableEntries.putByte(Frame.SAME_FRAME_EXTENDED).putShort(offsetDelta);
        break;
      case Frame.CHOP_FRAME:
        stackMapTableEntries.putByte(Frame.SAME_FRAME_EXTENDED + nLocalDelta).putShort(offsetDelta);
        break;
      case Frame.APPEND_FRAME:
        stackMapTableEntries.putByte(Frame.SAME_FRAME_EXTENDED + nLocalDelta).putShort(offsetDelta);
        putAbstractTypes(3 + previousNlocal, 3 + nLocal);
        break;
      case Frame.FULL_FRAME:
      default:
        stackMapTableEntries.putByte(Frame.FULL_FRAME).putShort(offsetDelta).putShort(nLocal);
        putAbstractTypes(3, 3 + nLocal);
        stackMapTableEntries.putShort(nStack);
        putAbstractTypes(3 + nLocal, 3 + nLocal + nStack);
    }
  }
4697
def construct_selector(self, el, attr=''):
        """"""

        selector = deque()
        ancestor = el
        while ancestor and ancestor.parent:
            if ancestor is not el:
                selector.appendleft(ancestor.name)
            else:
                tag = ancestor.name
                prefix = ancestor.prefix
                classes = self.get_classes(ancestor)
                tag_id = ancestor.attrs.get('id', '').strip()
                sel = ''
                if prefix:
                    sel += prefix + '|'
                sel += tag
                if tag_id:
                    sel += '#' + tag_id
                if classes:
                    sel += '.' + '.'.join(classes)
                if attr:
                    sel += '[%s]' % attr
                selector.appendleft(sel)
            ancestor = ancestor.parent
        return '>'.join(selector)
1223156
function add_frame(Frame $frame) {
    
    $style = $frame->get_style();
    $display = $style->display;

    $collapse = $this->_table->get_style()->border_collapse == "collapse";

    // Recursively add the frames within tables, table-row-groups and table-rows
    if ( $display === "table-row" ||
         $display === "table" ||
         $display === "inline-table" ||
         in_array($display, Table_Frame_Decorator::$ROW_GROUPS) ) {

      $start_row = $this->__row;
      foreach ( $frame->get_children() as $child )
        $this->add_frame( $child );

      if ( $display === "table-row" )
        $this->add_row();

      $num_rows = $this->__row - $start_row - 1;
      $key = $frame->get_id();

      // Row groups always span across the entire table
      $this->_frames[$key]["columns"] = range(0,max(0,$this->_num_cols-1));
      $this->_frames[$key]["rows"] = range($start_row, max(0, $this->__row - 1));
      $this->_frames[$key]["frame"] = $frame;

      if ( $display !== "table-row" && $collapse ) {

        $bp = $style->get_border_properties();

        // Resolve the borders
        for ( $i = 0; $i < $num_rows+1; $i++) {
          $this->_resolve_border($start_row + $i, 0, "vertical", $bp["left"]);
          $this->_resolve_border($start_row + $i, $this->_num_cols, "vertical", $bp["right"]);
        }

        for ( $j = 0; $j < $this->_num_cols; $j++) {
          $this->_resolve_border($start_row, $j, "horizontal", $bp["top"]);
          $this->_resolve_border($this->__row, $j, "horizontal", $bp["bottom"]);
        }
      }


      return;
    }
    
    $node = $frame->get_node();
    
    // Determine where this cell is going
    $colspan = $node->getAttribute("colspan");
    $rowspan = $node->getAttribute("rowspan");

    if ( !$colspan ) {
      $colspan = 1;
      $node->setAttribute("colspan",1);
    }

    if ( !$rowspan ) {
      $rowspan = 1;
      $node->setAttribute("rowspan",1);
    }
    $key = $frame->get_id();

    $bp = $style->get_border_properties();


    // Add the frame to the cellmap
    $max_left = $max_right = 0;

    // Find the next available column (fix by Ciro Mondueri)
    $ac = $this->__col;
    while ( isset($this->_cells[$this->__row][$ac]) )
       $ac++;
    $this->__col = $ac;

    // Rows:
    for ( $i = 0; $i < $rowspan; $i++ ) {
      $row = $this->__row + $i;

      $this->_frames[$key]["rows"][] = $row;

      for ( $j = 0; $j < $colspan; $j++)
        $this->_cells[$row][$this->__col + $j] = $frame;

      if ( $collapse ) {
        // Resolve vertical borders
        $max_left = max($max_left, $this->_resolve_border($row, $this->__col, "vertical", $bp["left"]));
        $max_right = max($max_right, $this->_resolve_border($row, $this->__col + $colspan, "vertical", $bp["right"]));
      }
    }

    $max_top = $max_bottom = 0;

    // Columns:
    for ( $j = 0; $j < $colspan; $j++ ) {
      $col = $this->__col + $j;
      $this->_frames[$key]["columns"][] = $col;

      if ( $collapse ) {
        // Resolve horizontal borders
        $max_top = max($max_top, $this->_resolve_border($this->__row, $col, "horizontal", $bp["top"]));
        $max_bottom = max($max_bottom, $this->_resolve_border($this->__row + $rowspan, $col, "horizontal", $bp["bottom"]));
      }
    }

    $this->_frames[$key]["frame"] = $frame;

    // Handle seperated border model
    if ( !$collapse ) {
      list($h, $v) = $this->_table->get_style()->border_spacing;

      // Border spacing is effectively a margin between cells
      $v = $style->length_in_pt($v) / 2;
      $h = $style->length_in_pt($h) / 2;
      $style->margin = "$v $h";

      // The additional 1/2 width gets added to the table proper

    } else {

      // Drop the frame's actual border
      $style->border_left_width = $max_left / 2;
      $style->border_right_width = $max_right / 2;
      $style->border_top_width = $max_top / 2;
      $style->border_bottom_width = $max_bottom / 2;
      $style->margin = "none";
    }

    // Resolve the frame's width
    list($frame_min, $frame_max) = $frame->get_min_max_width();

    $width = $style->width;

    if ( is_percent($width) ) {
      $var = "percent";
      $val = (float)rtrim($width, "% ") / $colspan;

    } else if ( $width !== "auto" ) {
      $var = "absolute";
      $val = $style->length_in_pt($frame_min) / $colspan;
    }

    if (!$this->_columns_locked) {
      $min = 0;
      $max = 0;
      for ( $cs = 0; $cs < $colspan; $cs++ ) {
  
        // Resolve the frame's width(s) with other cells
        $col =& $this->get_column( $this->__col + $cs );
  
        // Note: $var is either 'percent' or 'absolute'.  We compare the
        // requested percentage or absolute values with the existing widths
        // and adjust accordingly.
        if ( isset($var) && $val > $col[$var] ) {
          $col[$var] = $val;
          $col["auto"] = false;
        }
  
        $min += $col["min-width"];
        $max += $col["max-width"];
      }
  
  
      if ( $frame_min > $min ) {
        // The frame needs more space.  Expand each sub-column
        $inc = ($frame_min - $min) / $colspan;
        for ($c = 0; $c < $colspan; $c++) {
          $col =& $this->get_column($this->__col + $c);
          $col["min-width"] += $inc;
        }
      }
  
      if ( $frame_max > $max ) {
        $inc = ($frame_max - $max) / $colspan;
        for ($c = 0; $c < $colspan; $c++) {
          $col =& $this->get_column($this->__col + $c);
          $col["max-width"] += $inc;
        }
      }
    }

    $this->__col += $colspan;
    if ( $this->__col > $this->_num_cols )
      $this->_num_cols = $this->__col;

  }
683594
function pushFrame(resultSet, options, frameElement, frameSelector) {
	'use strict';
	var frameXpath = axe.utils.getXpath(frameElement);
	var frameSpec = {
		element: frameElement,
		selector: frameSelector,
		xpath: frameXpath
	};

	resultSet.forEach(function(res) {
		res.node = axe.utils.DqElement.fromFrame(res.node, options, frameSpec);

		var checks = axe.utils.getAllChecks(res);
		if (checks.length) {
			checks.forEach(function(check) {
				check.relatedNodes = check.relatedNodes.map(node =>
					axe.utils.DqElement.fromFrame(node, options, frameSpec)
				);
			});
		}
	});
}
662955
def _insert_item(self, root, data, from_file=False):
        """"""

        tree = self.treeview
        treelabel = data.get_id()
        row = col = ''
        if root != '' and 'layout' in data:
            row = data.get_layout_property('row')
            col = data.get_layout_property('column')

            # fix row position when using copy and paste
            # If collision, increase by 1
            row_count = self.get_max_row(root)
            if not from_file and (row_count > int(row) and int(col) == 0):
                row = str(row_count + 1)
                data.set_layout_property('row', row)

        image = ''
        try:
            image = StockImage.get('16x16-tk.default')
        except StockImageException:
            # TODO: notify something here
            pass

        try:
            image = StockImage.get('16x16-{0}'.format(data.get_class()))
        except StockImageException:
            # TODO: notify something here
            pass

        values = (data.get_class(), row, col)
        item = tree.insert(root, 'end', text=treelabel, values=values,
                           image=image)
        data.attach(self)
        self.treedata[item] = data

        # Update grid r/c data
        self._update_max_grid_rc(root, from_file=True)
        self.app.set_changed()

        return item
854751
def acceptRecord(self, item):
        
        record = item.record()
        self.treePopupWidget().close()
        self.setCurrentRecord(record)
1205463
def push(self, item):
        
        if item in self.pushed:
            return
        frame = (item, iter(item[1]))
        self.stack.append(frame)
        self.pushed.add(item)
9406
def _add_graphicFrame_containing_table(self, rows, cols, x, y, cx, cy):
        
        _id = self._next_shape_id
        name = 'Table %d' % (_id-1)
        graphicFrame = self._spTree.add_table(
            _id, name, rows, cols, x, y, cx, cy
        )
        return graphicFrame
1100103
function sibling(node, selector, ancestry) {
            var parent = ancestry[0], listProp, keys, i, l, k, m;
            if (!parent) { return false; }
            keys = estraverse.VisitorKeys[parent.type];
            for (i = 0, l = keys.length; i < l; ++i) {
                listProp = parent[keys[i]];
                if (isArray(listProp)) {
                    for (k = 0, m = listProp.length; k < m; ++k) {
                        if (listProp[k] !== node && matches(listProp[k], selector, ancestry)) {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
1333783
def new_graphicFrame(cls, id_, name, x, y, cx, cy):
        
        xml = cls._graphicFrame_tmpl() % (id_, name, x, y, cx, cy)
        graphicFrame = parse_xml(xml)
        return graphicFrame
1371058
function addTopicLine (topic, ancestor) {
    var
      ancestorTopic = ancestor.topic,
      additionalTopics = [];

    if (ancestorTopic !== topic) {
      // All of the generations to add seeded by the youngest existing ancestor
      additionalTopics = reduce(
        appendPrefixedTopic, [ancestorTopic],
        topic.substr(ancestorTopic.length).replace(/^\./, '').split('.')
      );
    }

    // Add a node to the tree for each new topic
    return addFamilyLine(
      addChildTopic, map(createNode, additionalTopics.slice(1)), ancestor
    );
  }
78918
def build(self, name):
        ""
        if isinstance(name, basestring):
            type = self.resolver.find(name)
            if type is None:
                raise TypeNotFound(name)
        else:
            type = name
        cls = type.name
        if type.mixed():
            data = Factory.property(cls)
        else:
            data = Factory.object(cls)
        resolved = type.resolve()
        md = data.__metadata__
        md.sxtype = resolved
        md.ordering = self.ordering(resolved)
        history = []
        self.add_attributes(data, resolved)
        for child, ancestry in type.children():
            if self.skip_child(child, ancestry):
                continue
            self.process(data, child, history[:])
        return data
311313
def frame(params = nil)
      if params
        frame = params
        self
      else
        if selected.length == 1
          Rect.frame_for_view(selected.first)
        else
          selected.map{|s| Rect.frame_for_view(s)}
        end
      end
    end