traverse icons in a row of icon atlas extend each icon with left-top coordinates
189533
function buildRowMapping(mapping, columns, yOffset) {
  for (let i = 0; i < columns.length; i++) {
    const {icon, xOffset} = columns[i];
    const id = getIconId(icon);
    mapping[id] = Object.assign({}, icon, {
      x: xOffset,
      y: yOffset
    });
  }
}
729752
def map_tree(visitor, tree):
    """"""
    newn = [map_tree(visitor, node) for node in tree.nodes]
    return visitor(tree, newn)
877752
def vertically(value, num_blocks, val_min, color, args):
    """"""
    global maxi, value_list

    value_list.append(str(value))

    # In case the number of blocks at the end of the normalization is less
    # than the default number, use the maxi variable to escape.
    if maxi < num_blocks:
        maxi = num_blocks

    if num_blocks > 0:
        vertical_list.append((TICK * num_blocks))
    else:
        vertical_list.append(SM_TICK)

    # Zip_longest method in order to turn them vertically.
    for row in zip_longest(*vertical_list, fillvalue='  '):
        zipped_list.append(row)

    counter, result_list = 0, []

    # Combined with the maxi variable, escapes the appending method at
    # the correct point or the default one (width).
    for i in reversed(zipped_list):
        result_list.append(i)
        counter += 1

        if maxi == args['width']:
            if counter == (args['width']):
                break
        else:
            if counter == maxi:
                break

    # Return a list of rows which will be used to print the result vertically.
    return result_list
919510
def get_left_key_rect(self):
        """"""

        key_left = self.row, self.col - 1, self.tab

        border_width_right = \
            float(self.cell_attributes[key_left]["borderwidth_right"]) / 2.0

        rect_left = (self.x-border_width_right, self.y,
                     border_width_right, self.height)
        return key_left, rect_left
373515
def get_above_left_key_rect(self):
        """"""

        key_above_left = self.row - 1, self.col - 1, self.tab

        border_width_right = \
            float(self.cell_attributes[key_above_left]["borderwidth_right"]) \
            / 2.0
        border_width_bottom = \
            float(self.cell_attributes[key_above_left]["borderwidth_bottom"]) \
            / 2.0

        rect_above_left = (self.x-border_width_right,
                           self.y-border_width_bottom,
                           border_width_right, border_width_bottom)
        return key_above_left, rect_above_left
1080062
def draw_tree(node,
              child_iter=lambda n: n.children,
              text_str=str):
    """"""
    return LeftAligned(traverse=Traversal(get_text=text_str,
                                          get_children=child_iter),
                       draw=LegacyStyle())(node)
637578
def expand_nested(self, cats):
        """"""
        down = '│'
        right = '└──'

        def get_children(parent):
            return [e() for e in parent._entries.values() if e._container == 'catalog']

        if len(cats) == 0:
            return

        cat = cats[0]
        old = list(self.options.items())
        name = next(k for k, v in old if v == cat)
        index = next(i for i, (k, v) in enumerate(old) if v == cat)
        if right in name:
            prefix = f'{name.split(right)[0]}{down} {right}'
        else:
            prefix = right

        children = get_children(cat)
        for i, child in enumerate(children):
            old.insert(index+i+1, (f'{prefix} {child.name}', child))
        self.widget.options = dict(old)
956350
function () {
                    var rect = this._anchorElement.getBoundingClientRect();

                    return {
                        x: rect.left,
                        y: rect.top,
                        width: rect.width,
                        height: rect.height
                    };
                }
