Parse the RGFile. Uses of {@link org.openscience.cdk.io.MDLV2000Reader}
to parse individual $CTAB blocks.

@param rGroupQuery empty
@return populated query
@throws CDKException
553108
private RGroupQuery parseRGFile(RGroupQuery rGroupQuery) throws CDKException {
        IChemObjectBuilder defaultChemObjectBuilder = rGroupQuery.getBuilder();
        String line = "";
        int lineCount = 0;
        String eol = "\n";
        StringTokenizer strTk = null;
        /* Variable to capture the LOG line(s) */
        Map<Integer, RGroupLogic> logicDefinitions = new HashMap<Integer, RGroupLogic>();

        /*
         * Variable to captures attachment order for Rgroups. Contains: - pseudo
         * atom (Rgroup) - map with (integer,bond) meaning "bond" has attachment
         * order "integer" (1,2,3) for the Rgroup The order is based on the atom
         * block, unless there is an AAL line for the pseudo atom.
         */
        Map<IAtom, Map<Integer, IBond>> attachmentPoints = new HashMap<IAtom, Map<Integer, IBond>>();

        try {
            // Process the Header block_________________________________________
            //__________________________________________________________________
            logger.info("Process the Header block");
            checkLineBeginsWith(input.readLine(), "$MDL", ++lineCount);
            checkLineBeginsWith(input.readLine(), "$MOL", ++lineCount);
            checkLineBeginsWith(input.readLine(), "$HDR", ++lineCount);

            for (int i = 1; i <= 3; i++) {
                lineCount++;
                if (input.readLine() == null) {
                    throw new CDKException("RGFile invalid, empty/null header line at #" + lineCount);
                }
                //optional: parse header info here (not implemented)
            }
            checkLineBeginsWith(input.readLine(), "$END HDR", ++lineCount);

            //Process the root structure (scaffold)_____________________________
            //__________________________________________________________________
            logger.info("Process the root structure (scaffold)");
            checkLineBeginsWith(input.readLine(), "$CTAB", ++lineCount);
            //Force header
            StringBuilder sb = new StringBuilder(RGroup.ROOT_LABEL + "\n\n\n");
            line = input.readLine();
            ++lineCount;
            while (line != null && !line.equals("$END CTAB")) {
                sb.append(line + eol);

                //LOG lines: Logic, Unsatisfied Sites, Range of Occurrence.
                if (line.startsWith("M  LOG")) {
                    strTk = new StringTokenizer(line);
                    strTk.nextToken();
                    strTk.nextToken();
                    strTk.nextToken();
                    RGroupLogic log = null;

                    log = new RGroupLogic();
                    int rgroupNumber = Integer.valueOf(strTk.nextToken());
                    String tok = strTk.nextToken();
                    log.rgoupNumberRequired = tok.equals("0") ? 0 : Integer.valueOf(tok);
                    log.restH = strTk.nextToken().equals("1") ? true : false;
                    tok = "";
                    while (strTk.hasMoreTokens()) {
                        tok += strTk.nextToken();
                    }
                    log.occurence = tok;
                    logicDefinitions.put(rgroupNumber, log);
                }

                line = input.readLine();
                ++lineCount;
            }
            String rootStr = sb.toString();

            //Let MDL reader process $CTAB block of the root structure.
            MDLV2000Reader reader = new MDLV2000Reader(new StringReader(rootStr), ISimpleChemObjectReader.Mode.STRICT);
            IAtomContainer root = reader.read(defaultChemObjectBuilder.newInstance(IAtomContainer.class));
            rGroupQuery.setRootStructure(root);

            //Atom attachment order: parse AAL lines first
            strTk = new StringTokenizer(rootStr, eol);
            while (strTk.hasMoreTokens()) {
                line = strTk.nextToken();
                if (line.startsWith("M  AAL")) {
                    StringTokenizer stAAL = new StringTokenizer(line);
                    stAAL.nextToken();
                    stAAL.nextToken();
                    int pos = Integer.valueOf(stAAL.nextToken());
                    IAtom rGroup = root.getAtom(pos - 1);
                    stAAL.nextToken();
                    Map<Integer, IBond> bondMap = new HashMap<Integer, IBond>();
                    while (stAAL.hasMoreTokens()) {
                        pos = Integer.valueOf(stAAL.nextToken());
                        IAtom partner = root.getAtom(pos - 1);
                        IBond bond = root.getBond(rGroup, partner);
                        int order = Integer.valueOf(stAAL.nextToken());
                        bondMap.put(order, bond);
                        logger.info("AAL " + order + " " + ((IPseudoAtom) rGroup).getLabel() + "-"
                                + partner.getSymbol());
                    }
                    if (bondMap.size() != 0) {
                        attachmentPoints.put(rGroup, bondMap);
                    }

                }
            }
            //Deal with remaining attachment points (non AAL)
            for (IAtom atom : root.atoms()) {
                if (atom instanceof IPseudoAtom) {
                    IPseudoAtom rGroup = (IPseudoAtom) atom;
                    if (rGroup.getLabel().startsWith("R") && !rGroup.getLabel().equals("R") && // only numbered ones
                            !attachmentPoints.containsKey(rGroup)) {
                        //Order reflects the order of atoms in the Atom Block
                        int order = 0;
                        Map<Integer, IBond> bondMap = new HashMap<Integer, IBond>();
                        for (IAtom atom2 : root.atoms()) {
                            if (!atom.equals(atom2)) {
                                for (IBond bond : root.bonds()) {
                                    if (bond.contains(atom) && bond.contains(atom2)) {
                                        bondMap.put(++order, bond);
                                        logger.info("Def " + order + " " + rGroup.getLabel() + "-" + atom2.getSymbol());
                                        break;
                                    }
                                }
                            }
                        }
                        if (bondMap.size() != 0) {
                            attachmentPoints.put(rGroup, bondMap);
                        }
                    }
                }
            }
            //Done with attachment points
            rGroupQuery.setRootAttachmentPoints(attachmentPoints);
            logger.info("Attachm.points defined for " + attachmentPoints.size() + " R# atoms");

            //Process each Rgroup's $CTAB block(s)_____________________________
            //__________________________________________________________________

            //Set up the RgroupLists, one for each unique R# (# = 1..32 max)
            Map<Integer, RGroupList> rGroupDefinitions = new HashMap<Integer, RGroupList>();

            for (IAtom atom : root.atoms()) {
                if (atom instanceof IPseudoAtom) {
                    IPseudoAtom rGroup = (IPseudoAtom) atom;
                    if (RGroupQuery.isValidRgroupQueryLabel(rGroup.getLabel())) {
                        int rgroupNum = Integer.valueOf(rGroup.getLabel().substring(1));
                        RGroupList rgroupList = new RGroupList(rgroupNum);
                        if (!rGroupDefinitions.containsKey(rgroupNum)) {
                            logger.info("Define Rgroup R" + rgroupNum);
                            RGroupLogic logic = logicDefinitions.get(rgroupNum);
                            if (logic != null) {
                                rgroupList.setRestH(logic.restH);
                                rgroupList.setOccurrence(logic.occurence);
                                rgroupList.setRequiredRGroupNumber(logic.rgoupNumberRequired);
                            } else {
                                rgroupList.setRestH(false);
                                rgroupList.setOccurrence(">0");
                                rgroupList.setRequiredRGroupNumber(0);
                            }
                            rgroupList.setRGroups(new ArrayList<RGroup>());
                            rGroupDefinitions.put(rgroupNum, rgroupList);
                        }
                    }
                }
            }

            //Parse all $CTAB blocks per Rgroup (there can be more than one)
            line = input.readLine();
            ++lineCount;
            boolean hasMoreRGP = true;
            while (hasMoreRGP) {

                checkLineBeginsWith(line, "$RGP", lineCount);
                line = input.readLine();
                ++lineCount;
                logger.info("line for num is " + line);
                int rgroupNum = Integer.valueOf(line.trim());
                line = input.readLine();
                ++lineCount;

                boolean hasMoreCTAB = true;
                while (hasMoreCTAB) {

                    checkLineBeginsWith(line, "$CTAB", lineCount);
                    sb = new StringBuilder(RGroup.makeLabel(rgroupNum) + "\n\n\n");
                    line = input.readLine();
                    while (line != null && !line.startsWith("$END CTAB")) {
                        sb.append(line + eol);
                        line = input.readLine();
                        ++lineCount;
                    }
                    String groupStr = sb.toString();
                    reader = new MDLV2000Reader(new StringReader(groupStr), ISimpleChemObjectReader.Mode.STRICT);
                    IAtomContainer group = reader.read(defaultChemObjectBuilder.newInstance(IAtomContainer.class));
                    RGroup rGroup = new RGroup();
                    rGroup.setGroup(group);

                    //Parse the Rgroup's attachment points (APO)
                    strTk = new StringTokenizer(groupStr, eol);
                    while (strTk.hasMoreTokens()) {
                        line = strTk.nextToken();
                        if (line.startsWith("M  APO")) {
                            StringTokenizer stAPO = new StringTokenizer(line);
                            stAPO.nextToken();
                            stAPO.nextToken();
                            stAPO.nextToken();
                            while (stAPO.hasMoreTokens()) {
                                int pos = Integer.valueOf(stAPO.nextToken());
                                int apo = Integer.valueOf(stAPO.nextToken());
                                IAtom at = group.getAtom(pos - 1);
                                switch (apo) {
                                    case 1:
                                        rGroup.setFirstAttachmentPoint(at);
                                        break;
                                    case 2:
                                        rGroup.setSecondAttachmentPoint(at);
                                        break;
                                    case 3: {
                                        rGroup.setFirstAttachmentPoint(at);
                                        rGroup.setSecondAttachmentPoint(at);
                                    }
                                        break;
                                }
                            }
                        }
                    }
                    RGroupList rList = rGroupDefinitions.get(rgroupNum);
                    if (rList == null) {
                        throw new CDKException("R" + rgroupNum + " not defined but referenced in $RGP.");
                    } else {
                        rList.getRGroups().add(rGroup);
                    }
                    line = input.readLine();
                    ++lineCount;
                    if (line.startsWith("$END RGP")) {
                        logger.info("end of RGP block");
                        hasMoreCTAB = false;
                    }
                }

                line = input.readLine();
                ++lineCount;
                if (line.startsWith("$END MOL")) {
                    hasMoreRGP = false;
                }
            }

            rGroupQuery.setRGroupDefinitions(rGroupDefinitions);
            logger.info("Number of lines was " + lineCount);
            return rGroupQuery;

        } catch (CDKException exception) {
            String error = "CDK Error while parsing line " + lineCount + ": " + line + " -> " + exception.getMessage();
            logger.error(error);
            logger.debug(exception);
            throw exception;
        } catch (IOException | IllegalArgumentException exception) {
            exception.printStackTrace();
            String error = exception.getClass() + "Error while parsing line " + lineCount + ": " + line + " -> "
                    + exception.getMessage();
            logger.error(error);
            logger.debug(exception);
            throw new CDKException(error, exception);
        }
    }
