Remove obsolete remotes with review prefix.
2560
def clean_remotes
      protected_remotes = remotes_for_branches
      remotes.each do |remote|
        # Only remove review remotes that aren't referenced by current branches.
        if remote.index('review_') == 0 && !protected_remotes.include?(remote)
          git_call "remote remove #{remote}"
        end
      end
    end
59658
def detach_remote(self, id, name):
        

        if name in self.widgets:
            if id in self.widgets[name]:
                del self.widgets[name]
497770
def _prune_components(self):
        
        seen_components = set(map(lambda x: x.component, self._remote_candidates))
        missing_components = self._components - seen_components
        if missing_components:
            self.__log_info('Components %s have no candidate pairs' % missing_components)
            self._components = seen_components
573675
def cleanup_candidates(self, node_ip):
        
        if node_ip in self.factory.candidates:
            old_candidates = []
            for candidate in self.factory.candidates[node_ip]:
                elapsed = int(time.time() - candidate["time"])
                if elapsed > self.challege_timeout:
                    old_candidates.append(candidate)

            for candidate in old_candidates:
                self.factory.candidates[node_ip].remove(candidate)
885344
def remove_by(keys, original):
    """"""
    for i in [
            original[index]
            for index, needed in enumerate(keys) if not needed
    ]:
        original.remove(i)
1238407
def delete_prefix(self, key_prefix):
        """"""
        return self.delete(
            key_prefix, range_end=_encode(_increment_last_byte(key_prefix)))
955729
def teardown(self):
        ''''''

        self.ensure_all_devices_in_sync()
        for device in self.devices:
            self._delete_device_from_device_group(device)
            self._sync_to_group(device)
            pollster(self._ensure_device_active)(device)
            self.ensure_all_devices_in_sync()
        dg = pollster(self._get_device_group)(self.devices[0])
        dg.delete()
        pollster(self._check_devices_active_licensed)()
        pollster(self._check_all_devices_in_sync)()
22625
def cleanupversion(ver):
    """"""
    lst = ver.split(".")
    if len(lst) == 1:
        lst.extend(['0', '0'])
    elif len(lst) == 2:
        lst.extend(['0'])
    elif len(lst) > 2:
        lst = lst[:3]
    lst[2] = '0' # ensure the 3rd number is 0    
    cleanver = '.'.join(lst)
    return cleanver
162788
def clean_stale_refs(self):
        '''
        
        '''
        cleaned = []
        cmd_str = 'git remote prune origin'

        # Attempt to force all output to plain ascii english, which is what some parsing code
        # may expect.
        # According to stackoverflow (http://goo.gl/l74GC8), we are setting LANGUAGE as well
        # just to be sure.
        env = os.environ.copy()
        env[b"LANGUAGE"] = b"C"
        env[b"LC_ALL"] = b"C"

        cmd = subprocess.Popen(
            shlex.split(cmd_str),
            close_fds=not salt.utils.platform.is_windows(),
            cwd=os.path.dirname(self.gitdir),
            env=env,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT)
        output = cmd.communicate()[0]
        if six.PY3:
            output = output.decode(__salt_system_encoding__)
        if cmd.returncode != 0:
            log.warning(
                'Failed to prune stale branches for %s remote \'%s\'. '
                'Output from \'%s\' follows:\n%s',
                self.role, self.id, cmd_str, output
            )
        else:
            marker = ' * [pruned] '
            for line in salt.utils.itertools.split(output, '\n'):
                if line.startswith(marker):
                    cleaned.append(line[len(marker):].strip())
            if cleaned:
                log.debug(
                    '%s pruned the following stale refs: %s',
                    self.role, ', '.join(cleaned)
                )
        return cleaned
753526
def cleanup(self):
        '''
        
        '''
        log.debug('ConCache cleaning up')
        if os.path.exists(self.cache_sock):
            os.remove(self.cache_sock)
        if os.path.exists(self.update_sock):
            os.remove(self.update_sock)
        if os.path.exists(self.upd_t_sock):
            os.remove(self.upd_t_sock)
593582
def delete(self):
        
        key = 'https://plex.tv/devices/%s.xml' % self.id
        self._server.query(key, self._server._session.delete)
510252
def prune_old_authorization_codes():
    

    from .compat import now
    from .models import AuthorizationCode
    
    AuthorizationCode.objects.with_expiration_before(now()).delete()
263342
def remove_alias(agent, prefix, alias):
    """"""
    return _broadcast(agent, RemoveMappingManager, RecordType.record_CNAME,
                      prefix, alias)
869009
private void cleanupLists(PrefixKey key) {
    // Remove expired list entries. Keep track of the last list removed.
    NavigableMap<PrefixKey, CacheValue<Object>> head = prefixMap.headMap(key, true).descendingMap();
    Iterator<Entry<PrefixKey, CacheValue<Object>>> headItr = head.entrySet().iterator();
    Entry<PrefixKey, CacheValue<Object>> last = null;

    while (headItr.hasNext()) {
      Entry<PrefixKey, CacheValue<Object>> entry = headItr.next();
      if (isExpired(entry.getValue()) && key.isParent(entry.getKey())) {
        last = entry;
        headItr.remove();
      }
    }

    // If a list was removed, check its contained items for expiration.
    if (last != null) {
      SortedMap<PrefixKey, CacheValue<GoogleCloudStorageItemInfo>> prefix =
          getPrefixSubMap(itemMap, last.getKey());
      prefix.entrySet().removeIf(entry -> isExpired(entry.getValue()));
    }
  }
374334
def outdated
      outdateds = []

      latest_specs.each do |local|
        dependency = Gem::Dependency.new local.name, ">= #{local.version}"

        begin
          fetcher = Gem::SpecFetcher.fetcher
          remotes = fetcher.find_matching dependency
          remotes = remotes.map { |(name, version,_),_| version }
        rescue Gem::RemoteFetcher::FetchError => e
          raise unless fetcher.warn_legacy e do
            require 'rubygems/source_info_cache'

            specs = Gem::SourceInfoCache.search_with_source dependency, true

            remotes = specs.map { |spec,| spec.version }
          end
        end

        latest = remotes.sort.last

        outdateds << local.name if latest and local.version < latest
      end

      outdateds
    end
910152
def _cleanupConnections(senderkey, signal):
    """"""
    try:
        receivers = connections[senderkey][signal]
    except:
        pass
    else:
        if not receivers:
            # No more connected receivers. Therefore, remove the signal.
            try:
                signals = connections[senderkey]
            except KeyError:
                pass
            else:
                del signals[signal]
                if not signals:
                    # No more signal connections. Therefore, remove the sender.
                    _removeSender(senderkey)
1148492
def _removeBackrefs( senderkey):
    """"""
    try:
        signals = connections[senderkey]
    except KeyError:
        signals = None
    else:
        items = signals.items()
        def allReceivers( ):
            for signal,set in items:
                for item in set:
                    yield item
        for receiver in allReceivers():
            _killBackref( receiver, senderkey )