Alias for :meth:`compose`.
514067
def message(self, to, subject, text):
        """"""
        return self.compose(to, subject, text)
355220
def compose(*decorators):
    
    def composed(f):
        for decor in reversed(decorators):
            f = decor(f)
        return f
    return composed
240568
def compose(*functions):
    

    def _compose2(f, g):  # pylint: disable=invalid-name
        return lambda x: f(g(x))

    return functools.reduce(_compose2, functions, lambda x: x)
170187
def main():
    """"""
    parser = argparse.ArgumentParser(description='Compose a yaml file.')
    parser.add_argument(
        'root',
        type=argparse.FileType('r'),
        help='The root yaml file to compose.'
    )

    args = parser.parse_args()

    result = yaml.load(args.root, Loader=ComposeLoader)

    print(yaml.dump(result))
91213
def composeWord(key, value):
    
    mapping = {True: 'yes', False: 'no'}
    # this is necesary because 1 == True, 0 == False
    if type(value) == int:
        value = str(value)
    else:
        value = mapping.get(value, str(value))
    return '={}={}'.format(key, value)
789230
def create_alias(self, alias_name):
        """"""

        return self._es_conn.indices.put_alias(index=self._es_index, name=alias_name)
922993
def compose(self, other):
        ''''''
        @Parser
        def compose_parser(text, index):
            res = self(text, index)
            return res if not res.status else other(text, res.index)
        return compose_parser
1122953
function rewriteDockerCompose(compose) {
  const services = compose.services;
  if (!services) {
    return compose;
  }
  const host = services._host;
  delete services._host;
  Object.keys(services).forEach((k) => {
    if (!isHelperContainer(k)) {
      mergeWith(services[k], host);
    }
  });
  return compose;
}
248725
def _compose(self, name, args, mkdir=True):
        """"""
        from os.path import normpath
        from ambry.dbexceptions import ConfigurationError

        root = p = self._config.filesystem[name].format(root=self._root)

        if args:
            args = [e.strip() for e in args]
            p = join(p, *args)

        if not isdir(p) and mkdir:
            makedirs(p)

        p = normpath(p)

        if not p.startswith(root):
            raise ConfigurationError("Path for name='{}', args={} resolved outside of define filesystem root"
                                 .format(name, args))

        return p
278625
def compose(self, *args, **kwargs):
        
        from psd_tools.api.composer import compose_layer
        if self.bbox == (0, 0, 0, 0):
            return None
        return compose_layer(self, *args, **kwargs)
515794
def xdg_compose(to, subject, body=None, cc=None, bcc=None):
    
    command = ["xdg-email", "--utf8", "--subject", subject]

    if body:
        command += ["--body", body]
    if cc:
        if type(cc) is list:
            cc = ", ".join(cc)
        command += ["--cc", cc]
    if bcc:
        if type(bcc) is list:
            bcc = ", ".join(bcc)
        command += ["--bcc", bcc]
    if type(to) is list:
        to = ", ".join(to)
    command.append(to)
    return subprocess.call(command)
478257
def compose(self, data):
        
        g = self.__separate(data) if self.__cgr_type in (1, 2, 3, 4, 5, 6) else self.__condense(data)
        g.meta.update(data.meta)
        return g
313003
def compose(*funcs):
    
    # slightly optimized for most common cases and hence verbose
    if len(funcs) == 2: f0,f1=funcs; return lambda *a,**kw: f0(f1(*a,**kw))
    elif len(funcs) == 3: f0,f1,f2=funcs; return lambda *a,**kw: f0(f1(f2(*a,**kw)))
    elif len(funcs) == 0: return lambda x:x     # XXX single kwarg
    elif len(funcs) == 1: return funcs[0]
    else:
        def composed(*args,**kwargs):
            y = funcs[-1](*args,**kwargs)
            for f in funcs[:0:-1]: y = f(y)
            return y
        return composed
573636
function compose(middlewares, options = {}) {
  const { beforeRunMiddleware } = options;// before invoking the middleware, check whether can be run

  // all middleware should be function
  if (!Array.isArray(middlewares)) middlewares = [middlewares];
  for (const mw of middlewares) {
    if (typeof mw !== 'function') throw new TypeError('middleware should be a function');
  }

  return function ComposedMiddleware(req, resp, next) {
    let doRunMiddleware;

    let lastIndex = -1;// last run middleware index
    const runMiddleware = (index) => {
      if (lastIndex >= index) {
        return Promise.reject(new Error('next() called multiple times'));
      }
      lastIndex = index;

      const middleware = middlewares[index];
      if (middleware && beforeRunMiddleware) {
        return Promise.resolve(beforeRunMiddleware(middleware, req, resp)).then((canRun) => {
          if (!canRun) return runMiddleware(index + 1);
          else return doRunMiddleware(index);
        });
      }

      return doRunMiddleware(index);
    };

    doRunMiddleware = (index) => {
      let middleware = middlewares[index];
      const nextIndex = index + 1;

      let runNextMiddleware = noop;
      if (!middleware) {
        if (next) middleware = next;
      } else if (middlewares[nextIndex] || next) {
        runNextMiddleware = () => runMiddleware(nextIndex);
      }

      try {
        let result;
        if (middleware) result = middleware.call(this, req, resp, runNextMiddleware);
        return Promise.resolve(result);
      } catch (e) {
        return Promise.reject(e);
      }
    };

    return runMiddleware(0);
  };
}
1219267
def _generateAlias(self):
        """"""
        for i in range(1000):
            alias = 'cust%d' % (i, )
            if alias not in self.auth_level_aliases:
                return alias

        raise RuntimeError('Could not find an unused alias (tried 1000!)')
396856
def _compose_func(func, args_func=lambda req_info: [req_info.index]):
    
    return FuncInfo(func=func, args_func=args_func)
1151236
def compose(self, type, data):
        
        try:
            return self.registered_formats[type]['composer'](data)
        except KeyError:
            raise NotImplementedError("No composer found for "
                                      "type '{type}'".format(type=type))