393560
@Override
    public <T extends IChemObject> T read(T object) throws CDKException {
        if (object instanceof IChemFile) {
            IChemFile cf = (IChemFile) object;
            try {
                cf = readChemFile(cf);
            } catch (IOException e) {
                logger.error("Input/Output error while reading from input.");
            }
            return (T) cf;
        } else {
            throw new CDKException("Only supported is reading of ChemFile.");
        }
    }
1214521
private IChemFile readChemFile(IChemFile file) throws CDKException {
        logger.debug("Started parsing from input...");
        try {
            parser.setFeature("http://xml.org/sax/features/validation", false);
            logger.info("Deactivated validation");
        } catch (SAXException e) {
            logger.warn("Cannot deactivate validation.");
            return null;
        }
        CMLHandler handler = new CMLHandler(file);
        // copy the manually added conventions
        for (String conv : userConventions.keySet()) {
            handler.registerConvention(conv, userConventions.get(conv));
        }
        parser.setContentHandler(handler);
        parser.setEntityResolver(new CMLResolver());
        parser.setErrorHandler(new CMLErrorHandler());
        try {
            if (input == null) {
                logger.debug("Parsing from URL: ", url);
                parser.parse(url);
            } else {
                logger.debug("Parsing from Reader");
                parser.parse(new InputSource(input));
            }
        } catch (IOException e) {
            String error = "Error while reading file: " + e.getMessage();
            logger.error(error);
            logger.debug(e);
            throw new CDKException(error, e);
        } catch (SAXParseException saxe) {
            SAXParseException spe = (SAXParseException) saxe;
            String error = "Found well-formedness error in line " + spe.getLineNumber();
            logger.error(error);
            logger.debug(saxe);
            throw new CDKException(error, saxe);
        } catch (SAXException saxe) {
            String error = "Error while parsing XML: " + saxe.getMessage();
            logger.error(error);
            logger.debug(saxe);
            throw new CDKException(error, saxe);
        }
        return file;
    }
