Check header lines, in particular for starting file "##fileformat"
350947
def _check_header_lines(self, header_lines):
        
        if not header_lines:
            raise exceptions.InvalidHeaderException(
                "The VCF file did not contain any header lines!"
            )
        first = header_lines[0]
        if first.key != "fileformat":
            raise exceptions.InvalidHeaderException("The VCF file did not start with ##fileformat")
        if first.value not in SUPPORTED_VCF_VERSIONS:
            warnings.warn("Unknown VCF version {}".format(first.value), UnknownVCFVersion)
973920
function s3Init(file) {
  if (file.s3) {
    return;
  }

  file.s3 = {};
  file.s3.headers = {};
  file.s3.path = file.path.replace(file.base, "").replace(new RegExp("\\" + path.sep, "g"), "/");
}
776017
def _header_line(self, section):
        """"""

        token = self.tok.get()
        what = token.value
        if what == 'id':
            self.message.id = self.tok.get_int()
        elif what == 'flags':
            while True:
                token = self.tok.get()
                if not token.is_identifier():
                    self.tok.unget(token)
                    break
                self.message.flags = self.message.flags | \
                                     dns.flags.from_text(token.value)
            if dns.opcode.is_update(self.message.flags):
                self.updating = True
        elif what == 'edns':
            self.message.edns = self.tok.get_int()
            self.message.ednsflags = self.message.ednsflags | \
                                     (self.message.edns << 16)
        elif what == 'eflags':
            if self.message.edns < 0:
                self.message.edns = 0
            while True:
                token = self.tok.get()
                if not token.is_identifier():
                    self.tok.unget(token)
                    break
                self.message.ednsflags = self.message.ednsflags | \
                              dns.flags.edns_from_text(token.value)
        elif what == 'payload':
            self.message.payload = self.tok.get_int()
            if self.message.edns < 0:
                self.message.edns = 0
        elif what == 'opcode':
            text = self.tok.get_string()
            self.message.flags = self.message.flags | \
                      dns.opcode.to_flags(dns.opcode.from_text(text))
        elif what == 'rcode':
            text = self.tok.get_string()
            self.message.set_rcode(dns.rcode.from_text(text))
        else:
            raise UnknownHeaderField
        self.tok.get_eol()
1150540
def _check_file(parameters):
    """"""
    (filename, args) = parameters

    if filename == '-':
        contents = sys.stdin.read()
    else:
        with contextlib.closing(
            docutils.io.FileInput(source_path=filename)
        ) as input_file:
            contents = input_file.read()

    args = load_configuration_from_file(
        os.path.dirname(os.path.realpath(filename)), args)

    ignore_directives_and_roles(args.ignore_directives, args.ignore_roles)

    for substitution in args.ignore_substitutions:
        contents = contents.replace('|{}|'.format(substitution), 'None')

    ignore = {
        'languages': args.ignore_language,
        'messages': args.ignore_messages,
    }
    all_errors = []
    for error in check(contents,
                       filename=filename,
                       report_level=args.report,
                       ignore=ignore,
                       debug=args.debug):
        all_errors.append(error)
    return (filename, all_errors)
188383
def get_file_starts(file_list):
    '''
    
    '''
    starts = []
    total = 0
    for i in file_list:
        starts.append(total)
        total += i['length']
    print starts
    return starts
253317
def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
                      seqType='both', verbose=False):
    """"""
    # Check the input files for containers in their variadic form.
    result1 = False
    if seqType == "both" or seqType == "variadic":
        if verbose:
            print "Check if input files for pre-processing Boost.MPL variadic containers need fixing."
        result1 = check_input_files_for_variadic_seq(headerDir, sourceDir)
        if verbose:
            if result1:
                print "  At least one input file needs fixing!"
            else:
                print "  No input file needs fixing!"
    # Check the input files for containers in their numbered form.
    result2 = False
    result3 = False
    if seqType == "both" or seqType == "numbered":
        if verbose:
            print "Check input files for pre-processing Boost.MPL numbered containers."
        result2 = check_input_files_for_numbered_seq(headerDir, ".hpp", containers)
        result3 = check_input_files_for_numbered_seq(sourceDir, ".cpp", containers)
        if verbose:
            if result2 or result3:
                print "  At least one input file needs fixing!"
            else:
                print "  No input file needs fixing!"
    # Return result.
    return result1 or result2 or result3
