def parse_select()

in pbspro/src/pbspro/parser.py [0:0]


    def parse_select(self, select_expression: str) -> List[Dict[str, Any]]:
        # Need to detect when slot_type is specified with `-l select=1:slot_type`
        assert isinstance(select_expression, str)
        chunks: List[Dict[str, Any]] = []

        for chunk_expr in select_expression.split("+"):
            chunk = {}
            # give a default of 1 in case the user assumes 1 with their select
            # i.e. -l select=1:mem=16gb == -l select=mem=16gb
            # if they picked a number it will be overridden below
            chunk["select"] = "1"
            chunk["schedselect"] = "1"
            for expr in chunk_expr.split(":"):
                value: Any

                if "=" not in expr:
                    key, value = "select", int(expr)
                else:
                    key, value = expr.split("=", 1)
                    if key in self.resource_definitions:
                        value = self.resource_definitions[key].type.parse(value)
                    else:
                        logging.warning(
                            "Unknown resource %s: treating as a string.", key
                        )
                    chunk[key] = value
            chunks.append(chunk)

        return chunks