653758
def parse_cgroups(filehandle):
    
    for line in filehandle:
        parts = line.strip().split(":")
        if len(parts) != 3:
            continue
        cgroup_path = parts[2]

        # Depending on the filesystem driver used for cgroup
        # management, the paths in /proc/pid/cgroup will have
        # one of the following formats in a Docker container:
        #
        #   systemd: /system.slice/docker-<container-ID>.scope
        #   cgroupfs: /docker/<container-ID>
        #
        # In a Kubernetes pod, the cgroup path will look like:
        #
        #   systemd:
        #      /kubepods.slice/kubepods-<QoS-class>.slice/kubepods-<QoS-class>-pod<pod-UID>.slice/<container-iD>.scope
        #   cgroupfs:
        #      /kubepods/<QoS-class>/pod<pod-UID>/<container-iD>

        directory, container_id = os.path.split(cgroup_path)
        if container_id.endswith(SYSTEMD_SCOPE_SUFFIX):
            container_id = container_id[: -len(SYSTEMD_SCOPE_SUFFIX)]
            if "-" in container_id:
                container_id = container_id.split("-", 1)[1]
        kubepods_match = kubepods_regexp.match(directory)
        if kubepods_match:
            pod_id = kubepods_match.group(1)
            if not pod_id:
                pod_id = kubepods_match.group(2)
            return {"container": {"id": container_id}, "kubernetes": {"pod": {"uid": pod_id}}}
        elif container_id_regexp.match(container_id):
            return {"container": {"id": container_id}}
