# Path: src/rosrepo/ui.py
# def pick_dependency_resolution(package_name, pkg_list):
#     if not isatty(sys.stdin):
#         return None
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         return None
#     result = None
#     while result is None:
#         msg("\n@!Dependency resolution for @{cf}%s@|\n" % package_name, fd=fd)
#         msg(
#             "The package is not in your workspace and can be cloned from "
#             "multiple Git repositories. Please pick the one you want:\n\n", fd=fd
#         )
#         for i in range(len(pkg_list)):
#             msg("%3d. %s\n" % (i + 1, pkg_list[i].project.website), fd=fd)
#         msg("%3d. %s\n\n" % (0, "Choose automatically"), fd=fd)
#         try:
#             s = int(readline("--> ", fd=fd))
#             if s == 0:
#                 return None
#             result = pkg_list[s - 1]
#         except (ValueError, IndexError):
#             msg("@!@{rf}Invalid choice@|\n\n", fd=fd)
#     return result
# 
# def warning(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{yf}%s: warning: %s" % (prog, text), use_color=use_color, indent_next=len(prog) + 11)
# 
# def error(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{rf}%s: error: %s" % (prog, text), indent_next=len(prog) + 9)
# 
# def escape(msg):
#     return msg.replace("@", "@@")
# 
# Path: src/rosrepo/util.py
# def yaml_load(stream, Loader=SafeLoader):
# def yaml_dump(data, stream=None, Dumper=SafeDumper, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):
#     def __getitem__(self, item):
#     def __setitem__(self, item, value):
#     def __len__(self):
# def is_deprecated_package(manifest):
# def deprecated_package_info(manifest):
# def path_has_prefix(path, prefix):
# def has_package_path(obj, paths):
# def env_path_list_contains(path_list, path):
# def makedirs(path):
# def write_atomic(filepath, data, mode=0o644, ignore_fail=False):
# def isatty(fd):
# def get_terminal_size():
# def find_program(program):
#     def is_exe(fpath):
# def getmtime(path):
# def call_process(args, bufsize=0, stdin=None, stdout=None, stderr=None, cwd=None, env=None, input_data=None):
# def create_multiprocess_manager():
# def _worker_init(worker_init, worker_init_args):
# def run_multiprocess_workers(worker, workload, worker_init=None, worker_init_args=(), jobs=None, timeout=None):
# class NamedTuple(object):
# class UserError(RuntimeError):


from .ui import pick_dependency_resolution, warning, error, escape
from .util import is_deprecated_package, call_process, PIPE, iteritems
from distutils.version import LooseVersion as ManifestVersion
            from . import dummy_pkg_resources
            from rosdep2.lookup import RosdepLookup
            from rosdep2.rospkg_loader import DEFAULT_VIEW_KEY
            from rosdep2 import get_default_installer, create_default_installer_context
                from rosdep2.lookup import ResolutionError
import platform
import gc
            import sys
                    resolver_msgs.append("is dependee of package @{cf}%s@|" % escape(depender))
                if root_depender is None:
                    root_depender = name
                candidates = find_package_candidates(name, ws_state, resolver_msgs)
                for pkg, source in candidates:
                    if source not in [P_WS, P_REMOTE] and depender is None and force_workspace:
                        continue  # Ignore other sources if primary depender should be a workspace package
                    if source == P_REMOTE:
                        if pkg.project in ws_state.ws_projects:
                            resolver_msgs.append("missing from @{cf}%s/@| (maybe you need to @{cf}git pull@|?)" % escape(pkg.project.workspace_path))
                            continue  # Fail, try next
                        # Check all other packages in the same project for conflicts
                        ok = True
                        for other in pkg.project.packages:
                            # Is the other package in the workspace already?
                            if other.manifest.name in ws_state.ws_packages:
                                resolver_msgs.append("cannot be cloned from @{cf}%s@| because package @{cf}%s@| is in the workspace already" % (escape(pkg.project.name), escape(other.manifest.name)))
                                ok = False
                                break  # Fail
                            # If not, check if we already decided to download
                            # the package from another project
                            if other.manifest.name in depends:
                                # Is it the same project?
                                if other.project != pkg.project:
                                    resolver_msgs.append("cannot be cloned from @{cf}%s@| because it contains package @{cf}%s@| which will be cloned from @{cf}%s@|" % (escape(pkg.project.name), escape(other.manifest.name), escape(other.project.name)))
                                    ok = False
                                    break  # Fail
                        if not ok:
                            continue  # Fail, try next
                    # If we got to this point, the package can be used to resolve the dependency

