Generates the chunks of lowdata from the list of modules
346822
def _compile_state(sls_opts, mods=None):
    '''
    
    '''
    st_ = HighState(sls_opts)

    if not mods:
        return st_.compile_low_chunks()

    high_data, errors = st_.render_highstate({sls_opts['saltenv']: mods})
    high_data, ext_errors = st_.state.reconcile_extend(high_data)
    errors += ext_errors
    errors += st_.state.verify_high(high_data)
    if errors:
        return errors

    high_data, req_in_errors = st_.state.requisite_in(high_data)
    errors += req_in_errors
    high_data = st_.state.apply_exclude(high_data)
    # Verify that the high data is structurally sound
    if errors:
        return errors

    # Compile and verify the raw chunks
    return st_.state.compile_high_data(high_data)
1367629
def iterate_chunks(i, size=10):
    
    accumulator = []

    for n, i in enumerate(i):
        accumulator.append(i)
        if (n+1) % size == 0:
            yield accumulator
            accumulator = []

    if accumulator:
        yield accumulator
586249
def chunk_data(data, chunkSize):
    '''
        
    '''
    chunkSize = int(chunkSize)
    return [data[i : i + chunkSize] for i in range(0, len(data), chunkSize)]
981459
def chunk_list(items, size):
    
    size = max(1, size)
    return [items[i:i + size] for i in range(0, len(items), size)]
1078548
def chunks(data, size):
    
    for i in range(0, len(data), size):
        yield data[i:i + size]
166307
def chunks(iterable, chunk):
    """"""
    for i in range(0, len(iterable), chunk):
        yield iterable[i:i + chunk]
1178614
def list_chunks(l, n):
    
    if n < 1:
        n = 1
    return [l[i:i + n] for i in range(0, len(l), n)]
1165645
function generateModuleAst(moduleInfo) {
    var dependenciesExpr;
    var actualDependencies = moduleInfo.actualDependencies;
    var dependencies = (moduleInfo.dependencies || []).slice(0);

    if (actualDependencies instanceof Array) {
        dependenciesExpr = {
            type: SYNTAX.ArrayExpression,
            elements: []
        };

        var diffDependencies = subtract(
            actualDependencies,
            intersect(dependencies, actualDependencies)
        );
        dependencies.concat(diffDependencies).forEach(function (dependency) {
            dependenciesExpr.elements.push({
                type: SYNTAX.Literal,
                value: dependency,
                raw: '\'' + dependency + '\''
            });
        });
    }

    var defineArgs = [moduleInfo.factoryAst];
    if (dependenciesExpr) {
        defineArgs.unshift(dependenciesExpr);
    }
    var id = moduleInfo.id;
    if (id) {
        defineArgs.unshift({
            type: SYNTAX.Literal,
            value: moduleInfo.id,
            raw: '\'' + moduleInfo.id + '\''
        });
    }

    return {
        type: SYNTAX.CallExpression,
        callee: {
            type: SYNTAX.Identifier,
            name: LITERAL_DEFINE
        },
        arguments: defineArgs
    };
}
908839
def chunker(ensemble_list, ncpu):
    

    # determine sublist lengths
    length = int(len(ensemble_list) / ncpu)

    # generator
    for i in range(0, len(ensemble_list), length):
        yield ensemble_list[i:i + length]
113812
def dumps(self):
        """"""
        return [self.__class__.__name__.lower(), [x.dumps() for x in self.ts]]
1112883
def chunks(some_list: List, n: int) -> Iterable[List]:
    """"""
    for i in range(0, len(some_list), n):
        yield some_list[i:i + n]
