build debug stats layer tree
338794
function addDebugLayers (node, tree) {
    for (let layer in node) {
        let counts = node[layer];
        addLayerDebugEntry(tree, layer, counts.features, counts.geoms, counts.styles, counts.base);
        if (counts.layers) {
            tree[layer].layers = tree[layer].layers || {};
            addDebugLayers(counts.layers, tree[layer].layers); // process child layers
        }
    }
}
499418
function buildTree(index, api) {
  const modules = {};

  const dependency = (module, parent) => {
    const filepath = api.resolve(module, parent);
    if (modules[filepath] != null) {
      return modules[filepath];
    }

    const src = api.getFileContents(module, parent, "utf8");
    const basic = api.parser(src);
    const [nestedImports, hasMemory] = parseImports(basic, api);

    const deps = {};

    Object.keys(nestedImports).forEach(mod => {
      if (mod.indexOf(".") === 0) {
        const dep = dependency(mod, filepath);
        deps[mod] = dep;
      }
    });

    const patched = inferImportTypes(basic, deps, api);
    const ast = api.semantics(patched);

    api.validate(ast, {
      lines: src.split("\n"),
      filename: module.split("/").pop(),
    });

    const result = {
      ast,
      deps,
      filepath,
      hasMemory,
    };
    modules[filepath] = result;

    return result;
  };

  const root = dependency(index, null);

  return {
    root,
    modules,
  };
}
489658
def debug(verbose, bot, proxy, exp_config=None):
    """"""
    debugger = DebugDeployment(Output(), verbose, bot, proxy, exp_config)
    log(header, chevrons=False)
    debugger.run()
219206
def debug_object(obj, log_level: int = logging.DEBUG) -> None:
    
    msgs = ["For {o!r}:".format(o=obj)]
    for attrname in dir(obj):
        attribute = getattr(obj, attrname)
        msgs.append("- {an!r}: {at!r}, of type {t!r}".format(
            an=attrname, at=attribute, t=type(attribute)))
    log.log(log_level, "{}", "\n".join(msgs))
1196637
def stats(self):
        
        printDebug("Classes.....: %d" % len(self.all_classes))
        printDebug("Properties..: %d" % len(self.all_properties))
661028
def DEBUG(msg, *args, **kwargs):
    """"""
    logger = getLogger("DEBUG")
    if len(logger.handlers) == 0:
        logger.addHandler(StreamHandler())
    logger.propagate = False
    logger.setLevel(logging.DEBUG)
    logger.DEV(msg, *args, **kwargs)
303544
def _build_ex_tree(self):
        """"""
        # Load exception data into tree structure
        sep = self._exh_obj.callables_separator
        data = self._exh_obj.exceptions_db
        if not data:
            raise RuntimeError("Exceptions database is empty")
        # Add root node to exceptions, needed when tracing done
        # through test runner which is excluded from callable path
        for item in data:
            item["name"] = "root{sep}{name}".format(sep=sep, name=item["name"])
        self._tobj = ptrie.Trie(sep)
        try:
            self._tobj.add_nodes(data)
        except ValueError as eobj:
            if str(eobj).startswith("Illegal node name"):
                raise RuntimeError("Exceptions do not have a common callable")
            raise
        # Find closest root node to first multi-leaf branching or first
        # callable with exceptions and make that the root node
        node = self._tobj.root_name
        while (len(self._tobj.get_children(node)) == 1) and (
            not self._tobj.get_data(node)
        ):
            node = self._tobj.get_children(node)[0]
        if not self._tobj.is_root(node):  # pragma: no branch
            self._tobj.make_root(node)
            nsep = self._tobj.node_separator
            prefix = nsep.join(node.split(self._tobj.node_separator)[:-1])
            self._tobj.delete_prefix(prefix)
        self._print_ex_tree()
288201
def debugDumpNodeList(self, output, depth):
        
        libxml2mod.xmlDebugDumpNodeList(output, self._o, depth)
