Iterator across all the non-duplicate keys and their values.
        
        Only yields the first key of duplicates.
482641
def iteritems(self):
        
        keys_yielded = set()
        for k, v in self._pairs:
            if k not in keys_yielded:
                keys_yielded.add(k)
                yield k, v
23205
def _iter_keys(key):
    
    for i in range(winreg.QueryInfoKey(key)[0]):
        yield winreg.OpenKey(key, winreg.EnumKey(key, i))
1203589
def iter_multi_items(mapping):
    
    if isinstance(mapping, MultiDict):
        for item in iteritems(mapping, multi=True):
            yield item
    elif isinstance(mapping, dict):
        for key, value in iteritems(mapping):
            if isinstance(value, (tuple, list)):
                for value in value:
                    yield key, value
            else:
                yield key, value
    else:
        for item in mapping:
            yield item
1258021
def unique_index(data, keys=None, fail_on_dup=True):
    
    o = UniqueIndex(listwrap(keys), fail_on_dup=fail_on_dup)

    for d in data:
        try:
            o.add(d)
        except Exception as e:
            o.add(d)
            Log.error(
                "index {{index}} is not unique {{key}} maps to both {{value1}} and {{value2}}",
                index=keys,
                key=select([d], keys)[0],
                value1=o[d],
                value2=d,
                cause=e,
            )
    return o
113976
def get_all_keys(self, start=None):
        
        s = self.stream
        if not start:
            start = HEADER_SIZE + self.block_size * self.root_block
        s.seek(start)
        block_type = s.read(2)
        if block_type == LEAF:
            reader = LeafReader(self)
            num_keys = struct.unpack('>i', reader.read(4))[0]
            for _ in range(num_keys):
                cur_key = reader.read(self.key_size)
                # We to a tell/seek here so that the user can read from
                # the file while this loop is still being run
                cur_pos = s.tell()
                yield cur_key
                s.seek(cur_pos)
                length = sbon.read_varint(reader)
                reader.seek(length, 1)
        elif block_type == INDEX:
            (_, num_keys, first_child) = struct.unpack('>Bii', s.read(9))
            children = [first_child]
            for _ in range(num_keys):
                # Skip the key field.
                _ = s.read(self.key_size)
                # Read pointer to the child block.
                next_child = struct.unpack('>i', s.read(4))[0]
                children.append(next_child)
            for child_loc in children:
                for key in self.get_all_keys(HEADER_SIZE + self.block_size * child_loc):
                    yield key
        elif block_type == FREE:
            pass
        else:
            raise Exception('Unhandled block type: {}'.format(block_type))
374375
def find_duplicate_keys(data):
    
    out_dict = {}
    for key, value in data:
        if key in out_dict:
            raise ValueError("Duplicate key: {}".format(key))
        out_dict[key] = value
    return out_dict
373017
def iterator(self, includeKey=True, includeValue=True, prefix=None):
        

        if not (includeKey or includeValue):
            raise ValueError("At least one of includeKey or includeValue "
                             "should be true")
        lines = self._lines()
        if includeKey and includeValue:
            return self._keyValueIterator(lines, prefix=prefix)
        if includeValue:
            return self._valueIterator(lines, prefix=prefix)
        return self._keyIterator(lines, prefix=prefix)
683065
def iterallvalues(self, key=_absent):
        '''
        
        '''
        if key is not _absent:
            if key in self:
                return iter(self.getlist(key))
            raise KeyError(key)
        return self._items.itervalues()
1027719
def get_multi(*keys)
      check_keys = keys.flatten
      check_keys.compact!

      return {} if check_keys.empty?
      if block_given?
        get_multi_yielder(keys) {|k, data| yield k, data.first}
      else
        Hash.new.tap do |hash|
          get_multi_yielder(keys) {|k, data| hash[k] = data.first}
        end
      end
    end
1334415
def all_sample_keys(self) -> List[str]:
        
        all_keys: List[str] = []
        for key in chain.from_iterable([sample.keys() for sample in self]):
            if key not in all_keys:
                all_keys.append(key)
        return all_keys
