Generates a human readable string for the Cron Expression
    Args:
        expression: The cron expression string
        options: Options to control the output description
    Returns:
        The cron expression description
179052
def get_description(expression, options=None):
    
    descripter = ExpressionDescriptor(expression, options)
    return descripter.get_description(DescriptionTypeEnum.FULL)
413422
def get_expressions():
    

    if len(_EXPRESSIONS) == len(FILENAME_PATTERNS):
        return _EXPRESSIONS

    for cpattern in FILENAME_PATTERNS:
        _EXPRESSIONS.append(re.compile(cpattern, re.VERBOSE))
    return _EXPRESSIONS
708367
protected void buildExpression(String expression) throws ParseException {
        expressionParsed = true;

        try {

            if (seconds == null) {
                seconds = new TreeSet<Integer>();
            }
            if (minutes == null) {
                minutes = new TreeSet<Integer>();
            }
            if (hours == null) {
                hours = new TreeSet<Integer>();
            }
            if (daysOfMonth == null) {
                daysOfMonth = new TreeSet<Integer>();
            }
            if (months == null) {
                months = new TreeSet<Integer>();
            }
            if (daysOfWeek == null) {
                daysOfWeek = new TreeSet<Integer>();
            }
            if (years == null) {
                years = new TreeSet<Integer>();
            }

            int exprOn = SECOND;

            StringTokenizer exprsTok = new StringTokenizer(expression, " \t",
                    false);

            while (exprsTok.hasMoreTokens() && exprOn <= YEAR) {
                String expr = exprsTok.nextToken().trim();

                // throw an exception if L is used with other days of the month
                if(exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.indexOf(",") >= 0) {
                    throw new ParseException("Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1);
                }
                // throw an exception if L is used with other days of the week
                if(exprOn == DAY_OF_WEEK && expr.indexOf('L') != -1 && expr.length() > 1  && expr.indexOf(",") >= 0) {
                    throw new ParseException("Support for specifying 'L' with other days of the week is not implemented", -1);
                }
                if(exprOn == DAY_OF_WEEK && expr.indexOf('#') != -1 && expr.indexOf('#', expr.indexOf('#') +1) != -1) {
                    throw new ParseException("Support for specifying multiple \"nth\" days is not imlemented.", -1);
                }
                
                StringTokenizer vTok = new StringTokenizer(expr, ",");
                while (vTok.hasMoreTokens()) {
                    String v = vTok.nextToken();
                    storeExpressionVals(0, v, exprOn);
                }

                exprOn++;
            }

            if (exprOn <= DAY_OF_WEEK) {
                throw new ParseException("Unexpected end of expression.",
                            expression.length());
            }

            if (exprOn <= YEAR) {
                storeExpressionVals(0, "*", YEAR);
            }

            TreeSet<Integer> dow = getSet(DAY_OF_WEEK);
            TreeSet<Integer> dom = getSet(DAY_OF_MONTH);

            // Copying the logic from the UnsupportedOperationException below
            boolean dayOfMSpec = !dom.contains(NO_SPEC);
            boolean dayOfWSpec = !dow.contains(NO_SPEC);

            if (dayOfMSpec && !dayOfWSpec) { 
                // skip
            } else if (dayOfWSpec && !dayOfMSpec) { 
                // skip
            } else {
                throw new ParseException(
                        "Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.", 0);
            }
        } catch (ParseException pe) {
            throw pe;
        } catch (Exception e) {
            throw new ParseException("Illegal cron expression format ("
                    + e.toString() + ")", 0);
        }
    }
713023
def _expression(expression):
    # type: (QuilParser.ExpressionContext) -> Any
    
    if isinstance(expression, QuilParser.ParenthesisExpContext):
        return _expression(expression.expression())
    elif isinstance(expression, QuilParser.PowerExpContext):
        if expression.POWER():
            return _binary_exp(expression, operator.pow)
    elif isinstance(expression, QuilParser.MulDivExpContext):
        if expression.TIMES():
            return _binary_exp(expression, operator.mul)
        elif expression.DIVIDE():
            return _binary_exp(expression, operator.truediv)
    elif isinstance(expression, QuilParser.AddSubExpContext):
        if expression.PLUS():
            return _binary_exp(expression, operator.add)
        elif expression.MINUS():
            return _binary_exp(expression, operator.sub)
    elif isinstance(expression, QuilParser.SignedExpContext):
        if expression.sign().PLUS():
            return _expression(expression.expression())
        elif expression.sign().MINUS():
            return -1 * _expression(expression.expression())
    elif isinstance(expression, QuilParser.FunctionExpContext):
        return _apply_function(expression.function(), _expression(expression.expression()))
    elif isinstance(expression, QuilParser.AddrExpContext):
        return _addr(expression.addr())
    elif isinstance(expression, QuilParser.NumberExpContext):
        return _number(expression.number())
    elif isinstance(expression, QuilParser.VariableExpContext):
        return _variable(expression.variable())

    raise RuntimeError("Unexpected expression type:" + expression.getText())
979743
public static CronSchedule dailyAtHourAndMinute(int hour, int minute) {
        String expression = String.format("0 %d %d ? * *", minute, hour);
        return of(expression);
    }
271438
def get_hours_description(self):
        
        expression = self._expression_parts[2]
        return self.get_segment_description(
            expression,
            _("every hour"),
            lambda s: self.format_time(s, "0"),
            lambda s: _("every {0} hours").format(s),
            lambda s: _("between {0} and {1}"),
            lambda s: _("at {0}")
        )
858526
def parse(expression):
    
    result = []
    current = ""
    for i in expression:
        if i.isdigit() or i == '.':
            current += i
        else:
            if len(current) > 0:
                result.append(current)
                current = ""
            if i in __operators__ or i in __parenthesis__:
                result.append(i)
            else:
                raise Exception("invalid syntax " + i)

    if len(current) > 0:
        result.append(current)
    return result
935665
def p_expression_times(self, p):
        ''
        p[0] = Times(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
232854
public static CronEntry parse(String task, String expression) {

		String[] fields = expression.split("[ \\t]+");

		if (fields.length == CronService.NUM_FIELDS) {

			CronEntry cronEntry = new CronEntry(task);
			String secondsField = fields[0];
			String minutesField = fields[1];
			String hoursField   = fields[2];
			String daysField    = fields[3];
			String monthsField  = fields[4];
			String weeksField   = fields[5];

			try {

				CronField seconds = parseField(secondsField, 0, 59);

				cronEntry.setSeconds(seconds);

			} catch (Throwable t) {
				logger.warn("Invalid cron expression for task {}, field 'seconds': {}", new Object[] { task, t.getMessage() });
			}

			try {

				CronField minutes = parseField(minutesField, 0, 59);

				cronEntry.setMinutes(minutes);

			} catch (Throwable t) {
				logger.warn("Invalid cron expression for task {}, field 'minutes': {}", new Object[] { task, t.getMessage() });
			}

			try {

				CronField hours = parseField(hoursField, 0, 23);

				cronEntry.setHours(hours);

			} catch (Throwable t) {
				logger.warn("Invalid cron expression for task {}, field 'hours': {}", new Object[] { task, t.getMessage() });
			}

			try {

				CronField days = parseField(daysField, 1, 31);

				cronEntry.setDays(days);

			} catch (Throwable t) {
				logger.warn("Invalid cron expression for task {}, field 'days': {}", new Object[] { task, t.getMessage() });
			}

			try {

				CronField weeks = parseField(weeksField, 0, 6);

				cronEntry.setWeeks(weeks);

			} catch (Throwable t) {
				logger.warn("Invalid cron expression for task {}, field 'weeks': {}", new Object[] { task, t.getMessage() });
			}

			try {

				CronField months = parseField(monthsField, 1, 12);

				cronEntry.setMonths(months);

			} catch (Throwable t) {
				logger.warn("Invalid cron expression for task {}, field 'months': {}", new Object[] { task, t.getMessage() });
			}

			return cronEntry;

		} else {

			logger.warn("Invalid cron expression for task {}: invalid number of fields (must be {}).", new Object[] { task, CronService.NUM_FIELDS });

		}

		return null;
	}
986501
def parse_expression(expression: str) -> Tuple[Set[str], List[CompositeAxis]]:
    
    identifiers = set()
    composite_axes = []
    if '.' in expression:
        if '...' not in expression:
            raise EinopsError('Expression may contain dots only inside ellipsis (...)')
        if str.count(expression, '...') != 1 or str.count(expression, '.') != 3:
            raise EinopsError('Expression may contain dots only inside ellipsis (...); only one ellipsis for tensor ')
        expression = expression.replace('...', _ellipsis)

    bracket_group = None

    def add_axis_name(x):
        if x is not None:
            if x in identifiers:
                raise ValueError('Indexing expression contains duplicate dimension "{}"'.format(x))
            identifiers.add(x)
            if bracket_group is None:
                composite_axes.append([x])
            else:
                bracket_group.append(x)

    current_identifier = None
    for char in expression:
        if char in '() ' + _ellipsis:
            add_axis_name(current_identifier)
            current_identifier = None
            if char == _ellipsis:
                if bracket_group is not None:
                    raise EinopsError("Ellipsis can't be used inside the composite axis (inside brackets)")
                composite_axes.append(_ellipsis)
                identifiers.add(_ellipsis)
            elif char == '(':
                if bracket_group is not None:
                    raise EinopsError("Axis composition is one-level (brackets inside brackets not allowed)")
                bracket_group = []
            elif char == ')':
                if bracket_group is None:
                    raise EinopsError('Brackets are not balanced')
                composite_axes.append(bracket_group)
                bracket_group = None
        elif '0' <= char <= '9':
            if current_identifier is None:
                raise EinopsError("Axis name can't start with a digit")
            current_identifier += char
        elif 'a' <= char <= 'z':
            if current_identifier is None:
                current_identifier = char
            else:
                current_identifier += char
        else:
            if 'A' <= char <= 'Z':
                raise EinopsError("Only lower-case latin letters allowed in names, not '{}'".format(char))
            raise EinopsError("Unknown character '{}'".format(char))

    if bracket_group is not None:
        raise EinopsError('Imbalanced parentheses in expression: "{}"'.format(expression))
    add_axis_name(current_identifier)
    return identifiers, composite_axes
636419
def _expression_to_string(expression):
    
    if isinstance(expression, BinaryExp):
        left = _expression_to_string(expression.op1)
        if isinstance(expression.op1, BinaryExp) and not (
                expression.op1.precedence > expression.precedence
                or expression.op1.precedence == expression.precedence
                and expression.associates in ('left', 'both')):
            left = '(' + left + ')'

        right = _expression_to_string(expression.op2)
        if isinstance(expression.op2, BinaryExp) and not (
                expression.precedence < expression.op2.precedence
                or expression.precedence == expression.op2.precedence
                and expression.associates in ('right', 'both')):
            right = '(' + right + ')'

        return left + expression.operator + right
    elif isinstance(expression, Function):
        return expression.name + '(' + _expression_to_string(expression.expression) + ')'
    elif isinstance(expression, Parameter):
        return str(expression)
    else:
        return format_parameter(expression)
1223966
private function truncateCronExpression(string $expression): string
    {
        $expressionParts = preg_split('/\s/', $expression, -1, PREG_SPLIT_NO_EMPTY);
        if (count($expressionParts) === 5) {
            return $expression;
        }

        $expressionParts = array_slice($expressionParts, 0, 5);
        return implode(' ', $expressionParts);
    }
1238279
def SetExpression(self, expression):
    """"""
    if isinstance(expression, lexer.Expression):
      self.args = [expression]
    else:
      raise errors.ParseError(
          'Expected expression, got {0:s}.'.format(expression))
326400
def string_to_expression_parts(expression_str)
      return {} if expression_str.nil?

      parts, interval = split_parts_and_interval(expression_str)

      expression_parts = ::Hash[EXPRESSION_PART_KEYS.zip(parts)]
      expression_parts.select! do |_key, value|
        !value.nil?
      end
      expression_parts[:interval] = interval unless interval.nil?

      expression_parts
    end
1190992
def translate_expression(expression):
    
    logger_ts.info("enter translate_expression")
    m = re_filter_expr.findall(expression)
    matches = []
    if m:
        for i in m:
            logger_ts.info("parse match: {}".format(i))
            tmp = list(i[1:])
            if tmp[1] in COMPARISONS:
                tmp[1] = COMPARISONS[tmp[1]]
            tmp[0] = cast_float(tmp[0])
            tmp[2] = cast_float(tmp[2])
            matches.append(tmp)
    else:
        logger_ts.warn("translate_expression: invalid expression: {}".format(expression))
        print("Invalid input expression")
    logger_ts.info("exit translate_expression")
    return matches
969198
def make_order_string(cls, order_specification):
        
        registry = get_current_registry()
        visitor_cls = registry.getUtility(IOrderSpecificationVisitor,
                                          name=EXPRESSION_KINDS.CQL)
        visitor = visitor_cls()
        order_specification.accept(visitor)
        return str(visitor.expression)
380501
def parse(cls, expression):
        
        parsed = {"name": None, "arguments": [], "options": []}

        if not expression.strip():
            raise ValueError("Console command signature is empty.")

        expression = expression.replace(os.linesep, "")

        matches = re.match(r"[^\s]+", expression)

        if not matches:
            raise ValueError("Unable to determine command name from signature.")

        name = matches.group(0)
        parsed["name"] = name

        tokens = re.findall(r"\{\s*(.*?)\s*\}", expression)

        if tokens:
            parsed.update(cls._parameters(tokens))

        return parsed