Count all registered menus and their elements.
482051
public function count(string $identifier = ''): int
    {
        if ($identifier) {
            return $this->countItems($identifier);
        }

        $menus   = $this->all();
        $counter = 0;

        foreach ($menus as $identifier => $menu) {
            $counter += $this->countItems($identifier);
        }

        return $counter;
    }
201445
def number_of_subkeys(self):
    """"""
    if not self._registry_key and self._registry:
      self._GetKeyFromRegistry()

    return len(self._subkeys)
544406
def countRemovedDataProducts(self):
        """"""
        return len([item for item, dp in self.wdplv.getItemDPList() if dp.policy == "remove"])
866017
def count(self, item):
        """"""
        # pylint: disable=arguments-differ
        key, value = item
        return 1 if key in self._dict and self._dict[key] == value else 0
1344968
def get_menu_actions(self):
        """"""
        items = self.selectedItems()
        actions = self.get_actions_from_items(items)
        if actions:
            actions.append(None)
        actions += self.common_actions
        return actions
837807
def counter(module, name, count=1):
    
    counter = get_metric('counters', module, name, Counter())
    counter.inc(count)
828638
def get_menu(self, name):
        """"""
        if name not in self._menus:
            self._menus[name] = self.menuBar().addMenu(name)
        return self._menus[name]
368522
def delete_all_menus(self, ):
        
        for m in self.menus.itervalues():
            m._delete()
        self.menus.clear()
1143481
def count(self, elem):
        
        return self._left_list.count(elem) + self._right_list.count(elem)
608079
def rowCount(self, parent):
        """"""
        if not parent.isValid():
            v = self._conf
        else:
            v = self.get_value(parent)
        if isinstance(v, Section):
            return len(v.keys())
        else:
            return 0
934009
private void addMenuItems(Menu f, String[] m) {

        for (int i = 0; i < m.length; i++) {
            if (m[i].equals("-")) {
                f.addSeparator();
            } else {
                MenuItem item = new MenuItem(m[i]);

                item.addActionListener(this);
                f.add(item);
            }
        }
    }
752028
function menu($menus)
    {
        // Retrieve current user (for permissions)
        $user = Auth::user();

        $templates = [
            "menu" => '
              <ul class="sidebar-menu" data-widget="tree">
                %s
              </ul>
        ',

            "menu_row" => '
          <li class="%s">
            %s
          </li>
        ', // class, link . submenu

            "menu_caret" => '
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>',

            "menu_subrow" => '
          <ul class="treeview-menu">
            %s
          </ul>
        ',

            "menu_link" => '
          <a href="%s"><i class="%s text-red"></i><span>%s</span>%s</a>
        ' // url, icon, title
        ];

        $traverse = function ($rows) use (&$traverse, $templates, $user) {
            $menuString = "";
            $hasActive = false;
            foreach ($rows as $menu) {
                if (!empty($menu->permission) and !$user->hasPermission($menu->permission)) {
                    continue;
                }

                $hasActive = false;
                $submenu = "";
                $authorized = true;

                if ($menu->children->count() > 0) {
                    list($submenuString, $hasActive) = $traverse($menu->children);
                    $submenu = "";
                    if (!empty($submenuString)) {
                        $submenu = sprintf($templates['menu_subrow'], $submenuString);
                    } else {
                        $authorized = false;
                    }
                }

                $menu_caret = (!empty($submenu) ? $templates['menu_caret'] : '');
                $link = sprintf($templates['menu_link'],
                    (!empty($menu->route) ? url($menu->route) : '#'),
                    (!empty($menu->icon) ? $menu->icon : 'fa fa-circle-o'),
                    //trans('back-project::base.dashboard')
                    \Lang::has('back-project::menu.' . $menu->title) ? __('back-project::menu.' . $menu->title) : $menu->title,
                    $menu_caret
                );
                $class = (!empty($submenu) ? 'treeview' : '');
                $current_url = \Route::current()->uri();

                if ($authorized) {
                    $menuString .= sprintf($templates['menu_row'], $class, $link . $submenu);
                }
            }

            return [
                $menuString,
                $hasActive
            ];
        };

        list($menu, $hasActive) = $traverse($menus);
        return sprintf($templates['menu'], $menu);
    }
759042
def getCountLT(self, item):
        """"""
        index = bisect.bisect_left(self._list, item)
        return index
