remove explicit hydrogen if possible

        :return: number of removed hydrogens
549483
def implicify_hydrogens(self):
        
        explicit = defaultdict(list)
        c = 0
        for n, atom in self.atoms():
            if atom.element == 'H':
                for m in self.neighbors(n):
                    if self._node[m].element != 'H':
                        explicit[m].append(n)

        for n, h in explicit.items():
            atom = self._node[n]
            len_h = len(h)
            for i in range(len_h, 0, -1):
                hi = h[:i]
                if atom.get_implicit_h([y.order for x, y in self._adj[n].items() if x not in hi]) == i:
                    for x in hi:
                        self.remove_node(x)
                        c += 1
                    break

        self.flush_cache()
        return c
1281057
def clean_descriptor(self, number):
        """"""
        self.descriptors[number]['stdout'].close()
        self.descriptors[number]['stderr'].close()

        if os.path.exists(self.descriptors[number]['stdout_path']):
            os.remove(self.descriptors[number]['stdout_path'])

        if os.path.exists(self.descriptors[number]['stderr_path']):
            os.remove(self.descriptors[number]['stderr_path'])
242723
private IRingSet removeExtraRings(IAtomContainer m) {

        try {
            IRingSet rs = Cycles.sssr(m).toRingSet();

            //remove rings which dont have all aromatic atoms (according to hybridization set by lower case symbols in smiles):

            //logger.debug("numrings="+rs.size());

            iloop: for (int i = 0; i <= rs.getAtomContainerCount() - 1; i++) {

                IRing r = (IRing) rs.getAtomContainer(i);

                if (r.getAtomCount() > 7 || r.getAtomCount() < 5) {
                    rs.removeAtomContainer(i);
                    i--; // go back to first one
                    continue iloop;
                }

                //int NonSP2Count = 0;

                for (int j = 0; j <= r.getAtomCount() - 1; j++) {

                    //logger.debug(j+"\t"+r.getAtomAt(j).getSymbol()+"\t"+r.getAtomAt(j).getHybridization());

                    if (r.getAtom(j).getHybridization() == CDKConstants.UNSET
                            || !(r.getAtom(j).getHybridization() == Hybridization.SP2 || r.getAtom(j)
                                    .getHybridization() == Hybridization.PLANAR3)) {
                        rs.removeAtomContainer(i);
                        i--; // go back
                        continue iloop;
                        //                        NonSP2Count++;
                        //                        if (r.getAtom(j).getSymbol().equals("C")) {
                        //                            rs.removeAtomContainer(i);
                        //                            i--; // go back
                        //                            continue iloop;
                        //                        }
                    }
                }

                //                if (NonSP2Count > 1) {
                //                    rs.removeAtomContainer(i);
                //                    i--; // go back
                //                    continue iloop;
                //                }

            }
            return rs;

        } catch (Exception e) {
            return m.getBuilder().newInstance(IRingSet.class);
        }
    }
1162781
def elem_remove(self, idx=None):
        
        if idx is not None:
            if idx in self.uid:
                key = idx
                item = self.uid[idx]
            else:
                self.log('The item <{:s}> does not exist.'.format(idx), ERROR)
                return None
        else:
            return None

        convert = False
        if isinstance(self.__dict__[self._params[0]], matrix):
            self._param_to_list()
            convert = True

        # self.n -= 1
        self.uid.pop(key, '')
        self.idx.pop(item)
        self.mdl_from.pop(item)
        self.mdl_to.pop(item)

        for x, y in self.uid.items():
            if y > item:
                self.uid[x] = y - 1

        for param in self._data:
            self.__dict__[param].pop(item)

        for param in self._service:
            if len(self.__dict__[param]) == (self.n + 1):
                if isinstance(self.__dict__[param], list):
                    self.__dict__[param].pop(item)
                elif isinstance(self.__dict__[param], matrix):
                    service = list(self.__dict__[param])
                    service.pop(item)
                    self.__dict__[param] = matrix(service)

        for x in self._states:
            if len(self.__dict__[x]):
                self.__dict__[x].pop(item)

        for y in self._algebs:
            if self.__dict__[y]:
                self.__dict__[y].pop(item)

        for key, param in self._ac.items():
            if isinstance(param, list):
                for subparam in param:
                    if len(self.__dict__[subparam]):
                        self.__dict__[subparam].pop(item)
            else:
                self.__dict__[param].pop(item)

        for key, param in self._dc.items():
            self.__dict__[param].pop(item)

        self.name.pop(item)
        if convert and self.n:
            self._param_to_matrix()