1108871
function Histogram( canvas, width, height, left, top ) {

		var graph, data, histogram, edges, axes, annotations, title, text;

		// [1] Instantiate a new graph generator and configure:
		graph = xfig.graph( canvas )
			.width( width )
			.height( height )
			.position({
				'left': left,
				'top': top
			})
			.xMin( 0 )
			.xMax( 1 )
			.yMin( 0 );

		// Create the graph:
		graph.create( 'histogram' );

		// Get data:
		d3.json( 'data/histogram.data.json', function ( error, json ) {

			// [2] Instantiate a new data generator and configure:
			data = xfig.data( json )
				.accessors( 'x', function ( d ) {
					return d[ 0 ];
				})
				.accessors( 'y', function ( d ) {
					return d[ 1 ];
				});

			// Create edges to define our histogram bins:
			edges = xfig.vector.linspace( -0.025, 1.025, 0.05 );
			
			// Format the data and histogram the data:
			data.format( [ 'x', 'y' ] )
				.histc(
					function ( d ) {
						return d[ 1 ];
					},
					edges
				);

			// Bind the data instance to the graph:
			graph.data( data )
				.yMax( data.max( function ( d ) {
					return d[ 1 ];
				}));

			// [3] Instantiate a new histogram generator and configure:
			histogram = xfig.histogram( graph )
				.labels( [ 'data 0' ] );

			// Create the histogram:
			histogram.create();

			// [4] Instantiate a new axes generator and configure:
			axes = xfig.axes( graph )
				.yLabel( 'counts' );

			// Create the axes:
			axes.create();

			// [5] Instantiate a new annotations generator and configure:
			annotations = xfig.annotations( graph );

			// Create the annotations element:
			annotations.create();

			// [5.1] Instantiate a new title instance and configure:
			title = annotations.title()
				.top( -30 )
				.left( 250 );

			// Add a (sub)title:
			title.create( 'Subtitle' );

			// [5.2] Instantiate a new text instance and configure:
			text = annotations.text()
				.width( 200 )
				.height( 100 )
				.top( 50 )
				.left( 310 );

			// Add a text annotation:
			text.create( 'This is another text annotation, which may run multiple lines.' );

		});

	}
700102
def _map(value, istart, istop, ostart, ostop):
    
    return ostart + (ostop - ostart) * ((value - istart) / (istop - istart))
1371457
def map_overview_header_element(feature, parent):
    """"""
    _ = feature, parent  # NOQA
    header = map_overview_header['string_format']
    return header.capitalize()
430822
def resetToPreviousLoc(self):
        
        self.rect.left = self.startDraggingX
        self.rect.top = self.startDraggingY
1218986
def _collectAxisPoints(self):
        
        for l, (value, deltaName) in self.items():
            location = Location(l)
            name = location.isOnAxis()
            if name is not None and name is not False:
                if name not in self._axes:
                    self._axes[name] = []
                if l not in self._axes[name]:
                    self._axes[name].append(l)
        return self._axes
762710
def iter_top_row_tcs(self):
        """"""
        tr = self._tbl.tr_lst[self._top]
        for tc in tr.tc_lst[self._left:self._right]:
            yield tc
84449
function walklook(g, iri, walkIri, lookIri, s = new Set(), ws = new Set()) {
  if (ws.has(iri)) return s; // Prevents cycles
  if (!g[iri]) return warn(`Resource missing in graph: ${iri}`) || s;

  ws.add(iri);

  if (g[iri][lookIri]) g[iri][lookIri].forEach(lIri => s.add(lIri));

  if (s.size) return s;

  if (g[iri][walkIri]) g[iri][walkIri].forEach(wIri => walklook(g, wIri, walkIri, lookIri, s, ws));

  return s;
}
18793
def map(self, width, height):
        
        template = ti.load(os.path.join(script_dir, 'assets', 'template.tmx'))['map0']
        #template.set_view(0, 0, template.px_width, template.px_height)
        template.set_view(0, 0, width*template.tw, height*template.th)

        # TODO: Save the generated map.
        #epoch = int(time.time())
        #filename = 'map_' + str(epoch) + '.tmx'

        # Draw borders
        border_x = template.cells[width]
        for y in xrange(0,height+1):
            border_x[y].tile = template.cells[0][0].tile

        for x in xrange(0,width):
            template.cells[x][height].tile = template.cells[0][0].tile

        # Start within borders
        #self.recursive_division(template.cells, 3, (template.px_width/template.tw)-1, (template.px_height/template.th)-1, 0, 0)
        self.recursive_division(template.cells, 3, width, height, 0, 0)

        return template
1019631
def _all_expander(fringe, iteration, viewer):
    '''
    
    '''
    expanded_neighbors = [node.expand(local_search=True)
                          for node in fringe]

    if viewer:
        viewer.event('expanded', list(fringe), expanded_neighbors)

    list(map(fringe.extend, expanded_neighbors))