641387
public Detail read (String category, String discid)
        throws IOException, CDDBException
    {
        // sanity check
        if (_sock == null) {
            throw new CDDBException(500, "Not connected");
        }

        // construct the query
        StringBuilder req = new StringBuilder("cddb read ");
        req.append(category).append(" ");
        req.append(discid);

        // make the request
        Response rsp = request(req.toString());
        // anything other than an OK response earns an exception
        if (rsp.code != 210 /* OK, entry follows */) {
            throw new CDDBException(rsp.code, rsp.message);
        }

        Detail detail = new Detail();

        // parse the category and discid from the response string
        int sidx = rsp.message.indexOf(" ");
        if (sidx == -1) {
            throw new CDDBException(500, "Malformed read response: " +
                                    rsp.message);
        }
        detail.category = rsp.message.substring(0, sidx);
        detail.discid = rsp.message.substring(sidx+1);

        ArrayList<String> tnames = new ArrayList<String>();
        ArrayList<String> texts = new ArrayList<String>();

        // now parse the contents
        String input = _in.readLine();
        for (int lno = 0; !input.equals(CDDBProtocol.TERMINATOR); lno++) {
            if (input.startsWith("#")) {
                // skip comments

            } else if (input.startsWith("DTITLE")) {
                if (detail.title == null) {
                    detail.title = contents(input, lno);
                } else {
                    detail.title += contents(input, lno);
                }

            } else if (input.startsWith("DYEAR")) {
                String yearStr = contents(input, lno);
                try {
                    detail.year = Integer.parseInt(yearStr);
                } catch (NumberFormatException nfEx) {
                    detail.year = -1;
                }

            } else if (input.startsWith("DGENRE")) {
                if (detail.genre == null) {
                    detail.genre = contents(input, lno);
                } else {
                    detail.genre += contents(input, lno);
                }

            } else if (input.startsWith("EXTD")) {
                if (detail.extendedData == null) {
                    detail.extendedData = contents(input, lno);
                } else {
                    detail.extendedData += contents(input, lno);
                }

            } else if (input.startsWith("TTITLE")) {
                append(tnames, index(input, "TTITLE", lno), contents(input, lno));

            } else if (input.startsWith("EXTT")) {
                append(texts, index(input, "EXTT", lno), contents(input, lno));
            }

            // read in the next line of input
            input = _in.readLine();
        }

        // convert the lists into arrays
        detail.trackNames = new String[tnames.size()];
        tnames.toArray(detail.trackNames);
        detail.extendedTrackData = new String[texts.size()];
        texts.toArray(detail.extendedTrackData);

        return detail;
    }
