Get a generator which yields (offset, array)
193213
def iteritems(self):
        """"""
        current_buf = self.ptr.contents.buffer
        length = self.ptr.contents.length
        seen_length = 0
        header = c_size_t()
        position = c_uint32()
        arraylength = c_size_t()
        arrayptr = FloatPtr()
        header_ = byref(header)
        position_ = byref(position)
        arraylength_ = byref(arraylength)
        arrayptr_ = byref(arrayptr)
        advance = Gauged.map_advance
        while seen_length < length:
            current_buf = advance(current_buf, header_, position_,
                                  arraylength_, arrayptr_)
            seen_length += header.value + arraylength.value
            address = addressof(arrayptr.contents)
            arr = (c_float * arraylength.value).from_address(address)
            yield position.value, list(arr)
766321
def token_offsets(tokens):
    """"""
    end_offset = 0
    previous_end_row = 0
    previous_end_column = 0
    for t in tokens:
        token_type = t[0]
        token_string = t[1]
        (start_row, start_column) = t[2]
        (end_row, end_column) = t[3]

        # Account for the whitespace between tokens.
        end_offset += start_column
        if previous_end_row == start_row:
            end_offset -= previous_end_column

        # Record the start offset of the token.
        start_offset = end_offset

        # Account for the length of the token itself.
        end_offset += len(token_string)

        yield (token_type,
               token_string,
               start_offset,
               end_offset)

        previous_end_row = end_row
        previous_end_column = end_column
1361569
def get_results_generator(future_list, timeout=None, sort_by_completed=False):
    """"""
    try:
        # python2 not support yield from
        if sort_by_completed:
            for future in as_completed(future_list, timeout=timeout):
                yield future.x
        else:
            for future in future_list:
                yield future.x
    except TimeoutError:
        return
941897
def enable_buffering(self, size=5):
        """"""
        if size <= 1:
            raise ValueError('buffer size too small')

        def generator(next):
            buf = []
            c_size = 0
            push = buf.append

            while 1:
                try:
                    while c_size < size:
                        c = next()
                        push(c)
                        if c:
                            c_size += 1
                except StopIteration:
                    if not c_size:
                        return
                yield concat(buf)
                del buf[:]
                c_size = 0

        self.buffered = True
        self._next = generator(self._gen.next).next
292134
function array(node, parent, scope) {
  var uid = scope.generateUidIdentifierBasedOnNode(parent);

  var container = util.template("array-comprehension-container", {
    KEY: uid
  });
  container.callee.shadow = true;

  var block = container.callee.body;
  var body = block.body;

  if (_traversal2["default"].hasType(node, scope, "YieldExpression", t.FUNCTION_TYPES)) {
    container.callee.generator = true;
    container = t.yieldExpression(container, true);
  }

  var returnStatement = body.pop();

  body.push(_helpersBuildComprehension2["default"](node, function () {
    return util.template("array-push", {
      STATEMENT: node.body,
      KEY: uid
    }, true);
  }));
  body.push(returnStatement);

  return container;
}
783054
function(no_in) {
          handle_regexp();
          var start = S.token;

          if (start.type == "name" && start.value == "yield") {
              if (is_in_generator()) {
                  next();
                  return _yield_expression();
              } else if (S.input.has_directive("use strict")) {
                  token_error(S.token, "Unexpected yield identifier inside strict mode");
              }
          }

          var left = maybe_conditional(no_in);
          var val = S.token.value;

          if (is("operator") && ASSIGNMENT(val)) {
              if (is_assignable(left) || (left = to_destructuring(left)) instanceof AST_Destructuring) {
                  next();
                  return new AST_Assign({
                      start    : start,
                      left     : left,
                      operator : val,
                      right    : maybe_assign(no_in),
                      end      : prev()
                  });
              }
              croak("Invalid assignment");
          }
          return left;
      }
995061
def gen_decode(iterable):
        ""
        sync = False
        for b in iterable:
            if sync and b & 0xE0:
                warn("Invalid unsynched data", Warning)
            if not (sync and b == 0x00):
                yield b
            sync = (b == 0xFF)
545087
function ( n, k ) {
            if ( ! n || ( n < k ) )
                throw new RangeError( 'check input values' )
                ;
            // buffer for generating combinations
            const buff = balloc( n, 0 )
                // colex recursive generator
                , colex_gen = function *( n, k ) {
                    if ( n === 0 ) yield buff;
                    else {
                        if ( k < n ) {
                            buff[ n - 1 ] = 0;
                            yield* colex_gen( n - 1, k );
                        }
                        if ( k > 0 ) {
                            buff[ n - 1 ] = 1;
                            yield* colex_gen( n - 1, k - 1 );
                        }
                    }
                }
                // generating colex order for k <= n/2.
                , colex_gen_2 = function *( n, k ) {
                    if ( k === 0 ) yield buff;
                    else {
                        if ( k < n ) {
                            buff[ n - 1 ] = 0;
                            yield* colex_gen_2( n - 1, k );
                        }
                        buff[ n - 1 ] = 1;
                        yield* colex_gen_2( n - 1, k - 1);
                        buff[ n - 1 ] = 0;
                    }
                }
                ;
            return ( k > n / 2 ) ?
                colex_gen( n , k ) :
                colex_gen_2( n, k )
                ;
        }
192372
public function yieldify()
    {
        foreach ($this->storage as $key => $value) {
            yield (object) [
                'value' => $value,
                'key' => $key,
                'done' => false
            ];
        }

        yield (object) [
            'value' => null,
            'key' => null,
            'done' => true
        ];
    }
16431
function(){ // the main generator you'll return
        var res=kid(); // call the child function and store the result
        if(cond(res)&&failed){ // if both generators have failed
            return done(); // then you're done
        }else if(cond(res)){ // if just the child has failed
            par(); // regenerate the child array
            return fn(); // return the next child value
        }else{ // otherwise.. 
            return [temp,res]; // return combined parent and child values
        }
    }
336757
public function read(): \Generator
    {
        if ($key = $this->firstKey()) {
            yield $key => $this->get($key);
        }

        while ($key = $this->nextKey()) {
            yield $key => $this->get($key);
        }
    }
696203
def _get_generator(parser, extract, keep, check_maf):
    """"""
    if extract is not None:
        parser = Extractor(parser, names=extract)

    for data in parser.iter_genotypes():
        data.genotypes = data.genotypes[keep]

        # Checking the MAF, if required
        if check_maf:
            data.code_minor()

        yield data
300434
def get_current_generator(self):
        """"""
        int_index=int(len(self.generators)*wrap(0,1.0,self.inspect_value('index')))
        return self.generators[int_index]
651639
def chain(cls, *iterables):
    

    def generator():
      for it in iterables:
        for element in it:
          yield element
    return cls(generator())
259043
def yield_from_handle(self, tokens):
        """"""
        internal_assert(len(tokens) == 1, "invalid yield from tokens", tokens)
        if self.target_info < (3, 3):
            return (
                yield_from_var + " = " + tokens[0]
                + "\nfor " + yield_item_var + " in " + yield_from_var + ":\n"
                + openindent + "yield " + yield_item_var + "\n" + closeindent
            )
        else:
            return "yield from " + tokens[0]
24047
def read_in_chunks(file_obj, chunk_size):
    """"""
    offset = 0
    while True:
        data = file_obj.read(chunk_size)
        if not data:
            break
        yield data, offset
        offset += len(data)
1354111
def gridrange(start, end, step):
    """"""
    for x in frange(start.real, end.real, step.real):
        for y in frange(start.imag, end.imag, step.imag):
            yield x + y * 1j