Decorator wrapper for salt.utils.path.which
336175
def which(exe):
    '''
    
    '''
    def wrapper(function):
        def wrapped(*args, **kwargs):
            if salt.utils.path.which(exe) is None:
                raise CommandNotFoundError(
                    'The \'{0}\' binary was not found in $PATH.'.format(exe)
                )
            return function(*args, **kwargs)
        return identical_signature_wrapper(function, wrapped)
    return wrapper
1188902
def _get_ipmitool_path(self, cmd='ipmitool'):
        
        p = subprocess.Popen(["which", cmd], 
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)                
        out, err =  p.communicate()
        return out.strip()
1317652
function(items, path, state) {
              return build(items, decorator, templateFn, slots, path, state, lookup);
            }
918946
def path(self, which=None):
        
        if which in ('refresh',):
            return '{0}/{1}'.format(
                super(SmartProxy, self).path(which='self'),
                which
            )
        return super(SmartProxy, self).path(which)
1014399
def path_for(self, handler, **kwargs):
        
        if type(handler) is not str:
            handler = handler.__qualname__
        if handler not in self.__reversedidx__:
            return None
        pattern = self.__reversedidx__[handler].pattern.lstrip('^').rstrip('$')
        path = self.param_macher.sub(lambda m: str(kwargs.pop(m.group(1))),
                                     pattern)
        if kwargs:
            path = "%s?%s" % (path, parse.urlencode(kwargs))
        return path
246753
def map_run(self, path=None, **kwargs):
        '''
        
        '''
        kwarg = {}
        if path:
            kwarg['map'] = path
        kwarg.update(kwargs)
        mapper = salt.cloud.Map(self._opts_defaults(**kwarg))
        dmap = mapper.map_data()
        return salt.utils.data.simple_types_filter(
            mapper.run_map(dmap)
        )
645859
def which(filename, env=None):
    ''''''

    # Special case where filename contains an explicit path.
    if os.path.dirname(filename) != '' and is_executable_file(filename):
        return filename
    if env is None:
        env = os.environ
    p = env.get('PATH')
    if not p:
        p = os.defpath
    pathlist = p.split(os.pathsep)
    for path in pathlist:
        ff = os.path.join(path, filename)
        if is_executable_file(ff):
            return ff
    return None
1299559
def which(name, flags=os.X_OK):
    
    result = []
    exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
    path = os.environ.get('PATH', None)
    if path is None:
        return []
    for p in os.environ.get('PATH', '').split(os.pathsep):
        p = os.path.join(p, name)
        if os.access(p, flags):
            result.append(p)
        for e in exts:
            pext = p + e
            if os.access(pext, flags):
                result.append(pext)
    return result
115268
def get_scope_path(cls, scope_separator="::"):
        
        if cls.get_parent_scope() is None:
            return ""
        elif isinstance(cls.get_parent_scope(), comp.Root):
            return ""
        else:
            parent_path = cls.get_parent_scope().get_scope_path(scope_separator)
            if parent_path:
                return(
                    parent_path
                    + scope_separator
                    + cls.get_parent_scope().type_name
                )
            else:
                return cls.get_parent_scope().type_name
1286479
def _getattr_path(obj, path):
    
    if not path:
        return None

    for attr in path.split('.'):
        obj = getattr(obj, attr, None)
    return obj
1330868
def _find_file(self, path, saltenv='base'):
        '''
        
        '''
        fnd = {'path': '',
               'rel': ''}

        if salt.utils.url.is_escaped(path):
            # The path arguments are escaped
            path = salt.utils.url.unescape(path)
        for root in self.opts['pillar_roots'].get(saltenv, []):
            full = os.path.join(root, path)
            if os.path.isfile(full):
                fnd['path'] = full
                fnd['rel'] = path
                return fnd
        return fnd
592484
def path_wrapper(func):
    

    @functools.wraps(func)
    def wrapped(node, context=None, _func=func, **kwargs):
        """wrapper function handling context"""
        if context is None:
            context = contextmod.InferenceContext()
        if context.push(node):
            return None

        yielded = set()
        generator = _func(node, context, **kwargs)
        try:
            while True:
                res = next(generator)
                # unproxy only true instance, not const, tuple, dict...
                if res.__class__.__name__ == "Instance":
                    ares = res._proxied
                else:
                    ares = res
                if ares not in yielded:
                    yield res
                    yielded.add(ares)
        except StopIteration as error:
            if error.args:
                return error.args[0]
            return None

    return wrapped
1056353
def path(self, args, kw):
        """"""
        params = self._pop_params(args, kw)
        if args or kw:
            raise InvalidArgumentError("Extra parameters (%s, %s) when building path for %s" % (args, kw, self.template))
        return self.build_url(**params)
1359703
def path(self, which=None):
        
        if which:
            return '{0}/{1}'.format(
                super(Template, self).path(which='base'), which)
        return super(Template, self).path(which)
76720
def path_join(*args):
    
    args = (paramiko.py3compat.u(arg) for arg in args)
    return os.path.join(*args)
341290
def path_helper(self, path, view, **kwargs):
        
        super(FlaskRestyPlugin, self).path_helper(
            path=path,
            view=view,
            **kwargs
        )

        resource = self.get_state().views[view]
        rule = self._rules[resource.rule]

        operations = defaultdict(Operation)
        view_instance = view()
        view_instance.spec_declaration(view, operations, self)

        # add path arguments
        parameters = []
        for arg in rule.arguments:
            parameters.append({
                'name': arg,
                'in': 'path',
                'required': True,
                'type': 'string',
            })
        if parameters:
            operations['parameters'] = parameters

        path.path = FlaskPlugin.flaskpath2openapi(resource.rule)
        path.operations = dict(**operations)
1087212
def _resolve_path(obj, path=None):
        
        if path:
            for attr_name in path.split('__'):
                obj = getattr(obj, attr_name)
        return obj