Skip to content

Commit

Permalink
Tweaks to submit-distances.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Feb 20, 2015
1 parent 6e22892 commit 9f22fb9
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion submit-distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,23 @@ def get_system(tdb):
.format(systemName)
)

return systemName, system, args[1:]
argv = args[1:]
if argv:
if len(argv) == 1 and argv[0].startswith("--pick"):
_, _, num = argv[0].partition("=")
try:
num = int(num)
except TypeError:
raise UseageError("Expecting --pick=<number>")
destinations = random.sample([
sysName for sysName in tdb.systemByName.keys()
], num)
else:
destinations = argv
else:
destinations = None

return systemName, system, destinations


def get_cmdr(tdb):
Expand Down Expand Up @@ -252,6 +268,20 @@ def submit_distances(system, cmdr, distances):
else:
testMode = False

if os.environ.get("ASSERT"):
print()
for ref in distances:
print("Submitting ({}->{} {})".format(
ref['name'], system, ref['dist'],
))
sub = StarSubmission(
star=ref['name'],
commander=cmdr,
refs=[{'name': system, 'dist': ref['dist']}],
test=testMode,
)
sub.submit()

print()
print("Submitting ({})".format("TEST" if testMode else "Live"))

Expand Down

0 comments on commit 9f22fb9

Please sign in to comment.