3232import codecs
3333import json
3434import os
35+ # FIXME: why posixpath???
3536import posixpath
36- from posixpath import dirname
3737
3838import yaml
3939import re
6565from attributecode .util import add_unc
6666from attributecode .util import copy_license_notice_files
6767from attributecode .util import on_windows
68- from attributecode .util import ungroup_licenses
6968from attributecode .util import UNC_PREFIX
69+ from attributecode .util import ungroup_licenses
70+ from attributecode .util import unique
7071
7172
7273class Field (object ):
@@ -1275,7 +1276,6 @@ def collect_inventory(location, use_mapping=False, mapping_file=None):
12751276 About objects.
12761277 """
12771278 errors = []
1278- dedup_errors = []
12791279 input_location = util .get_absolute (location )
12801280 about_locations = list (util .get_about_locations (input_location ))
12811281
@@ -1291,11 +1291,7 @@ def collect_inventory(location, use_mapping=False, mapping_file=None):
12911291 errors .append (Error (severity , msg ))
12921292 abouts .append (about )
12931293
1294- # Avoid logging duplicated/same errors multiple times
1295- for about_error in errors :
1296- if not about_error in dedup_errors :
1297- dedup_errors .append (about_error )
1298- return dedup_errors , abouts
1294+ return unique (errors ), abouts
12991295
13001296
13011297def field_names (abouts , with_paths = True , with_absent = True , with_empty = True ):
@@ -1560,7 +1556,7 @@ def verify_license_files_in_location(about, lic_location):
15601556 for lic in about .license_file .value :
15611557 lic_path = util .to_posix (posixpath .join (lic_location , lic ))
15621558 if posixpath .exists (lic_path ):
1563- copy_to = dirname (about .about_file_path )
1559+ copy_to = os . path . dirname (about .about_file_path )
15641560 license_location_dict [copy_to ] = lic_path
15651561 else :
15661562 msg = (u'The license file : '
0 commit comments