def gen_specs(): for fields_tuple in cls.imported_jar_library_spec_fields(): for item in target_representation.get(fields_tuple[field_pos], ()): # For better error handling, this simply skips over non-strings, but we catch them # with a WrongTargetType in JarLibrary.to_jar_dependencies. if not isinstance(item, string_types): raise JarLibrary.ExpectedAddressError( 'expected imports to contain string addresses, got {found_class} instead.' .format(found_class=type(item).__name__)) yield item