# Path: src/rosrepo/ui.py
# def pick_dependency_resolution(package_name, pkg_list):
#     if not isatty(sys.stdin):
#         return None
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         return None
#     result = None
#     while result is None:
#         msg("\n@!Dependency resolution for @{cf}%s@|\n" % package_name, fd=fd)
#         msg(
#             "The package is not in your workspace and can be cloned from "
#             "multiple Git repositories. Please pick the one you want:\n\n", fd=fd
#         )
#         for i in range(len(pkg_list)):
#             msg("%3d. %s\n" % (i + 1, pkg_list[i].project.website), fd=fd)
#         msg("%3d. %s\n\n" % (0, "Choose automatically"), fd=fd)
#         try:
#             s = int(readline("--> ", fd=fd))
#             if s == 0:
#                 return None
#             result = pkg_list[s - 1]
#         except (ValueError, IndexError):
#             msg("@!@{rf}Invalid choice@|\n\n", fd=fd)
#     return result
# 
# def warning(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{yf}%s: warning: %s" % (prog, text), use_color=use_color, indent_next=len(prog) + 11)
# 
# def error(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{rf}%s: error: %s" % (prog, text), indent_next=len(prog) + 9)
# 
# def escape(msg):
#     return msg.replace("@", "@@")
# 
# Path: src/rosrepo/util.py
# def yaml_load(stream, Loader=SafeLoader):
# def yaml_dump(data, stream=None, Dumper=SafeDumper, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):
#     def __getitem__(self, item):
#     def __setitem__(self, item, value):
#     def __len__(self):
# def is_deprecated_package(manifest):
# def deprecated_package_info(manifest):
# def path_has_prefix(path, prefix):
# def has_package_path(obj, paths):
# def env_path_list_contains(path_list, path):
# def makedirs(path):
# def write_atomic(filepath, data, mode=0o644, ignore_fail=False):
# def isatty(fd):
# def get_terminal_size():
# def find_program(program):
#     def is_exe(fpath):
# def getmtime(path):
# def call_process(args, bufsize=0, stdin=None, stdout=None, stderr=None, cwd=None, env=None, input_data=None):
# def create_multiprocess_manager():
# def _worker_init(worker_init, worker_init_args):
# def run_multiprocess_workers(worker, workload, worker_init=None, worker_init_args=(), jobs=None, timeout=None):
# class NamedTuple(object):
# class UserError(RuntimeError):


# Path: src/rosrepo/resolver.py
from .ui import pick_dependency_resolution, warning, error, escape
from .util import is_deprecated_package, call_process, PIPE, iteritems
from distutils.version import LooseVersion as ManifestVersion
            from . import dummy_pkg_resources
            from rosdep2.lookup import RosdepLookup
            from rosdep2.rospkg_loader import DEFAULT_VIEW_KEY
            from rosdep2 import get_default_installer, create_default_installer_context
                from rosdep2.lookup import ResolutionError
import platform
import gc
            import sys

                    resolver_msgs.append("is dependee of package @{cf}%s@|" % escape(depender))
                if root_depender is None:
                    root_depender = name
                candidates = find_package_candidates(name, ws_state, resolver_msgs)
                for pkg, source in candidates:
                    if source not in [P_WS, P_REMOTE] and depender is None and force_workspace:
                        continue  # Ignore other sources if primary depender should be a workspace package
                    if source == P_REMOTE:
                        if pkg.project in ws_state.ws_projects:
                            resolver_msgs.append("missing from @{cf}%s/@| (maybe you need to @{cf}git pull@|?)" % escape(pkg.project.workspace_path))
                            continue  # Fail, try next
                        # Check all other packages in the same project for conflicts
                        ok = True
                        for other in pkg.project.packages:
                            # Is the other package in the workspace already?
                            if other.manifest.name in ws_state.ws_packages:
                                resolver_msgs.append("cannot be cloned from @{cf}%s@| because package @{cf}%s@| is in the workspace already" % (escape(pkg.project.name), escape(other.manifest.name)))
                                ok = False
                                break  # Fail
                            # If not, check if we already decided to download
                            # the package from another project
                            if other.manifest.name in depends:
                                # Is it the same project?
                                if other.project != pkg.project:
                                    resolver_msgs.append("cannot be cloned from @{cf}%s@| because it contains package @{cf}%s@| which will be cloned from @{cf}%s@|" % (escape(pkg.project.name), escape(other.manifest.name), escape(other.project.name)))
                                    ok = False
                                    break  # Fail
                        if not ok:
                            continue  # Fail, try next
                    # If we got to this point, the package can be used to resolve the dependency

                    if source in [P_WS, P_REMOTE]: