For each chunk and a set of valid and technical words, find errors.
762902
def _find_spelling_errors_in_chunks(chunks,
                                    contents,
                                    valid_words_dictionary=None,
                                    technical_words_dictionary=None,
                                    user_dictionary_words=None):
    """"""
    for chunk in chunks:
        for error in spellcheck_region(chunk.data,
                                       valid_words_dictionary,
                                       technical_words_dictionary,
                                       user_dictionary_words):
            col_offset = _determine_character_offset(error.line_offset,
                                                     error.column_offset,
                                                     chunk.column)
            msg = _SPELLCHECK_MESSAGES[error.error_type].format(error.word)
            yield _populate_spelling_error(error.word,
                                           error.suggestions,
                                           contents,
                                           error.line_offset +
                                           chunk.line,
                                           col_offset,
                                           msg)
1370099
def verify_chunks(self, chunks):
        '''
        
        '''
        err = []
        for chunk in chunks:
            err.extend(self.verify_data(chunk))
        return err
496275
def existence_check(text, list, err, msg, ignore_case=True,
                    str=False, max_errors=float("inf"), offset=0,
                    require_padding=True, dotall=False,
                    excluded_topics=None, join=False):
    """"""
    flags = 0

    msg = " ".join(msg.split())

    if ignore_case:
        flags = flags | re.IGNORECASE

    if str:
        flags = flags | re.UNICODE

    if dotall:
        flags = flags | re.DOTALL

    if require_padding:
        regex = u"(?:^|\W){}[\W$]"
    else:
        regex = u"{}"

    errors = []

    # If the topic of the text is in the excluded list, return immediately.
    if excluded_topics:
        tps = topics(text)
        if any([t in excluded_topics for t in tps]):
            return errors

    rx = "|".join(regex.format(w) for w in list)
    for m in re.finditer(rx, text, flags=flags):
        txt = m.group(0).strip()
        errors.append((
            m.start() + 1 + offset,
            m.end() + offset,
            err,
            msg.format(txt),
            None))

    errors = truncate_to_max(errors, max_errors)

    return errors
1013230
private void findErrors(final Span references[], final Span predictions[],
      final List<Span> falseNegatives, final List<Span> falsePositives) {

    falseNegatives.addAll(Arrays.asList(references));
    falsePositives.addAll(Arrays.asList(predictions));

    for (final Span referenceName : references) {

      for (final Span prediction : predictions) {
        if (referenceName.equals(prediction)) {
          // got it, remove from fn and fp
          falseNegatives.remove(referenceName);
          falsePositives.remove(prediction);
        }
      }
    }
  }
140476
def assert_error(text, check, n=1):
    """"""
    assert_error.description = "No {} error for '{}'".format(check, text)
    assert(check in [error[0] for error in lint(text)])
1182169
def correction(sentence, pos):
    ""
    word = sentence[pos]
    cands = candidates(word)
    if not cands:
        cands = candidates(word, False)
    if not cands:
        return word
    cands = sorted(cands, key=lambda w: P(w, sentence, pos), reverse=True)
    cands = [c[0] for c in cands]
    return cands
194858
def _check_for_misplaced(xs, subkey, other_keys):
    
    problems = []
    for x in xs:
        check_dict = x.get(subkey, {})
        for to_check in other_keys:
            if to_check in check_dict:
                problems.append((x["description"], to_check, subkey))
    if len(problems) > 0:
        raise ValueError("\n".join(["Incorrectly nested keys found in sample YAML. These should be top level:",
                                    " sample         |   key name      |   nested under ",
                                    "----------------+-----------------+----------------"] +
                                   ["% 15s | % 15s | % 15s" % (a, b, c) for (a, b, c) in problems]))
612431
def analysis(self):
        """"""
        if not self.is_tagged(ANALYSIS):
            self.tag_analysis()
        return [word[ANALYSIS] for word in self.words]