328673
def cleanupContainers(self):
        
        for i in range(self.count() - 1, self.currentIndex(), -1):
            widget = self.widget(i)
            widget.close()
            widget.setParent(None)
            widget.deleteLater()
566022
private int pollRemovedCountHolders(AtomicReferenceArray<Queue<Integer>> removedCountHolders) {
        int count = 0;
        for (int i = 0; i < partitionCount; i++) {
            Queue<Integer> removalCounts = removedCountHolders.get(i);
            count += removalCounts.poll();
        }
        return count;
    }
341476
def remove(self):
        '''
        
        '''
        print 'remove'
        if self.exists():
            print 'cleaning', self.venv
            run('rm -rf {}'.format(self.venv))
1299653
def deleted_count(self):
        """"""
        if isinstance(self.raw_result, list):
            return len(self.raw_result)
        else:
            return self.raw_result
507229
def add_hydrogen(self, num):
        
        self.H_count = num
        if num > 0 and self.symbol in ("N", "O"):
            self.H_donor = 1
        else:
            self.H_donor = 0
573931
private int getHalogenCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int acounter = 0;
        for (IAtom neighbour : neighbours) {
            if (neighbour.getSymbol().equals("F") || neighbour.getSymbol().equals("I")
                    || neighbour.getSymbol().equals("Cl") || neighbour.getSymbol().equals("Br")) {
                acounter += 1;
            }
        }
        return acounter;
    }
852019
def runInactiveDeviceCleanup(self):
        

        yield self.deleteInactiveDevicesByQuota(
            self.__inactive_per_jid_max,
            self.__inactive_global_max
        )

        yield self.deleteInactiveDevicesByAge(self.__inactive_max_age)
1355412
def _cleanup(self, ref):
        ''
        self.transitor_states[self._weakref_holder[ref]] -= 1
        del self._weakref_holder[ref]
171346
public function cleanAll(): int
    {
        $cpt = 0;
        $keys = $this->getRedis()->keys($this->namespace . ':*');
        if ($keys) {
            foreach ($keys as $key) {
                $this->getRedis()->del($key);
                $cpt++;
            }
        }
        return $cpt;
    }
868535
public void cleanup() {
    keys.cleanup();
    counts.cleanup();
    dictionary.cleanup();
    // Decrement the dictionary memory by the total size of all the elements
    memoryEstimate.decrementDictionaryMemory(SizeOf.SIZE_OF_LONG * numElements);
  }
594520
def _removecleaner(self, cleaner):
        
        oldlen = len(self._old_cleaners)
        self._old_cleaners = [
            oldc for oldc in self._old_cleaners
            if not oldc.issame(cleaner)
        ]
        return len(self._old_cleaners) != oldlen
685450
def remove_non_ground_states(self):
        
        group_func = lambda e: e.composition.reduced_formula
        entries = sorted(self.entries, key=group_func)
        ground_states = set()
        for _, g in itertools.groupby(entries, key=group_func):
            ground_states.add(min(g, key=lambda e: e.energy_per_atom))
        self.entries = ground_states
393680
def remove(self, idx):
        
        data = {}
        for k in self.data:
            data[k] = np.delete(self.data[k], idx)
        return self._return(data=data)