662149
def CheckEnd(self, filename, clean_lines, linenum, error):
    """"""
    line = clean_lines.raw_lines[linenum]

    # Check how many lines is enclosed in this namespace.  Don't issue
    # warning for missing namespace comments if there aren't enough
    # lines.  However, do apply checks if there is already an end of
    # namespace comment and it's incorrect.
    #
    # TODO(unknown): We always want to check end of namespace comments
    # if a namespace is large, but sometimes we also want to apply the
    # check if a short namespace contained nontrivial things (something
    # other than forward declarations).  There is currently no logic on
    # deciding what these nontrivial things are, so this check is
    # triggered by namespace size only, which works most of the time.
    if (linenum - self.starting_linenum < 10
        and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
      return

    # Look for matching comment at end of namespace.
    #
    # Note that we accept C style "/* */" comments for terminating
    # namespaces, so that code that terminate namespaces inside
    # preprocessor macros can be cpplint clean.
    #
    # We also accept stuff like "// end of namespace <name>." with the
    # period at the end.
    #
    # Besides these, we don't accept anything else, otherwise we might
    # get false negatives when existing comment is a substring of the
    # expected namespace.
    if self.name:
      # Named namespace
      if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
                    r'[\*/\.\\\s]*$'),
                   line):
        error(filename, linenum, 'readability/namespace', 5,
              'Namespace should be terminated with "// namespace %s"' %
              self.name)
    else:
      # Anonymous namespace
      if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
        # If "// namespace anonymous" or "// anonymous namespace (more text)",
        # mention "// anonymous namespace" as an acceptable form
        if Match(r'}.*\b(namespace anonymous|anonymous namespace)\b', line):
          error(filename, linenum, 'readability/namespace', 5,
                'Anonymous namespace should be terminated with "// namespace"'
                ' or "// anonymous namespace"')
        else:
          error(filename, linenum, 'readability/namespace', 5,
                'Anonymous namespace should be terminated with "// namespace"')
1023268
def dump(self, f, name):
        """"""
        # print the header line
        value = self.get()
        kind = self.get_kind(value)
        print("% 40s  kind=%s  value=%s" % (name, kind, value), file=f)
566400
def _parseHeader (self, line, lineno, log):
    """"""
    if line.startswith('#') and line.find(':') > 0:
      tokens = [ t.strip().lower() for t in line[1:].split(":", 1) ]
      name   = tokens[0]
      pos    = SeqPos(line, lineno)

      if name in self.header:
        msg = 'Ignoring duplicate header parameter: %s'
        log.warning(msg % name, pos)
      else:
        for expected in ['seqid', 'version']:
          if name == expected:
            value = util.toNumber(tokens[1], None)
            if value is None:
              msg = 'Parameter "%s" value "%s" is not a number.'
              log.error(msg % (name, tokens[1]), poss)
            else:
              self.header[name] = value
397531
def check_file(self):
        
        try:
            image_type = ".{0}".format(self.image.split(".")[1])
            if image_type not in self.file_format:
                print("Format: '{0}' not recognized. Use one of "
                      "them:\n{1}".format(self.image.split(".")[1],
                                          ", ".join(self.file_format)))
                raise SystemExit()
        except IndexError:
            print("slpkg: Error: Image file suffix missing")
            raise SystemExit()
311574
def check(codeString, filename, reporter=modReporter.Default, settings_path=None, **setting_overrides):
    """"""

    if not settings_path and filename:
        settings_path = os.path.dirname(os.path.abspath(filename))
    settings_path = settings_path or os.getcwd()

    active_settings = settings.from_path(settings_path).copy()
    for key, value in itemsview(setting_overrides):
        access_key = key.replace('not_', '').lower()
        if type(active_settings.get(access_key)) in (list, tuple):
            if key.startswith('not_'):
                active_settings[access_key] = list(set(active_settings[access_key]).difference(value))
            else:
                active_settings[access_key] = list(set(active_settings[access_key]).union(value))
        else:
            active_settings[key] = value
    active_settings.update(setting_overrides)

    if _should_skip(filename, active_settings.get('skip', [])):
        if active_settings.get('directly_being_checked', None) == 1:
            reporter.flake(FileSkipped(filename))
            return 1
        elif active_settings.get('verbose', False):
            ignore = active_settings.get('ignore_frosted_errors', [])
            if(not "W200" in ignore and not "W201" in ignore):
                reporter.flake(FileSkipped(filename, None, verbose=active_settings.get('verbose')))
        return 0

    # First, compile into an AST and handle syntax errors.
    try:
        tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST)
    except SyntaxError:
        value = sys.exc_info()[1]
        msg = value.args[0]

        (lineno, offset, text) = value.lineno, value.offset, value.text

        # If there's an encoding problem with the file, the text is None.
        if text is None:
            # Avoid using msg, since for the only known case, it contains a
            # bogus message that claims the encoding the file declared was
            # unknown.
            reporter.unexpected_error(filename, 'problem decoding source')
        else:
            reporter.flake(PythonSyntaxError(filename, msg, lineno, offset, text,
                                             verbose=active_settings.get('verbose')))
        return 1
    except Exception:
        reporter.unexpected_error(filename, 'problem decoding source')
        return 1
    # Okay, it's syntactically valid.  Now check it.
    w = checker.Checker(tree, filename, None, ignore_lines=_noqa_lines(codeString), **active_settings)
    w.messages.sort(key=lambda m: m.lineno)
    for warning in w.messages:
        reporter.flake(warning)
    return len(w.messages)
