예제 #1
0
파일: sim_task.py 프로젝트: n8jhj/SoonQ
 def run(self, project):
     """Simulate subject to the parameters specified in the given
     project.
     """
     sq.echo(f"Running {project.name!r}...")
     project.run()
     sq.echo(f"Project {project.name!r} finished.")
예제 #2
0
파일: __main__.py 프로젝트: n8jhj/SoonQ
def execute(command):
    try:
        cmd = getattr(EXAMPLE_MODULE_MAP[command], command)
    except AttributeError:
        sq.echo(f"Example {command!r} not recognized.")
        return
    cmd()
예제 #3
0
def timer_sleep(interval, i=None, n=None):
    if None not in (i, n):
        msg = f"{i+1}/{n} "
    else:
        msg = ""
    msg += f"Sleeping {interval} seconds..."
    sq.echo(msg)
    time.sleep(interval)
예제 #4
0
    def run(self, interval, n):
        """Count at the given interval the given number of times.

        Positional arguments:
        interval - (int) Interval, in seconds.
        n - (int) Number of times to count the given interval.
        """
        self.interval = interval
        timer_sleep_all(interval, n)
        sq.echo(f"Slept {interval * n} seconds total.")
예제 #5
0
파일: __main__.py 프로젝트: n8jhj/SoonQ
def print_help():
    sq.echo(f"Usage: python -m examples [OPTIONS] COMMAND [ARGS]...\n")
    sq.echo("Options:")
    for opts, desc in OPTIONS:
        sq.echo(f"  {', '.join(opts)}  {desc}")
    sq.echo()
    sq.echo("Commands:")
    max_modname_len = max(len(mod) for mod in EXAMPLE_MODULE_MAP)
    for cmd, descr in zip(EXAMPLE_MODULE_MAP.keys(),
                          EXAMPLE_MODULE_DESCRIPTIONS):
        sq.echo(f"  {cmd:<{max_modname_len+2}}{descr}")
예제 #6
0
파일: view_queue.py 프로젝트: n8jhj/SoonQ
def view_queue():
    sq.echo(tabulate_task_items(max_entries=5))
예제 #7
0
파일: sim_task.py 프로젝트: n8jhj/SoonQ
 def run(self):
     n = 4
     for i in range(n):
         msg = f"{i+1}/{n} Simulation step"
         sq.echo(msg)
         time.sleep(2)
예제 #8
0
파일: view_work.py 프로젝트: n8jhj/SoonQ
def view_work():
    sq.echo(pprint.pformat(list(sq.work_items(max_entries=5))))