730794
private BitSet parseQuery(FilterQuery filterQuery, DataSchema schema) {
        BitSet queryBitSet = new BitSet();
        if(filterQuery instanceof MatchAllQuery || filterQuery.getFilterQueries().size() < 1) return queryBitSet;

        //facet drill down happens here
        for (String filterField : filterQuery.getFilterQueries().keySet()) {

            final int columnIndex = schema.getColumnIndex(filterField);
            final Map<String, BitSet> map = fieldInvertedIndex.get(columnIndex);

            final FilterQuery.FilterQueryElement filterQueryElement = filterQuery.getFilterQueries().get(filterField);
            DataType type = schema.getType(columnIndex);
            switch (type) {
                case CoordinateLat:
                case CoordinateLon:
                case String:
                case Boolean:
                case Integer:
                    // if range query
                    if (filterQueryElement instanceof FilterQuery.FilterFieldRange) {
                        queryBitSet = processRangeQueryIntegerTypes(queryBitSet, map, filterQueryElement, type);
                    } else if (filterQueryElement instanceof FilterQuery.FilterFieldGreaterThanInteger) {
                        queryBitSet = processIntegerGreaterThanDefaultTypes(queryBitSet, map, filterQueryElement, type);
                    } else {
                        // does most of the commons multi value types
                        queryBitSet = processMultiValueQueryDefaultTypes(queryBitSet, map, filterQueryElement, type);
                    }
                    break;
                case Date:

                    if (filterQueryElement instanceof FilterQuery.FilterFieldRangeDate) {
                        queryBitSet = processRangeQueryISODateTypes(queryBitSet, map, filterQueryElement, type);
                    } else {
                        queryBitSet = processRangeQueryMultiValueQueryDateYear(queryBitSet, map, filterQueryElement, type);
                    }

                    break;
                case DateYear:
                    // if range query
                    if (filterQueryElement instanceof FilterQuery.FilterFieldRange) {
                        queryBitSet = processRangeQueryDateYearType(queryBitSet, map, filterQueryElement, type);
                    } else {
                        queryBitSet = processRangeQueryMultiValueQueryDateYear(queryBitSet, map, filterQueryElement, type);
                    }
                    break;
            }

        }
        return queryBitSet;
    }
659559
private void _serializeQuery(PageContext pc, Set test, Query query, StringBuilder sb, boolean serializeQueryByColumns, Set<Object> done) throws ConverterException {

	ApplicationContextSupport acs = (ApplicationContextSupport) pc.getApplicationContext();
	boolean preserveCase = acs.getSerializationSettings().getPreserveCaseForQueryColumn(); // UPPERCASE column keys by default for Query

	Collection.Key[] _keys = CollectionUtil.keys(query);
	sb.append(goIn());
	sb.append("{");

	/*
	 * 
	 * {"DATA":[["a","b"],["c","d"]]} {"DATA":{"aaa":["a","c"],"bbb":["b","d"]}}
	 */
	// Rowcount
	if (serializeQueryByColumns) {
	    sb.append("\"ROWCOUNT\":");
	    sb.append(Caster.toString(query.getRecordcount()));
	    sb.append(',');
	}

	// Columns
	sb.append("\"COLUMNS\":[");
	String[] cols = query.getColumns();
	for (int i = 0; i < cols.length; i++) {
	    if (i > 0) sb.append(",");
	    sb.append(StringUtil.escapeJS(preserveCase ? cols[i] : cols[i].toUpperCase(), '"', charsetEncoder));
	}
	sb.append("],");

	// Data
	sb.append("\"DATA\":");
	if (serializeQueryByColumns) {
	    sb.append('{');
	    boolean oDoIt = false;
	    int len = query.getRecordcount();
	    pc = ThreadLocalPageContext.get(pc);
	    boolean upperCase = false;
	    if (pc != null) upperCase = pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && ((ConfigWebImpl) pc.getConfig()).getDotNotationUpperCase();

	    for (int i = 0; i < _keys.length; i++) {
		if (oDoIt) sb.append(',');
		oDoIt = true;
		sb.append(goIn());

		sb.append(StringUtil.escapeJS(upperCase ? _keys[i].getUpperString() : _keys[i].getString(), '"', charsetEncoder));
		sb.append(":[");
		boolean doIt = false;
		for (int y = 1; y <= len; y++) {
		    if (doIt) sb.append(',');
		    doIt = true;
		    try {
			_serialize(pc, test, query.getAt(_keys[i], y), sb, serializeQueryByColumns, done);
		    }
		    catch (PageException e) {
			_serialize(pc, test, e.getMessage(), sb, serializeQueryByColumns, done);
		    }
		}

		sb.append(']');
	    }

	    sb.append('}');
	}
	else {
	    sb.append('[');
	    boolean oDoIt = false;
	    int len = query.getRecordcount();
	    for (int row = 1; row <= len; row++) {
		if (oDoIt) sb.append(',');
		oDoIt = true;

		sb.append("[");
		boolean doIt = false;
		for (int col = 0; col < _keys.length; col++) {
		    if (doIt) sb.append(',');
		    doIt = true;
		    try {
			_serialize(pc, test, query.getAt(_keys[col], row), sb, serializeQueryByColumns, done);
		    }
		    catch (PageException e) {
			_serialize(pc, test, e.getMessage(), sb, serializeQueryByColumns, done);
		    }
		}
		sb.append(']');
	    }
	    sb.append(']');
	}
	sb.append('}');
    }
