MMinuteBramble
Workflows

Coding workflows · Minute-field schedule expansion

03
Built around your work

A concrete starting point

Expand a minute field of at most 128 characters into sorted unique values from zero to 59. Test lists, inclusive ranges and steps on ranges or stars, rejecting reversed bounds, zero steps and unsupported syntax without scheduling a job.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Minute-field schedule expansion

A concrete starting point
import re

def minute_values(field):
    if type(field) is not str or not 1 <= len(field) <= 128:
        raise ValueError("minute.input")
    result = set()
    for item in field.split(","):
        match = re.fullmatch(r"(\*|[0-9]+(?:-[0-9]+)?)(?:/([0-9]+))?", item)
        if match is None:
            raise ValueError("minute.syntax")
        base, step_text = match.groups()
        step = int(step_text) if step_text else 1
        if not 1 <= step <= 59 or (step_text and base != "*" and "-" not in base):
            raise ValueError("minute.step")
        bounds = [int(x) for x in base.split("-")] if base != "*" else [0, 59]
        low, high = (bounds[0], bounds[-1])
        if not 0 <= low <= high <= 59:
            raise ValueError("minute.bounds")
        result.update(range(low, high+1, step))
    return sorted(result)

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