Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
saraedum committed Dec 10, 2024
1 parent 3be93a1 commit 4f92c0c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
12 changes: 9 additions & 3 deletions flatsurvey/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
>>> from flatsurvey.jobs import OrbitClosure
>>> scheduler = Scheduler(generators=[ngons], goals=[OrbitClosure], bindings=[], reporters=[])
>>> await scheduler.start()
>>> import asyncio
>>> asyncio.run(scheduler.start()) # random progress output
on ...: all jobs have been scheduled
done ...
"""
# *********************************************************************
Expand Down Expand Up @@ -72,7 +76,7 @@ class Scheduler:
EXAMPLES::
>>> Scheduler(generators=[], goals=[])
Scheduler
Scheduler(…)
"""

Expand Down Expand Up @@ -142,7 +146,9 @@ async def start(self):
>>> import asyncio
>>> scheduler = Scheduler(generators=[], bindings=[], goals=[], reporters=[])
>>> asyncio.run(scheduler.start())
>>> asyncio.run(scheduler.start()) # random progress output
on ...: all jobs have been scheduled
done ...
"""
pool = await self._create_pool()
Expand Down
20 changes: 8 additions & 12 deletions flatsurvey/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
--debug
--help Show this message and exit.
--scheduler TEXT
-N, --dry-run Do not spawn any workers.
-q, --queue INTEGER Jobs to prepare in the background for scheduling.
-v, --verbose Enable verbose message, repeat for debug message.
<BLANKLINE>
Expand Down Expand Up @@ -49,10 +48,9 @@
saddle-connections Saddle connections on the surface.
<BLANKLINE>
Reports:
json Writes results in JSON format.
log Writes progress and results as an unstructured log file.
progress Reports progress on the command line.
report Generic reporting of results.
json Writes results in JSON format.
log Writes progress and results as an unstructured log file.
report Generic reporting of results.
<BLANKLINE>
Surfaces:
ngons The translation surfaces that come from unfolding n-gons.
Expand Down Expand Up @@ -93,7 +91,6 @@
cls=CommandWithGroups,
help="Run a survey on the `objects` until all the `goals` are reached.",
)
@click.option("--dry-run", "-N", is_flag=True, help="Do not spawn any workers.")
@click.option("--debug", is_flag=True)
@click.option(
"--queue",
Expand All @@ -113,13 +110,11 @@
default=None,
type=str,
)
def survey(dry_run, debug, queue, verbose, scheduler):
def survey(debug, queue, verbose, scheduler):
r"""
Main command, runs a survey; specific survey objects and goals are
registered automatically as subcommands.
"""
# For technical reasons, dry_run needs to be a parameter here. It is consumed by process() below.
_ = dry_run
# For technical reasons, debug needs to be a parameter here. It is consumed by process() below.
_ = debug
# For technical reasons, queue needs to be a parameter here. It is consumed by process() below.
Expand All @@ -143,7 +138,7 @@ def survey(dry_run, debug, queue, verbose, scheduler):

@survey.result_callback()
def process(
subcommands, dry_run=False, debug=False, queue=128, verbose=0, scheduler=None
subcommands, debug=False, queue=128, verbose=0, scheduler=None
):
r"""
Run the specified subcommands of ``survey``.
Expand All @@ -153,7 +148,9 @@ def process(
We start an orbit-closure computation for a single triangle::
>>> from flatsurvey.test.cli import invoke
>>> invoke(survey, "ngons", "-n", "3", "--limit=3", "--literature=include", "orbit-closure")
>>> invoke(survey, "ngons", "-n", "3", "--limit=3", "--literature=include", "orbit-closure") # random progress output
on ...: all jobs have been scheduled
done ...
"""
if debug:
Expand Down Expand Up @@ -195,7 +192,6 @@ def process(
goals=goals,
reporters=reporters,
queue=queue,
dry_run=dry_run,
debug=debug,
scheduler=scheduler,
).start()
Expand Down
7 changes: 3 additions & 4 deletions flatsurvey/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@
connections irrespective of scaling and sign.
saddle-connections Saddle connections on the surface.
Reports:
json Writes results in JSON format.
log Writes progress and results as an unstructured log file.
progress Reports progress on the command line.
report Generic reporting of results.
json Writes results in JSON format.
log Writes progress and results as an unstructured log file.
report Generic reporting of results.
Surfaces:
ngon Unfolding of an n-gon with prescribed angles.
pickle A base64 encoded pickle.
Expand Down

0 comments on commit 4f92c0c

Please sign in to comment.