362905
def __header(self, line):
        
        self.cpu_number = len(line.split())
        return self.cpu_number
770914
def display_start(self):
        """"""

        if self.opt['Verbose'] and self.opt['StatusHeader']:
            print(self.hdrstr)
            print("-" * self.nsep)
846562
protected void readInitialHeaders() throws IOException
	{
		String line;
		while ((line = readCRLFLine()).length()!=0)
		{
			int colonIndex = line.indexOf(':');
			// does it have a ':' separator
			if (colonIndex == -1) continue;
			String tagName = line.substring(0, colonIndex);
			String value = line.substring(colonIndex + 1);
			if (value.toLowerCase().endsWith("<br>")) value = value.substring(0, value.length()-4);
			IcyTag tag = new IcyTag(tagName, value);
			addTag(tag);
		}
	}
1130028
def check_docstring_first(src, filename='<unknown>'):
    # type: (bytes, str) -> int
    
    found_docstring_line = None
    found_code_line = None

    tok_gen = tokenize_tokenize(io.BytesIO(src).readline)
    for tok_type, _, (sline, scol), _, _ in tok_gen:
        # Looks like a docstring!
        if tok_type == tokenize.STRING and scol == 0:
            if found_docstring_line is not None:
                print(
                    '{}:{} Multiple module docstrings '
                    '(first docstring on line {}).'.format(
                        filename, sline, found_docstring_line,
                    ),
                )
                return 1
            elif found_code_line is not None:
                print(
                    '{}:{} Module docstring appears after code '
                    '(code seen on line {}).'.format(
                        filename, sline, found_code_line,
                    ),
                )
                return 1
            else:
                found_docstring_line = sline
        elif tok_type not in NON_CODE_TOKENS and found_code_line is None:
            found_code_line = sline

    return 0
312040
def _read_file_header(self):
        """"""
        header = self.fileobj.readline()
        payload1 = self.fileobj.readline()
        payload2 = self.fileobj.readline()
        version, reserved, organisation = payload1.split(None, 2)
        self.fileobj.readline() # Lose the separator newline
        self.header_read = True
        # print "--------------------------------------------------"
        # print header,"\n", payload1, "\n", payload2,"\n"
        # print "--------------------------------------------------"
        if self.version and int(self.version) != version:
            raise IOError("Version mismatch. Requested version was '%s' but version in file was '%s'"%(self.version, version))
        
        if version == '1':
            url, ip_address, date, content_type, length = header.split()
            self.file_headers = {"ip_address" : ip_address,
                                 "date" : datetime.datetime.strptime(date, "%Y%m%d%H%M%S"),
                                 "org" : organisation}
            self.version = 1
        elif version == '2':
            url, ip_address, date, content_type, result_code, checksum, location, offset, filename, length  = header.split()
            self.file_headers = {"ip_address" : ip_address,
                                 "date" : datetime.datetime.strptime(date, "%Y%m%d%H%M%S"),
                                 "org" : organisation}
            self.version = 2
        else:
            raise IOError("Unknown ARC version '%s'"%version)
130954
def _check_samples_line(klass, arr):
        """"""
        if len(arr) <= len(REQUIRE_NO_SAMPLE_HEADER):
            if tuple(arr) != REQUIRE_NO_SAMPLE_HEADER:
                raise exceptions.IncorrectVCFFormat(
                    "Sample header line indicates no sample but does not "
                    "equal required prefix {}".format("\t".join(REQUIRE_NO_SAMPLE_HEADER))
                )
        elif tuple(arr[: len(REQUIRE_SAMPLE_HEADER)]) != REQUIRE_SAMPLE_HEADER:
            raise exceptions.IncorrectVCFFormat(
                'Sample header line (starting with "#CHROM") does not '
                "start with required prefix {}".format("\t".join(REQUIRE_SAMPLE_HEADER))
            )