851770
function () {
        var self = this, settings = self.settings, menu, parent = self.parent();

        parent.items().each(function (ctrl) {
          if (ctrl !== self) {
            ctrl.hideMenu();
          }
        });

        if (settings.menu) {
          menu = self.menu;

          if (!menu) {
            menu = settings.menu;

            // Is menu array then auto constuct menu control
            if (menu.length) {
              menu = {
                type: 'menu',
                items: menu
              };
            } else {
              menu.type = menu.type || 'menu';
            }

            if (parent.settings.itemDefaults) {
              menu.itemDefaults = parent.settings.itemDefaults;
            }

            menu = self.menu = Factory.create(menu).parent(self).renderTo();
            menu.reflow();
            menu.on('cancel', function (e) {
              e.stopPropagation();
              self.focus();
              menu.hide();
            });
            menu.on('show hide', function (e) {
              if (e.control.items) {
                e.control.items().each(function (ctrl) {
                  ctrl.active(ctrl.settings.selected);
                });
              }
            }).fire('show');

            menu.on('hide', function (e) {
              if (e.control === menu) {
                self.classes.remove('selected');
              }
            });

            menu.submenu = true;
          } else {
            menu.show();
          }

          menu._parentMenu = parent;

          menu.classes.add('menu-sub');

          var rel = menu.testMoveRel(
            self.getEl(),
            self.isRtl() ? ['tl-tr', 'bl-br', 'tr-tl', 'br-bl'] : ['tr-tl', 'br-bl', 'tl-tr', 'bl-br']
          );

          menu.moveRel(self.getEl(), rel);
          menu.rel = rel;

          rel = 'menu-sub-' + rel;
          menu.classes.remove(menu._lastRel).add(rel);
          menu._lastRel = rel;

          self.classes.add('selected');
          self.aria('expanded', true);
        }
      }
1342961
def _count_values(self):
        """"""
        indices = {yi: [i] for i, yi in enumerate(self.y) if self.status[i]}

        return indices
150125
private void syncMenu() {
        if (bugInstance != null) {
            BugProperty severityProperty = bugInstance.lookupProperty(BugProperty.SEVERITY);
            if (severityProperty != null) {
                try {
                    int severity = severityProperty.getValueAsInt();
                    if (severity > 0 && severity <= severityItemList.length) {
                        selectSeverity(severity);
                        return;
                    }
                } catch (NumberFormatException e) {
                    // Ignore: we'll allow the user to select a valid severity
                }
            }

            // We didn't get a valid severity from the BugInstance.
            // So, leave the menu items enabled but cleared, so
            // the user can select a severity.
            resetMenuItems(true);
        } else {
            // No BugInstance - disable all menu items.
            resetMenuItems(false);
        }
    }
353196
def show_limit(entries, **kwargs):
    """"""
    limit = kwargs.pop('limit', 5)
    if limit <= 0:
        return show_menu(entries, **kwargs)
    istart = 0 # Index of group start.
    iend = limit # Index of group end.
    dft = kwargs.pop('dft', None)
    if type(dft) == int:
        dft = str(dft)
    while True:
        if iend > len(entries):
            iend = len(entries)
            istart = iend - limit
        if istart < 0:
            istart = 0
            iend = limit
        unext = len(entries) - iend # Number of next entries.
        uprev = istart # Number of previous entries.
        nnext = "" # Name of 'next' menu entry.
        nprev = "" # Name of 'prev' menu entry.
        dnext = "" # Description of 'next' menu entry.
        dprev = "" # Description of 'prev' menu entry.
        group = copy.deepcopy(entries[istart:iend])
        names = [i.name for i in group]
        if unext > 0:
            for i in ["n", "N", "next", "NEXT", "->", ">>", ">>>"]:
                if i not in names:
                    nnext = i
                    dnext = "Next %u of %u entries" % (unext, len(entries))
                    group.append(MenuEntry(nnext, dnext, None, None, None))
                    names.append("n")
                    break
        if uprev > 0:
            for i in ["p", "P", "prev", "PREV", "<-", "<<", "<<<"]:
                if i not in names:
                    nprev = i
                    dprev = "Previous %u of %u entries" % (uprev, len(entries))
                    group.append(MenuEntry(nprev, dprev, None, None, None))
                    names.append("p")
                    break
        tmpdft = None
        if dft != None:
            if dft not in names:
                if "n" in names:
                    tmpdft = "n"
            else:
                tmpdft = dft
        result = show_menu(group, dft=tmpdft, **kwargs)
        if result == nnext or result == dnext:
            istart += limit
            iend += limit
        elif result == nprev or result == dprev:
            istart -= limit
            iend -= limit
        else:
            return result