933490
def debug_string(self, max_debug=MAX_DEBUG_TRIALS):
        """"""
        messages = self._debug_messages()
        states = collections.defaultdict(set)
        limit_per_state = collections.Counter()
        for t in self._trials:
            states[t.status].add(t)

        # Show at most max_debug total, but divide the limit fairly
        while max_debug > 0:
            start_num = max_debug
            for s in states:
                if limit_per_state[s] >= len(states[s]):
                    continue
                max_debug -= 1
                limit_per_state[s] += 1
            if max_debug == start_num:
                break

        for local_dir in sorted({t.local_dir for t in self._trials}):
            messages.append("Result logdir: {}".format(local_dir))

        num_trials_per_state = {
            state: len(trials)
            for state, trials in states.items()
        }
        total_number_of_trials = sum(num_trials_per_state.values())
        if total_number_of_trials > 0:
            messages.append("Number of trials: {} ({})"
                            "".format(total_number_of_trials,
                                      num_trials_per_state))

        for state, trials in sorted(states.items()):
            limit = limit_per_state[state]
            messages.append("{} trials:".format(state))
            sorted_trials = sorted(
                trials, key=lambda t: _naturalize(t.experiment_tag))
            if len(trials) > limit:
                tail_length = limit // 2
                first = sorted_trials[:tail_length]
                for t in first:
                    messages.append(" - {}:\t{}".format(
                        t, t.progress_string()))
                messages.append(
                    "  ... {} not shown".format(len(trials) - tail_length * 2))
                last = sorted_trials[-tail_length:]
                for t in last:
                    messages.append(" - {}:\t{}".format(
                        t, t.progress_string()))
            else:
                for t in sorted_trials:
                    messages.append(" - {}:\t{}".format(
                        t, t.progress_string()))

        return "\n".join(messages) + "\n"
543026
function () {
			var oModel = this._oDialog.getModel("view"),
				oTreeResults;

			// early out if already open
			if (this._oDebugPopover && this._oDebugPopover.isOpen()) {
				return;
			}

			// fill and bind the tree structure from the currently loaded modules
			oTreeResults = this._treeHelper.toTreeModel(this._oModuleSystemInfo);
			oModel.setProperty("/DebugModules", [oTreeResults.tree]);
			this._updateTreeInfos();

			// create dialog lazily
			if (!this._oDebugPopover) {
				this._oDebugPopover = sap.ui.xmlfragment(this._DEBUG_MODULES_ID, "sap.ui.core.support.techinfo.TechnicalInfoDebugDialog", this);
				this._oDialog.addDependent(this._oDebugPopover);
				syncStyleClass(this._getContentDensityClass(), this._oDialog, this._oDebugPopover);
				var oControl = this._getControl("customDebugValue", this._DEBUG_MODULES_ID);
				try {
					this._validateCustomDebugValue(oControl.getValue());
				} catch (oException)  {
					this._showError(oControl, oException.message);
					return;
				}
			}

			// adopt tree depth to the deepest currently selected module
			this._getControl("tree", this._DEBUG_MODULES_ID).expandToLevel(Math.max(this._MIN_EXPAND_LEVEL_DEBUG_MODULES, oTreeResults.depth));

			// open dialog
			this._oDebugPopover.open();
		}
111354
def view_build():
    """"""
    build = g.build
    page_size = min(request.args.get('page_size', 10, type=int), 50)
    offset = request.args.get('offset', 0, type=int)

    ops = operations.BuildOps(build.id)
    has_next_page, candidate_list, stats_counts = ops.get_candidates(
        page_size, offset)

    # Collate by release name, order releases by latest creation. Init stats.
    release_dict = {}
    created_dict = {}
    run_stats_dict = {}
    for candidate in candidate_list:
        release_list = release_dict.setdefault(candidate.name, [])
        release_list.append(candidate)
        max_created = created_dict.get(candidate.name, candidate.created)
        created_dict[candidate.name] = max(candidate.created, max_created)
        run_stats_dict[candidate.id] = dict(
            runs_total=0,
            runs_complete=0,
            runs_successful=0,
            runs_failed=0,
            runs_baseline=0,
            runs_pending=0)

    # Sort each release by candidate number descending
    for release_list in release_dict.itervalues():
        release_list.sort(key=lambda x: x.number, reverse=True)

    # Sort all releases by created time descending
    release_age_list = [
        (value, key) for key, value in created_dict.iteritems()]
    release_age_list.sort(reverse=True)
    release_name_list = [key for _, key in release_age_list]

    # Count totals for each run state within that release.
    for candidate_id, status, count in stats_counts:
        stats_dict = run_stats_dict[candidate_id]
        for key in ops.get_stats_keys(status):
            stats_dict[key] += count

    return render_template(
        'view_build.html',
        build=build,
        release_name_list=release_name_list,
        release_dict=release_dict,
        run_stats_dict=run_stats_dict,
        has_next_page=has_next_page,
        current_offset=offset,
        next_offset=offset + page_size,
        last_offset=max(0, offset - page_size),
        page_size=page_size)
