in client/commands/initialize.py [0:0]
def _get_configuration() -> Dict[str, Any]:
configuration: Dict[str, Any] = {}
_create_watchman_configuration()
binary_path = shutil.which(BINARY_NAME)
if binary_path is None:
binary_path = shutil.which(
os.path.join(os.path.dirname(sys.argv[0]), BINARY_NAME)
)
if binary_path is None:
binary_path = os.path.abspath(
log.get_input(f"No `{BINARY_NAME}` found, enter the path manually: ")
)
if not os.path.isfile(binary_path):
raise InitializationException(
f"Unable to locate binary at `{binary_path}`."
)
configuration["binary"] = binary_path
else:
LOG.info(f"Binary found at `{binary_path}`")
typeshed: Optional[Path] = find_typeshed()
if typeshed is None:
typeshed = Path(
log.get_input("Unable to locate typeshed, please enter its root: ")
).resolve()
if not typeshed.is_dir():
raise InitializationException(
f"No typeshed directory found at `{typeshed}`."
)
configuration["typeshed"] = str(typeshed)
else:
LOG.info(f"Typeshed found at `{typeshed}``")
taint_models_path = find_taint_models_directory()
if taint_models_path is not None:
configuration["taint_models_path"] = str(taint_models_path)
source_directory_input = log.get_optional_input(
"Which directory(ies) should pyre analyze?", "."
)
source_directory_paths = [
directory.strip() for directory in source_directory_input.split(",")
]
configuration["source_directories"] = [
_create_source_directory_element(path) for path in source_directory_paths
]
return configuration