1135297
def run_chunked(self):
        '''
        
        '''
        files, empty_dirs = self._list_files()
        dest = self.opts['dest']
        gzip = self.opts['gzip']
        tgt = self.opts['tgt']
        timeout = self.opts['timeout']
        selected_target_option = self.opts.get('selected_target_option')

        dest_is_dir = bool(empty_dirs) \
            or len(files) > 1 \
            or bool(re.search(r'[\\/]$', dest))

        reader = salt.utils.gzip_util.compress_file \
            if gzip \
            else salt.utils.itertools.read_file

        _res = salt.utils.minions.CkMinions(self.opts).check_minions(
            tgt,
            tgt_type=selected_target_option or 'glob')
        minions = _res['minions']

        local = salt.client.get_local_client(self.opts['conf_file'])

        def _get_remote_path(fn_):
            if fn_ in self.opts['src']:
                # This was a filename explicitly passed on the CLI
                return os.path.join(dest, os.path.basename(fn_)) \
                    if dest_is_dir \
                    else dest
            else:
                for path in self.opts['src']:
                    relpath = os.path.relpath(fn_, path + os.sep)
                    if relpath.startswith(parent):
                        # File is not within this dir
                        continue
                    return os.path.join(dest, os.path.basename(path), relpath)
                else:  # pylint: disable=useless-else-on-loop
                    # Should not happen
                    log.error('Failed to find remote path for %s', fn_)
                    return None

        ret = {}
        parent = '..' + os.sep
        for fn_, mode in six.iteritems(files):
            remote_path = _get_remote_path(fn_)

            index = 1
            failed = {}
            for chunk in reader(fn_, chunk_size=self.opts['salt_cp_chunk_size']):
                chunk = base64.b64encode(salt.utils.stringutils.to_bytes(chunk))
                append = index > 1
                log.debug(
                    'Copying %s to %starget \'%s\' as %s%s',
                    fn_,
                    '{0} '.format(selected_target_option)
                        if selected_target_option
                        else '',
                    tgt,
                    remote_path,
                    ' (chunk #{0})'.format(index) if append else ''
                )
                args = [
                    tgt,
                    'cp.recv_chunked',
                    [remote_path, chunk, append, gzip, mode],
                    timeout,
                ]
                if selected_target_option is not None:
                    args.append(selected_target_option)

                result = local.cmd(*args)

                if not result:
                    # Publish failed
                    msg = (
                        'Publish failed.{0} It may be necessary to '
                        'decrease salt_cp_chunk_size (current value: '
                        '{1})'.format(
                            ' File partially transferred.' if index > 1 else '',
                            self.opts['salt_cp_chunk_size'],
                        )
                    )
                    for minion in minions:
                        ret.setdefault(minion, {})[remote_path] = msg
                    break

                for minion_id, minion_ret in six.iteritems(result):
                    ret.setdefault(minion_id, {})[remote_path] = minion_ret
                    # Catch first error message for a given minion, we will
                    # rewrite the results after we're done iterating through
                    # the chunks.
                    if minion_ret is not True and minion_id not in failed:
                        failed[minion_id] = minion_ret

                index += 1

            for minion_id, msg in six.iteritems(failed):
                ret[minion_id][remote_path] = msg

        for dirname in empty_dirs:
            remote_path = _get_remote_path(dirname)
            log.debug(
                'Creating empty dir %s on %starget \'%s\'',
                dirname,
                '{0} '.format(selected_target_option)  # pylint: disable=str-format-in-logging
                    if selected_target_option
                    else '',
                tgt,
            )
            args = [tgt, 'cp.recv_chunked', [remote_path, None], timeout]
            if selected_target_option is not None:
                args.append(selected_target_option)

            for minion_id, minion_ret in six.iteritems(local.cmd(*args)):
                ret.setdefault(minion_id, {})[remote_path] = minion_ret

        return ret
659841
def chunk_list(list_, size):
    
    ll = len(list_)
    if ll <= size:
        return [list_]
    elif size == 0:
        return list_ # or None ??
    elif size == 1:
        return [[l] for l in list_]
    else:
        chunks = []
        for start, stop in zip(range(0, ll, size), range(size, ll, size)):
            chunks.append(list_[start:stop])
        chunks.append(list_[stop:])  # snag unaligned chunks from last stop
        return chunks
567975
def chunks(l, n):
    """"""
    if n:
        for i in xrange(0, len(l), n):
            yield l[i:i + n]
1309308
private void fillEmptyModules(Iterable<JSModule> modules) {
    for (JSModule module : modules) {
      if (!module.getName().equals(JSModule.WEAK_MODULE_NAME) && module.getInputs().isEmpty()) {
        CompilerInput input =
            new CompilerInput(SourceFile.fromCode(createFillFileName(module.getName()), ""));
        input.setCompiler(this);
        module.add(input);
      }
    }
  }
171728
def chunks(raw):
    """"""
    for i in range(0, len(raw), EVENT_SIZE):
        yield struct.unpack(EVENT_FORMAT, raw[i:i+EVENT_SIZE])
1084273
def global_items(self):
        """"""
        for (k, v) in self.sql('global_dump'):
            yield (self.unpack(k), self.unpack(v))