From 493b073efca1216a6e82d96225809e9b04ae63d5 Mon Sep 17 00:00:00 2001 From: Saleem Ansari Date: Fri, 15 Sep 2017 16:29:31 +0530 Subject: [PATCH 1/2] Fix behavior of map operations for Python3 - which returns iterator instead of a collection --- gofedlib/go/contentmetadataextractor.py | 2 +- gofedlib/go/symbolsextractor/extractor.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gofedlib/go/contentmetadataextractor.py b/gofedlib/go/contentmetadataextractor.py index b3d45cf..34642e1 100644 --- a/gofedlib/go/contentmetadataextractor.py +++ b/gofedlib/go/contentmetadataextractor.py @@ -1,5 +1,5 @@ import os -from lib.utils import runCommand +from gofedlib.utils import runCommand class ContentMetadataExtractor(object): diff --git a/gofedlib/go/symbolsextractor/extractor.py b/gofedlib/go/symbolsextractor/extractor.py index a1bc548..43682b3 100644 --- a/gofedlib/go/symbolsextractor/extractor.py +++ b/gofedlib/go/symbolsextractor/extractor.py @@ -1,10 +1,10 @@ import os import logging import json -from lib.utils import getScriptDir, runCommand +from gofedlib.utils import getScriptDir, runCommand from .coder import GoTypeCoder from ..contentmetadataextractor import ContentMetadataExtractor -from lib.types import ExtractionError +from gofedlib.types import ExtractionError class GoSymbolsExtractor(object): """ @@ -295,7 +295,8 @@ def extract(self): if dir_key not in test_directory_dependencies: test_directory_dependencies[dir_key] = [] - test_directory_dependencies[dir_key] = test_directory_dependencies[dir_key] + map(lambda p: str(p["path"]), go_file_json["imports"]) + import_paths = [str(p["path"]) for p in go_file_json["imports"]] + test_directory_dependencies[dir_key] = test_directory_dependencies[dir_key] + import_paths test_directories.append(dir_info['dir']) continue @@ -325,7 +326,7 @@ def extract(self): # build can contain two different prefixes # but with the same package name. prefix = dir_info["dir"] + ":" + pkg_name - i_paths = map(lambda i: i["path"], go_file_json["imports"]) + i_paths = [i["path"] for i in go_file_json["imports"]] if prefix not in jsons: jsons[prefix] = [go_file_json] package_imports[prefix] = i_paths From 50925399f88117929828ec8e7b0bb9afbe763807 Mon Sep 17 00:00:00 2001 From: Saleem Ansari Date: Mon, 18 Sep 2017 16:18:50 +0530 Subject: [PATCH 2/2] Update import statement --- gofedlib/providers/providerbuilder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gofedlib/providers/providerbuilder.py b/gofedlib/providers/providerbuilder.py index f1cebdd..b574f43 100644 --- a/gofedlib/providers/providerbuilder.py +++ b/gofedlib/providers/providerbuilder.py @@ -1,7 +1,7 @@ from .upstreamprovider import UpstreamProvider import os import json -from lib.utils import getScriptDir +from gofedlib.utils import getScriptDir class ProviderBuilder(object):