15103
def get_first_key_from_value(self, value):
        

        for key, data in self.iteritems():
            if data == value:
                return key
544133
def iter_rows(self):
        
        fileobj = self._fileobj
        cls_row = self.cls_row
        fields = self.fields

        for idx in range(self.prolog.records_count):
            data = fileobj.read(1)

            marker = struct.unpack('<1s', data)[0]
            is_deleted = marker == b'*'

            if is_deleted:
                continue

            row_values = []
            for field in fields:
                val = field.cast(fileobj.read(field.len))
                row_values.append(val)

            yield cls_row(*row_values)
222663
def iteritems(self):
        """"""
        for key in self:
            vals = self._container[key.lower()]
            for val in vals[1:]:
                yield vals[0], val
1258152
def iter(self, keyed=False, extended=False, cast=True, relations=False):
        

        # Prepare unique checks
        if cast:
            unique_fields_cache = {}
            if self.schema:
                unique_fields_cache = _create_unique_fields_cache(self.schema)

        # Open/iterate stream
        self.__stream.open()
        iterator = self.__stream.iter(extended=True)
        iterator = self.__apply_processors(iterator, cast=cast)
        for row_number, headers, row in iterator:

            # Get headers
            if not self.__headers:
                self.__headers = headers

            # Check headers
            if cast:
                if self.schema and self.headers:
                    if self.headers != self.schema.field_names:
                        self.__stream.close()
                        message = 'Table headers don\'t match schema field names'
                        raise exceptions.CastError(message)

            # Check unique
            if cast:
                for indexes, cache in unique_fields_cache.items():
                    values = tuple(value for i, value in enumerate(row) if i in indexes)
                    if not all(map(lambda value: value is None, values)):
                        if values in cache['data']:
                            self.__stream.close()
                            message = 'Field(s) "%s" duplicates in row "%s"'
                            message = message % (cache['name'], row_number)
                            raise exceptions.CastError(message)
                        cache['data'].add(values)

            # Resolve relations
            if relations:
                if self.schema:
                    for foreign_key in self.schema.foreign_keys:
                        row = _resolve_relations(row, headers, relations, foreign_key)
                        if row is None:
                            self.__stream.close()
                            message = 'Foreign key "%s" violation in row "%s"'
                            message = message % (foreign_key['fields'], row_number)
                            raise exceptions.RelationError(message)

            # Form row
            if extended:
                yield (row_number, headers, row)
            elif keyed:
                yield dict(zip(headers, row))
            else:
                yield row

        # Close stream
        self.__stream.close()
1066506
def iterator(self):
        """"""
        if self.combined:
            grouped_data = [[(0, datum)] for datum in self.data]
            skip_dims = {"chain"}
        else:
            grouped_data = [datum.groupby("chain") for datum in self.data]
            skip_dims = set()

        label_dict = OrderedDict()
        for name, grouped_datum in zip(self.model_names, grouped_data):
            for _, sub_data in grouped_datum:
                datum_iter = xarray_var_iter(
                    sub_data,
                    var_names=[self.var_name],
                    skip_dims=skip_dims,
                    reverse_selections=True,
                )
                for _, selection, values in datum_iter:
                    label = make_label(self.var_name, selection, position="beside")
                    if label not in label_dict:
                        label_dict[label] = OrderedDict()
                    if name not in label_dict[label]:
                        label_dict[label][name] = []
                    label_dict[label][name].append(values)

        y = self.y_start
        for label, model_data in label_dict.items():
            for model_name, value_list in model_data.items():
                if model_name:
                    row_label = "{}: {}".format(model_name, label)
                else:
                    row_label = label
                for values in value_list:
                    yield y, row_label, label, values, self.model_color[model_name]
                    y += self.chain_offset
                y += self.var_offset
            y += self.group_offset
790695
def unique(iterable):
    
    """
    d = {}
    return (d.setdefault(x,x) for x in iterable if x not in d)
11347
def duplicates(base, items):
    
    for item in items:
        if item.similarity(base) and not item.equality(base):
            yield item