737235
protected <T> T processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Session sess) throws CpoException {
    T criteriaObj = obj;
    boolean recordsExist = false;
    Logger localLogger = obj == null ? logger : LoggerFactory.getLogger(obj.getClass());

    int recordCount = 0;
    int attributesSet = 0;

    T rObj = null;

    if (obj == null) {
      throw new CpoException("NULL Object passed into retrieveBean");
    }

    try {
      CpoClass cpoClass = metaDescriptor.getMetaClass(criteriaObj);
      List<CpoFunction> functions = cpoClass.getFunctionGroup(CpoAdapter.RETRIEVE_GROUP, groupName).getFunctions();

      localLogger.info("=================== Class=<" + criteriaObj.getClass() + "> Type=<" + CpoAdapter.RETRIEVE_GROUP + "> Name=<" + groupName + "> =========================");

      try {
        rObj = (T) obj.getClass().newInstance();
      } catch (IllegalAccessException iae) {
        localLogger.error("=================== Could not access default constructor for Class=<" + obj.getClass() + "> ==================");
        throw new CpoException("Unable to access the constructor of the Return Object", iae);
      } catch (InstantiationException iae) {
        throw new CpoException("Unable to instantiate Return Object", iae);
      }

      for (CpoFunction cpoFunction : functions) {

        CassandraBoundStatementFactory cbsf = new CassandraBoundStatementFactory(sess, this, cpoClass, cpoFunction, criteriaObj, wheres, orderBy, nativeExpressions);
        BoundStatement boundStatement = cbsf.getBoundStatement();

        // insertions on
        // selectgroup
        ResultSet rs = sess.execute(boundStatement);
        cbsf.release();

        ColumnDefinitions columnDefs = rs.getColumnDefinitions();

        if ((columnDefs.size() == 2) && "CPO_ATTRIBUTE".equalsIgnoreCase(columnDefs.getName(1)) && "CPO_VALUE".equalsIgnoreCase(columnDefs.getName(2))) {
          for(Row row : rs) {
            recordsExist = true;
            recordCount++;
            CpoAttribute attribute = cpoClass.getAttributeData(row.getString(0));

            if (attribute != null) {
              attribute.invokeSetter(rObj, new ResultSetCpoData(CassandraMethodMapper.getMethodMapper(), row, attribute, 1));
              attributesSet++;
            }
          }
        } else if (!rs.isExhausted()) {
          recordsExist = true;
          recordCount++;
          Row row = rs.one();
          for (int k = 0; k < columnDefs.size(); k++) {
            CpoAttribute attribute = cpoClass.getAttributeData(columnDefs.getName(k));

            if (attribute != null) {
              attribute.invokeSetter(rObj, new ResultSetCpoData(CassandraMethodMapper.getMethodMapper(), row, attribute, k));
              attributesSet++;
            }
          }

          if (rs.one() != null) {
            String msg = "ProcessSelectGroup(Object, String) failed: Multiple Records Returned";
            localLogger.error(msg);
            throw new CpoException(msg);
          }
        }
        criteriaObj = rObj;
      }

      if (!recordsExist) {
        rObj = null;
        localLogger.info("=================== 0 Records - 0 Attributes - Class=<" + criteriaObj.getClass() + "> Type=<" + CpoAdapter.RETRIEVE_GROUP + "> Name=<" + groupName + "> =========================");
      } else {
        localLogger.info("=================== " + recordCount + " Records - " + attributesSet + " Attributes - Class=<" + criteriaObj.getClass() + ">  Type=<" + CpoAdapter.RETRIEVE_GROUP + "> Name=<" + groupName + "> =========================");
      }
    } catch (Throwable t) {
      String msg = "ProcessSeclectGroup(Object) failed: " + ExceptionHelper.getLocalizedMessage(t);
      localLogger.error(msg, t);
      throw new CpoException(msg, t);
    }

    return rObj;
  }