263663
function (file, errors, options) {
      var reports = []
        , content = file.content.split('\n');

      errors.forEach(function error (err) {
        // some linters don't return the location -_-
        if (!err.line) return reports.push(err.message.grey, '');

        var start = err.line > 3 ? err.line - 3 : 0
          , stop = err.line + 2
          , range = content.slice(start, stop)
          , numbers = _.range(start + 1, stop + 1)
          , len = stop.toString().length;

        reports.push('Lint error: ' + err.line + ' col ' + err.column);
        range.map(function reformat (line) {
          var lineno = numbers.shift()
            , offender = lineno === err.line
            , inline = /\'[^\']+?\'/
            , slice;

          // this is the actual line with the error, so we should start finding
          // what the error is and how we could highlight it in the output
          if (offender) {
            if (line.length < err.column) {
              // we are missing something at the end of the line.. so add a red
              // square
              line += ' '.inverse.red;
            } else {
              // we have a direct match on a statement
              if (inline.test(err.message)) {
                slice = err.message.match(inline)[0].replace(/\'/g, '');
              } else {
                // it's happening in the center of things, so we can start
                // coloring inside the shizzle
                slice = line.slice(err.column - 1);
              }

              line = line.replace(slice, slice.inverse.red);
            }
          }

          reports.push('  ' + pad(lineno, len) + ' | ' + line);
        });

        reports.push('');
        reports.push(err.message.grey);
        reports.push('');

      });

      // output the shizzle
      reports.forEach(function output (line) {
        this.logger.error(line);
      }.bind(this));
    }
250102
def error(message)
      (m = filter(message, :error)) && each {|l| l.error(m)}
    end
1316158
def check_for_errors(config, raise_exception=True):
    
    errors = {}
    for section in ['reader', 'writer', 'filter', 'filter_before',
                    'filter_after', 'transform', 'persistence',
                    'decompressor', 'deserializer']:
        config_section = config.get(section)
        if config_section is None:
            if section in REQUIRED_CONFIG_SECTIONS:
                errors[section] = "Missing section"
        else:
            section_errors = _get_section_errors(config_section)
            if section_errors:
                errors[section] = section_errors

    exporter_options = config.get('exporter_options', {})
    if "formatter" in exporter_options:
        section_errors = _get_section_errors(exporter_options['formatter'])
        if section_errors:
            errors['formatter'] = section_errors

    if not _is_stream_reader(config):
        for section in STREAM_READER_SECTIONS:
            if config.get(section) and not errors.get(section):
                errors[section] = 'The %r section can only be used with a stream reader.' % section

    for i, notificator in enumerate(exporter_options.get('notifications', [])):
        section_errors = _get_section_errors(notificator)
        if section_errors:
            errors['notifications_' + str(i)] = section_errors

    if raise_exception and errors:
        raise ConfigCheckError(errors=errors)
    else:
        return errors
784014
def security_errors(self):
        """"""
        errors = ErrorDict()
        for f in ["honeypot", "timestamp", "security_hash"]:
            if f in self.errors:
                errors[f] = self.errors[f]
        return errors
334423
def error(self, line_number, offset, text, check):
        """"""
        code = text[:4]
        if self._ignore_code(code):
            return
        if code in self.counters:
            self.counters[code] += 1
        else:
            self.counters[code] = 1
            self.messages[code] = text[5:]
        # Don't care about expected errors or warnings
        if code in self.expected:
            return
        if self.print_filename and not self.file_errors:
            print(self.filename)
        self.file_errors += 1
        self.total_errors += 1
        return code
808340
def analyze(self, text):
        
        try:
            text = render_safe(text).strip()
            if not text:
                return []
            chunks = text.split('\n')
            results = []
            for chunk_text in chunks:
                if chunk_text.strip():
                    textbytes = (chunk_text + '\n').encode('utf-8')
                    self.send_input(textbytes)
                    out_line = ''
                    while True:
                        out_line = self.receive_output_line()
                        out_line = out_line.decode('utf-8')

                        if out_line == '\n':
                            break

                        record = out_line.strip('\n').split(' ')
                        results.append(record)
            return results
        except ProcessError:
            self.restart_process()
            return self.analyze(text)
1179075
def _validate_entries(self, processes, callback=None):
        
        errors = list()

        if os.name == 'posix':
            worker_init = posix_multiprocessing_worker_initializer
        else:
            worker_init = None

        args = ((self.path,
                 self.normalized_filesystem_names.get(rel_path, rel_path),
                 hashes,
                 self.algorithms) for rel_path, hashes in self.entries.items())

        try:
            if processes == 1:
                count = 0
                hash_results = []
                totalHashes = len(self.entries.items())
                for i in args:
                    hash_results.append(_calc_hashes(i))
                    count += 1
                    if callback:
                        if not callback(count, totalHashes):
                            raise BaggingInterruptedError("Bag validation interrupted!")

            else:
                pool = None
                try:
                    pool = multiprocessing.Pool(processes if processes else None, initializer=worker_init)
                    hash_results = pool.map(_calc_hashes, args)
                finally:
                    if pool:
                        pool.terminate()
        except BaggingInterruptedError:
            raise
        # Any unhandled exceptions are probably fatal
        except:
            LOGGER.error(_("Unable to calculate file hashes for %s"), self)
            raise

        for rel_path, f_hashes, hashes in hash_results:
            for alg, computed_hash in f_hashes.items():
                stored_hash = hashes[alg]
                if stored_hash.lower() != computed_hash:
                    e = ChecksumMismatch(rel_path, alg, stored_hash.lower(), computed_hash)
                    LOGGER.warning(force_unicode(e))
                    errors.append(e)

        if errors:
            raise BagValidationError(_("Bag validation failed"), errors)
808656
def _checker(keywords):
    """"""
    def _(v):
        """Check a given value matches to keywords."""
        for k in keywords:
            if k in v:
                return False
        return True
    return _
935568
def check_list_errors(self, checkFunc, lst):
        """"""
        # check for errors on each subitem, filter only subitems with errors
        results = (checkFunc(i) for i in lst)
        return [err for err in results if err]