Given an invocation command,
        return the absolute path to the command. This works even if commnad
        has not path element and is present in PATH.
350451
def get_absolute_tool_path(command):
    
    assert isinstance(command, basestring)
    if os.path.dirname(command):
        return os.path.dirname(command)
    else:
        programs = path.programs_path()
        m = path.glob(programs, [command, command + '.exe' ])
        if not len(m):
            if __debug_configuration:
                print "Could not find:", command, "in", programs
            return None
        return os.path.dirname(m[0])
993910
def relative_to_absolute(path)
      if Pathname.new(path).absolute?
        Pathname.new(path)
      else
        Pathname.new("#{Pathname.pwd}/#{path}")
      end
    end
1289192
def resolved_path(path, base=None):
    
    if not path or path.startswith(SYMBOLIC_TMP):
        return path

    path = os.path.expanduser(path)
    if base and not os.path.isabs(path):
        return os.path.join(resolved_path(base), path)

    return os.path.abspath(path)
4030
def get_invoke(command):
    

    assert isinstance(command, click.Command)

    def invoke_(self, arg):  # pylint: disable=unused-argument
        try:
            command.main(args=shlex.split(arg),
                         prog_name=command.name,
                         standalone_mode=False,
                         parent=self.ctx)
        except click.ClickException as e:
            # Show the error message
            e.show()
        except click.Abort:
            # We got an EOF or Keyboard interrupt.  Just silence it
            pass
        except SystemExit:
            # Catch this an return the code instead. All of click's help commands do a sys.exit(),
            # and that's not ideal when running in a shell.
            pass
        except Exception as e:
            traceback.print_exception(type(e), e, None)
            logger.warning(traceback.format_exc())

        # Always return False so the shell doesn't exit
        return False

    invoke_ = update_wrapper(invoke_, command.callback)
    invoke_.__name__ = 'do_%s' % command.name
    return invoke_
669349
def abspath(self, path):
        """"""

        def getcwd():
            """Return the current working directory."""
            # pylint: disable=undefined-variable
            if IS_PY2 and isinstance(path, text_type):
                return self.os.getcwdu()
            elif not IS_PY2 and isinstance(path, bytes):
                return self.os.getcwdb()
            else:
                return self.os.getcwd()

        path = make_string_path(path)
        sep = self.filesystem._path_separator(path)
        altsep = self.filesystem._alternative_path_separator(path)
        if not self.isabs(path):
            path = self.join(getcwd(), path)
        elif (self.filesystem.is_windows_fs and
              path.startswith(sep) or altsep is not None and
              path.startswith(altsep)):
            cwd = getcwd()
            if self.filesystem._starts_with_drive_letter(cwd):
                path = self.join(cwd[:2], path)
        return self.normpath(path)
355167
def path(path_name=None, override=None, *, root=None, name=None, ext=None,
         inject=None, relpath=None, reduce=False):
    
    path_name, identity, root = _initialize(path_name, override, root, inject)
    new_name = _process_name(path_name, identity, name, ext)
    new_directory = _process_directory(path_name, identity, root, inject)
    full_path = os.path.normpath(os.path.join(new_directory, new_name))
    if APPEND_SEP_TO_DIRS and not new_name and full_path[-1] != os.sep:
        full_path += os.sep
    final_path = _format_path(full_path, root, relpath, reduce)
    return final_path
71586
def _path(action=nil)
      # Use the absolute path if present, otherwise get the relative path
      pre_action_paths =
        if defined?(self.class::ABSOLUTE_PATH)
          [self.class::ABSOLUTE_PATH]
        else
          _path_array
        end
      # Join it with the action
      paths = pre_action_paths + [action]
      # Strip out empty elements
      paths = paths.map(&:to_s).reject(&:empty?)
      "/#{paths.join('/')}"
    end
1336281
def cont_path(self, path):
        
        if path.startswith("/"):
            path = path[1:]
        real_path = os.path.join(self.mount_point, path)
        logger.debug("path = %s", real_path)
        return real_path
798604
def abspath(self, path):
        """"""
        return os.path.abspath(os.path.join(os.path.dirname(self.path), path))
210936
def _get_base_command(self):
        
        command_parts = []
        cd_command = ''.join(['cd ', str(self.WorkingDir), ';'])
        if self._command is None:
            raise ApplicationError('_command has not been set.')
        command = self._command
        parameters = sorted([str(x) for x in self.Parameters.values()
                            if str(x)])

        synonyms = self._synonyms

        command_parts.append(cd_command)
        command_parts.append(command)
        command_parts.append(self._database)  # Positional argument
        command_parts.append(self._query)  # Positional argument
        command_parts += parameters
        if self._output:
            command_parts.append(self._output.Path)  # Positional

        return (
            self._command_delimiter.join(filter(None, command_parts)).strip()
        )
539389
def _get_base_command(self):
        
        cd_command = ''.join(['cd ', str(self.WorkingDir), ';'])
        jvm_command = "java"
        jvm_arguments = self._commandline_join(
            [self.Parameters[k] for k in self._jvm_parameters])
        jar_arguments = '-jar "%s"' % self._get_jar_fp()
        rdp_arguments = self._commandline_join(
            [self.Parameters[k] for k in self._options])

        command_parts = [
            cd_command, jvm_command, jvm_arguments, jar_arguments,
            rdp_arguments, '-q']
        return self._commandline_join(command_parts).strip()
775822
def _get_relative_path(self):
    """"""
    param_string = self._get_query_string()
    if self.path is None:
      path = '/'
    else:
      path = self.path
    if param_string:
      return '?'.join([path, param_string])
    else:
      return path
1019976
def which(cls, cmd):
        
        abs_path_cmd = None
        if sys.version_info >= (3, 3):
            abs_path_cmd = shutil.which(cmd)
        else:
            abs_path_cmd = find_executable(cmd)
        return abs_path_cmd
1137737
def absolute_path(self, path, start):
        
        if posixpath.isabs(path):
            path = posixpath.join(staticfiles_storage.location, path)
        else:
            path = posixpath.join(start, path)
        return posixpath.normpath(path)
343741
def pathExists(self, path):
        
        def commandComplete(cmd):
            return not cmd.didFail()

        return self.runRemoteCommand('stat', {'file': path,
                                              'logEnviron': self.logEnviron, },
                                     abandonOnFailure=False,
                                     evaluateCommand=commandComplete)
1296610
def get_command(self, ctx: click.Context, name: str) -> click.Command:
        
        info = ctx.ensure_object(ScriptInfo)
        command = None
        try:
            command = info.load_app().cli.get_command(ctx, name)
        except NoAppException:
            pass
        if command is None:
            command = super().get_command(ctx, name)
        return command
769086
def get_invocation_command(toolset, tool, user_provided_command = [],
                           additional_paths = [], path_last = False):
    
    assert isinstance(toolset, basestring)
    assert isinstance(tool, basestring)
    assert is_iterable_typed(user_provided_command, basestring)
    assert is_iterable_typed(additional_paths, basestring) or additional_paths is None
    assert isinstance(path_last, (int, bool))

    result = get_invocation_command_nodefault(toolset, tool,
                                              user_provided_command,
                                              additional_paths,
                                              path_last)

    if not result:
        if user_provided_command:
            result = user_provided_command[0]
        else:
            result = tool

    assert(isinstance(result, str))

    return result