214589
protected function parseTags($rawTags, string $group = null, string $locale = null, $create = false): array
    {
        (is_iterable($rawTags) || is_null($rawTags)) || $rawTags = [$rawTags];

        [$strings, $tags] = collect($rawTags)->map(function ($tag) {
            ! is_numeric($tag) || $tag = (int) $tag;

            ! $tag instanceof Model || $tag = [$tag->getKey()];
            ! $tag instanceof Collection || $tag = $tag->modelKeys();
            ! $tag instanceof BaseCollection || $tag = $tag->toArray();

            return $tag;
        })->partition(function ($item) {
            return is_string($item);
        });

        return $tags->merge(app('rinvex.tags.tag')->{$create ? 'findByNameOrCreate' : 'findByName'}($strings->toArray(), $group, $locale)->pluck('id'))->toArray();
    }
1264648
def _parse_czeng(*paths, **kwargs):
  """"""
  filter_path = kwargs.get("filter_path", None)
  if filter_path:
    re_block = re.compile(r"^[^-]+-b(\d+)-\d\d[tde]")
    with tf.io.gfile.GFile(filter_path) as f:
      bad_blocks = {
          blk for blk in re.search(
              r"qw{([\s\d]*)}", f.read()).groups()[0].split()
      }
    logging.info(
        "Loaded %d bad blocks to filter from CzEng v1.6 to make v1.7.",
        len(bad_blocks))

  for path in paths:
    for gz_path in tf.io.gfile.glob(path):
      with tf.io.gfile.GFile(gz_path, "rb") as g, gzip.GzipFile(fileobj=g) as f:
        for line in f:
          line = line.decode("utf-8")  # required for py3
          if not line.strip():
            continue
          id_, unused_score, cs, en = line.split("\t")
          if filter_path:
            block_match = re.match(re_block, id_)
            if block_match and block_match.groups()[0] in bad_blocks:
              continue
          yield {
              "cs": cs.strip(),
              "en": en.strip(),
          }
592151
private QueryBuilderKraken parseInsert()
  {
    Token token;

    if ((token = scanToken()) != Token.INTO) {
      throw error("expected INTO at '{0}'", token);
    }

    TableKraken table = parseTable();

    Objects.requireNonNull(table);
    
    TableKelp tableKelp = table.getTableKelp();

    ArrayList<Column> columns = new ArrayList<>();
    
    boolean isKeyHash = false;

    if ((token = scanToken()) == Token.LPAREN) {
      do {
        String columnName = parseIdentifier();

        Column column = tableKelp.getColumn(columnName);

        if (column == null) {
          throw error("'{0}' is not a valid column in {1}",
                      columnName, table.getName());
        }
        
        columns.add(column);
      } while ((token = scanToken()) == Token.COMMA);

      if (token != Token.RPAREN) {
        throw error("expected ')' at '{0}'", token);
      }

      token = scanToken();
    }
    else {
      for (Column column : tableKelp.getColumns()) {
        if (column.name().startsWith(":")) {
          continue;
        }
        
        columns.add(column);
      }
    }

    if (token != Token.VALUES)
      throw error("expected VALUES at '{0}'", token);

    if ((token = scanToken()) != Token.LPAREN) {
      throw error("expected '(' at '{0}'", token);
    }

    ArrayList<ExprKraken> values = new ArrayList<>();

    InsertQueryBuilder query;
    
    query = new InsertQueryBuilder(this, _sql, table, columns);
    _query = query;

    do {
      ExprKraken expr = parseExpr();

      //expr = expr.bind(new TempQueryBuilder(table));

      values.add(expr);
    } while ((token = scanToken()) == Token.COMMA);

    if (token != Token.RPAREN) {
      throw error("expected ')' at '{0}'", token);
    }

    if (columns.size() != values.size()) {
      throw error("number of columns does not match number of values");
    }

    ParamExpr []params = _params.toArray(new ParamExpr[_params.size()]);

    query.setParams(params);
    query.setValues(values);
    // query.init();

    return query;
  }
