Iter over adapter in predictable way
977662
def iter_adapters():
    ''''''
    adapters = adapter_catalog.values()
    return sorted(adapters, key=lambda a: a.model.__name__)
993642
def _iter_config_props(cls):
        
        props = inspect.getmembers(cls, lambda a: isinstance(a, ConfigProperty))
        for attr_name, config_prop in props:
            yield attr_name, config_prop
1009388
function iter(obj, each) {
  if (!obj || typeof obj !== 'object') { return ''; }

  let output = '';
  const keys = Object.keys(obj);
  const length = keys.length;

  for (let i = 0; i < length; i += 1) {
    const key = keys[i];
    output += each(key, i, length, obj[key]);
  }

  return output;
}
426222
def iter(context, resource, **kwargs):
    """"""
    data = utils.sanitize_kwargs(**kwargs)
    id = data.pop('id', None)
    subresource = data.pop('subresource', None)
    data['limit'] = data.get('limit', 20)

    if subresource:
        uri = '%s/%s/%s/%s' % (context.dci_cs_api, resource, id, subresource)
        resource = subresource
    else:
        uri = '%s/%s' % (context.dci_cs_api, resource)

    data['offset'] = 0
    while True:
        j = context.session.get(uri, timeout=HTTP_TIMEOUT, params=data).json()
        if len(j[resource]):
            for i in j[resource]:
                yield i
        else:
            break
        data['offset'] += data['limit']
1317705
def constant_outfile_iterator(outfiles, infiles, arggroups):
    """"""
    assert len(infiles) == 1
    assert len(arggroups) == 1

    return ((outfile, infiles[0], arggroups[0]) for outfile in outfiles)
771843
def iter_for_anchor(self, anchor):
        """"""
        return (subtotal for subtotal in self._subtotals if subtotal.anchor == anchor)
1258846
def iter_intersecting(self, iterable, key=None, descending=False):
        
        return _ContainsVersionIterator(self, iterable, key, descending,
            mode=_ContainsVersionIterator.MODE_INTERSECTING)
80254
function (iter, fn) {
      return new Promise(function (resolve) {
        var i = 0;
        function next() {
          return iter.next().then(function (result) {
            if (result.done) {
              return result.value;
            }
            fn(result.value, i++);
            return next();
          });
        }
        resolve(next());
      });
    }
379726
function initAdapters(container) {

        var calls = [];

        if (container === 'webserver') {
            _.each(adapters, function (adapter) {
                if (adapter.webInit) {
                    calls.push(adapter.webInit);
                }
            });
        }
        else {
            _.each(adapters, function (adapter) {
                if (adapter.init) {
                    calls.push(adapter.init);
                }
            });
        }

        return chainPromises(calls, config)
            .then(function (returnConfig) {
                if (returnConfig) {
                    return returnConfig;
                }
                else {
                    throw new Error('An adapter in the chain is not returning the config.');
                }
            });
    }
1031511
function use(adapter) {
  if (~adapters.indexOf(adapter)) return false;

  adapters.push(adapter);
  return true;
}
830098
def _find_adapter(registry, ob):
    """"""
    types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob))))
    for t in types:
        if t in registry:
            return registry[t]
480196
def iter_causes(self):
        """"""
        curr = self._cause
        while curr is not None:
            yield curr
            curr = curr._cause
997025
def _iter_restrict(self, zeros, ones):
        """"""
        inputs = list(self.inputs)
        unmapped = dict()
        for i, v in enumerate(self.inputs):
            if v in zeros:
                inputs[i] = 0
            elif v in ones:
                inputs[i] = 1
            else:
                unmapped[v] = i
        vs = sorted(unmapped.keys())
        for num in range(1 << len(vs)):
            for v, val in boolfunc.num2point(num, vs).items():
                inputs[unmapped[v]] = val
            yield sum((val << i) for i, val in enumerate(inputs))
994412
def generate_adapter(adapter, name='url_for', map_name='url_map'):
    """"""
    values = {
        u'server_name':     dumps(adapter.server_name),
        u'script_name':     dumps(adapter.script_name),
        u'subdomain':       dumps(adapter.subdomain),
        u'url_scheme':      dumps(adapter.url_scheme),
        u'name':            name,
        u'map_name':        map_name
    }
    return u'''\
var %(name)s = %(map_name)s(
    %(server_name)s,
    %(script_name)s,
    %(subdomain)s,
    %(url_scheme)s
);''' % values
368356
function iterDeps(method, obj, depKey, seen, meta) {

  var guid = guidFor(obj);
  if (!seen[guid]) seen[guid] = {};
  if (seen[guid][depKey]) return;
  seen[guid][depKey] = true;

  var deps = meta.deps;
  deps = deps && deps[depKey];
  if (deps) {
    for(var key in deps) {
      if (DEP_SKIP[key]) continue;
      method(obj, key);
    }
  }
}
632977
def iteryaml(self, *args, **kwargs):
        """"""
        from rowgenerators.rowpipe.json import VTEncoder
        import yaml

        if 'cls' not in kwargs:
            kwargs['cls'] = VTEncoder

        for s in self.iterstruct:
            yield (yaml.safe_dump(s))
1118670
def chain(*args):
    """"""
    has_iter = partial(hasattr, name='__iter__')
    # check if a single iterable is being passed for
    # the case that it's a generator of generators
    if len(args) == 1 and hasattr(args[0], '__iter__'):
        args = args[0]

    for arg in args:
        # if the arg is iterable
        if hasattr(arg, '__iter__'):
            # iterate through it
            for i in arg:
                yield i
        # otherwise
        else:
            # yield the whole argument
            yield arg