292
292
elif count < expect:
296
def object_to_dict(attrnames, obj):
298
Convert an object into a dictionary. This takes a shallow copy of the
300
attrnames: Set (or iterable) of names of attributes to be copied into the
301
dictionary. (We don't auto-lookup, because this function needs to be
302
used on magical objects).
304
return dict((k, getattr(obj, k))
305
for k in attrnames if not k.startswith('_'))