1021497
def stats_on_depth(d, depth):
        
        root_nodes, leaf_nodes = 0, 0
        for _, node in DictTree.kv_depth(d, depth):
            if DictTree.length(node) == 0:
                leaf_nodes += 1
            else:
                root_nodes += 1
        total = root_nodes + leaf_nodes
        print("On depth %s, having %s root nodes, %s leaf nodes. "
              "%s nodes in total." % (depth, root_nodes, leaf_nodes, total))
1259187
def debug(self, nest_level=1):
        

        prefix = '  ' * nest_level

        # This interacts with Any and moves the tag, implicit, explicit, _header,
        # contents, _footer to the parsed value so duplicate data isn't present
        has_parsed = hasattr(self, 'parsed')

        _basic_debug(prefix, self)
        if has_parsed:
            self.parsed.debug(nest_level + 2)
        elif hasattr(self, 'chosen'):
            self.chosen.debug(nest_level + 2)
        else:
            if _PY2 and isinstance(self.native, byte_cls):
                print('%s    Native: b%s' % (prefix, repr(self.native)))
            else:
                print('%s    Native: %s' % (prefix, self.native))
110353
def debugTreePrint(node,pfx="->"):
  """"""
  print pfx,node.item
  for c in node.children:
    debugTreePrint(c,"  "+pfx)
1131759
function buildTree(directory, depth, parentGitignoreList) {
  const files = fs.readdirSync(directory);
  const max_index = files.length - 1
  const color = chalk[colors[depth % colors.length]]
  parentGitignoreList = parentGitignoreList || []
  const gitignoreList = hideFilesInGitIgnore
    ? parentGitignoreList.concat(readGitignore(directory))
    : []

  for (let i = 0; i <= max_index; i++) {
    const file = files[i]
    depths[depth] = max_index - i
    const fullPath = path.resolve(directory, file)
    let printWithoutDescending = false
    let postfix = ''
    let prefix = buildPrefix(depth, i === max_index, directory)
    const stats = fs.statSync(fullPath)
    const isDirectory = stats.isDirectory()
    const size = prettybytes(stats.size)

    if (showTimeStamp) {
      prefix += dateTemplate.render(new Date(stats.mtime))
    }

    if (isDirectory) {
      directoryCount++
    } else {
      fileCount++
      totalFileSize += stats.size
    }

    if (!shouldBeIncluded(file)) {
      continue
    }

    if (hideFilesInGitIgnore) {
      let matchesGitIgnoreEntry = false
      let m = gitignoreList.length
      while (!matchesGitIgnoreEntry && m > 0) {
        matchesGitIgnoreEntry = minimatch(file, gitignoreList[m - 1])
        m--
      }

      if (matchesGitIgnoreEntry) {
        continue
      }
    }

    if (!isDirectory && showOnlyDirectories) {
      continue
    }

    if (isDirectory) {
      if (fileLimit !== Infinity || pruneEmptyDirectories) {
        const dirfiles = fs.readdirSync(fullPath).filter(shouldBeIncluded)
        if (pruneEmptyDirectories && dirfiles.length === 0) {
          continue
        }
        if (dirfiles.length > fileLimit) {
          printWithoutDescending = true
          postfix = ` [${dirfiles.length} entries exceeds filelimit (${fileLimit}), not opening dir]`
        }
      }
    }

    const filename = showFullPath ? color(fullPath.replace(cwd + '/', '')) : color(file)
    const JSXTags = createJSXTags(filename, isDirectory, size, fullPath)

    if (printJSX) {
      output += prefix + JSXTags.open + '\n'
    } else {
      output += prefix + filename + (!isDirectory && showSize ? ` (${size})` : '') + postfix + '\n';
    }
    if (printWithoutDescending) {
      continue
    }
    if (isDirectory && (depth + 1 < maxDepth)) {
      buildTree(path.resolve(directory, file), depth + 1, gitignoreList)
    }
    if (printJSX && JSXTags.close) {
      output += prefix + JSXTags.close + '\n'
    }
    --depths[depth]
  }
}
717704
function debug() {
  var args = [LEVELS.DEBUG].concat(slice.apply(arguments));
  return this.log.apply(this, args);
}
8796
def installStatsLoop(statsFile, statsDelay):
  """"""

  def dumpStats():
    """Actual stats dump function."""
    scales.dumpStatsTo(statsFile)
    reactor.callLater(statsDelay, dumpStats)

  def startStats():
    """Starts the stats dump in "statsDelay" seconds."""
    reactor.callLater(statsDelay, dumpStats)

  reactor.callWhenRunning(startStats)