379043
@Override
    public boolean rmGroup(Node node) {
        LdapGroup group = (LdapGroup) node;
        try {
            deletionCount++;
            ctx.unbind(getOuForNode(group));
        } catch (NamingException ex) {
            handleNamingException(group, ex);
        }
        Node ldapGroup = getGroup(group.getCn());
        return ldapGroup.isEmpty();
    }
1000613
public void loadFromDirectAccess(){
		String pdbId = "1A4W";

		StructureProvider pdbreader = new MMCIFFileReader();

		try {
			Structure s = pdbreader.getStructureById(pdbId);

			System.out.println("Getting chain H of 1A4W");

			List<Chain> hs = s.getNonPolyChainsByPDB("H");

			Chain h = hs.get(0);
			List<Group> ligands = h.getAtomGroups();

			System.out.println("These ligands have been found in chain " + h.getName());

			for (Group l:ligands){
				System.out.println(l);
			}

			System.out.println("Accessing QWE directly: ");
			Group qwe = s.getNonPolyChainsByPDB("H").get(2).getGroupByPDB(new ResidueNumber("H",373,null));

			System.out.println(qwe.getChemComp());

			System.out.println(h.getSeqResSequence());
			System.out.println(h.getAtomSequence());
			System.out.println(h.getAtomGroups(GroupType.HETATM));

			System.out.println("Entities: " + s.getEntityInfos());

		} catch (Exception e) {
			e.printStackTrace();
		}


	}
990742
def _parse_textgroup(self, cts_file):
        
        with io.open(cts_file) as __xml__:
            return self.classes["textgroup"].parse(
                resource=__xml__
            ), cts_file
74428
public static boolean isValidRgroupQueryLabel(String Rxx) {
        Matcher matcher = validLabelPattern.matcher(Rxx);
        if (matcher.find()) {
            int groupNumber = Integer.valueOf(Rxx.substring(1));
            if (groupNumber >= 1 && groupNumber <= 32) {
                return true;
            }
        }
        return false;
    }
714927
@Override
    public Iterator findMemberGroups(IEntityGroup group) throws GroupsException {
        Connection conn = null;
        Collection groups = new ArrayList();
        IEntityGroup eg = null;
        String serviceName = group.getServiceName().toString();
        String localKey = group.getLocalKey();

        try {
            conn = RDBMServices.getConnection();
            String sql = getFindMemberGroupsSql();
            PreparedStatement ps = conn.prepareStatement(sql);
            try {
                ps.setString(1, localKey);
                ps.setString(2, serviceName);
                if (LOG.isDebugEnabled())
                    LOG.debug(
                            "RDBMEntityGroupStore.findMemberGroups(): "
                                    + ps
                                    + " ("
                                    + localKey
                                    + ", "
                                    + serviceName
                                    + ")");
                ResultSet rs = ps.executeQuery();
                try {
                    while (rs.next()) {
                        eg = instanceFromResultSet(rs);
                        groups.add(eg);
                    }
                } finally {
                    rs.close();
                }
            } finally {
                ps.close();
            }
        } catch (Exception sqle) {
            LOG.error("RDBMEntityGroupStore.findMemberGroups(): " + sqle);
            throw new GroupsException("Problem retrieving member groups: " + sqle);
        } finally {
            RDBMServices.releaseConnection(conn);
        }

        return groups.iterator();
    }
132252
protected final String groupKey(CDXLine line) {
		String timestamp = line.getTimestamp();
		return timestamp.substring(0,
			Math.min(timestampDedupLength, timestamp.length()));
	}