Commit 45cf50d4 authored by André Anjos's avatar André Anjos 💬
Browse files

Add client option; Add break-down by lighting condition

parent 4a550a66
......@@ -61,6 +61,7 @@ class Database(DatabaseBase):
'protocol': args.replay_protocol,
'support' : args.replay_support,
'light' : args.replay_light,
'clients' : args.replay_client if args.replay_client else None,
__init__.__doc__ = DatabaseBase.__init__.__doc__
......@@ -87,6 +88,9 @@ class Database(DatabaseBase):
lights = ReplayFileModel.light_choices
p.add_argument('--light', type=str, choices=lights, dest='replay_light', help="Types of illumination conditions (if unset, the default, use all)")
identities = [ for k in self.__db.clients()]
p.add_argument('--client', type=int, action='append', choices=identities, dest='replay_client', help="Client identifier (if unset, the default, use all)")
......@@ -146,7 +150,7 @@ class Database(DatabaseBase):
get_test_data.__doc__ = DatabaseBase.get_test_data.__doc__
def get_test_filters(self):
return ('device', 'support')
return ('device', 'support', 'light')
def get_filtered_test_data(self, filter):
......@@ -156,6 +160,9 @@ class Database(DatabaseBase):
def support_filter(obj, filter):
return obj.make_path().find(filter) != -1
def light_filter(obj, filter):
return obj.make_path().find(filter) != -1
real, attack = self.get_test_data()
if filter == 'device':
......@@ -169,6 +176,11 @@ class Database(DatabaseBase):
'hand': (real, [k for k in attack if support_filter(k, 'hand')]),
'fixed': (real, [k for k in attack if support_filter(k, 'fixed')]),
elif filter == 'light':
return {
'controlled': (real, [k for k in attack if light_filter(k, 'controlled')]),
'adverse': (real, [k for k in attack if light_filter(k, 'adverse')]),
raise RuntimeError, \
"filter parameter should specify a valid filter among `%s'" % \
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment