Permalink
Browse files

[MTurk CLI] Show description and keywords for the "hit" command.

  • Loading branch information...
1 parent 85871ba commit d222f1a459181f639aad2d05b453d2599331d8aa @Kodiologist Kodiologist committed Nov 30, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 bin/mturk
View
11 bin/mturk
@@ -146,7 +146,7 @@ def get_nickname(hitid):
def display_datetime(dt):
return dt.strftime('%e %b %Y, %l:%M %P')
-def display_hit(hit):
+def display_hit(hit, verbose = False):
et = parse_timestamp(hit.Expiration)
return '\n'.join([
'{} - {} ({}, {}, {})'.format(
@@ -170,10 +170,13 @@ def display_hit(hit):
int(hit.MaxAssignments) - (int(hit.NumberOfAssignmentsAvailable) + int(hit.NumberOfAssignmentsPending) + int(hit.NumberOfAssignmentsCompleted)),
hit.NumberOfAssignmentsCompleted)
if hasattr(hit, 'NumberOfAssignmentsAvailable')
- else 'Assignments: {} total'.format(hit.MaxAssignments)
+ else 'Assignments: {} total'.format(hit.MaxAssignments),
# For some reason, SearchHITs includes the
# NumberOfAssignmentsFoobar fields but GetHIT doesn't.
- ]) + '\n'
+ ] + ([] if not verbose else [
+ '\nDescription: ' + hit.Description,
+ '\nKeywords: ' + hit.Keywords
+ ])) + '\n'
def digest_assignment(a):
return dict(
@@ -191,7 +194,7 @@ def get_balance():
return con.get_account_balance()
def show_hit(hit):
- return display_hit(con.get_hit(hit)[0])
+ return display_hit(con.get_hit(hit)[0], verbose = True)
def list_hits():
'Lists your 10 most recently created HITs, with the most recent last.'

0 comments on commit d222f1a

Please sign in to comment.