

def dedup_sourceresource(doc):
    ''' Look for duplicate values in the doc['sourceResource'] and 
    remove.
    Values must be *exactly* the same
    '''
    for key, value in doc['sourceResource'].items():
        if not isinstance(value, basestring):
            new_list = []
            for item in value:
                if item not in new_list:
                    new_list.append(item)
            doc['sourceResource'][key] = new_list
    return doc



def dedup_sourceresource(doc):
    ''' Look for duplicate values in the doc['sourceResource'] and 
    remove.
    Values must be *exactly* the same
    '''
    for key, value in doc['sourceResource'].items():
        if isinstance(value, list):
            # can't use set() because of dict values (non-hashable)
            new_list = []
            for item in value:
                if item not in new_list:
                    new_list.append(item)
            doc['sourceResource'][key] = new_list
    return doc

Make sure dedup item is a list.
Make sure dedup item is a list.

  
  
  def dedup_sourceresource(doc):
      ''' Look for duplicate values in the doc['sourceResource'] and 
      remove.
      Values must be *exactly* the same
      '''
      for key, value in doc['sourceResource'].items():
-         if not isinstance(value, basestring):
+         if isinstance(value, list):
+             # can't use set() because of dict values (non-hashable)
              new_list = []
              for item in value:
                  if item not in new_list:
                      new_list.append(item)
              doc['sourceResource'][key] = new_list
      return doc
  
Make sure dedup item is a list.
## Code Before:


def dedup_sourceresource(doc):
    ''' Look for duplicate values in the doc['sourceResource'] and 
    remove.
    Values must be *exactly* the same
    '''
    for key, value in doc['sourceResource'].items():
        if not isinstance(value, basestring):
            new_list = []
            for item in value:
                if item not in new_list:
                    new_list.append(item)
            doc['sourceResource'][key] = new_list
    return doc

## Instruction:
Make sure dedup item is a list.
## Code After:


def dedup_sourceresource(doc):
    ''' Look for duplicate values in the doc['sourceResource'] and 
    remove.
    Values must be *exactly* the same
    '''
    for key, value in doc['sourceResource'].items():
        if isinstance(value, list):
            # can't use set() because of dict values (non-hashable)
            new_list = []
            for item in value:
                if item not in new_list:
                    new_list.append(item)
            doc['sourceResource'][key] = new_list
    return doc
