def get_validation_data(doc):
errs = []<EOL>wrns = []<EOL>if not doc.raw_doc:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL>return errs, wrns, '<STR_LIT>'<EOL><DEDENT>if doc.start_blank_lines != <NUM_LIT:1>:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if doc.end_blank_lines != <NUM_LIT:1>:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if doc.double_blank_lines:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>mentioned_errs = doc.mentioned_private_classes<EOL>if mentioned_errs:<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>mentioned_private_classes='<STR_LIT:U+002CU+0020>'.join(mentioned_errs)))<EOL><DEDENT>for line in doc.raw_doc.splitlines():<EOL><INDENT>if re.match("<STR_LIT>", line):<EOL><INDENT>errs.append(error('<STR_LIT>', line_with_tabs=line.lstrip()))<EOL><DEDENT><DEDENT>unexpected_sections = [section for section in doc.section_titles<EOL>if section not in ALLOWED_SECTIONS]<EOL>for section in unexpected_sections:<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>section=section,<EOL>allowed_sections='<STR_LIT:U+002CU+0020>'.join(ALLOWED_SECTIONS)))<EOL><DEDENT>correct_order = [section for section in ALLOWED_SECTIONS<EOL>if section in doc.section_titles]<EOL>if correct_order != doc.section_titles:<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>correct_sections='<STR_LIT:U+002CU+0020>'.join(correct_order)))<EOL><DEDENT>if (doc.deprecated_with_directive<EOL>and not doc.extended_summary.startswith('<STR_LIT>')):<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if not doc.summary:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>if not doc.summary[<NUM_LIT:0>].isupper():<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if doc.summary[-<NUM_LIT:1>] != '<STR_LIT:.>':<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if doc.summary != doc.summary.lstrip():<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>elif (doc.is_function_or_method<EOL>and doc.summary.split('<STR_LIT:U+0020>')[<NUM_LIT:0>][-<NUM_LIT:1>] == '<STR_LIT:s>'):<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if doc.num_summary_lines > <NUM_LIT:1>:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT><DEDENT>if not doc.extended_summary:<EOL><INDENT>wrns.append(('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>errs += doc.parameter_mismatches<EOL>for param in doc.doc_parameters:<EOL><INDENT>if not param.startswith("<STR_LIT:*>"):  <EOL><INDENT>if not doc.parameter_type(param):<EOL><INDENT>if '<STR_LIT::>' in param:<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>param_name=param.split('<STR_LIT::>')[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>errs.append(error('<STR_LIT>', param_name=param))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if doc.parameter_type(param)[-<NUM_LIT:1>] == '<STR_LIT:.>':<EOL><INDENT>errs.append(error('<STR_LIT>', param_name=param))<EOL><DEDENT>common_type_errors = [('<STR_LIT>', '<STR_LIT:int>'),<EOL>('<STR_LIT>', '<STR_LIT:bool>'),<EOL>('<STR_LIT:string>', '<STR_LIT:str>')]<EOL>for wrong_type, right_type in common_type_errors:<EOL><INDENT>if wrong_type in doc.parameter_type(param):<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>param_name=param,<EOL>right_type=right_type,<EOL>wrong_type=wrong_type))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if not doc.parameter_desc(param):<EOL><INDENT>errs.append(error('<STR_LIT>', param_name=param))<EOL><DEDENT>else:<EOL><INDENT>if not doc.parameter_desc(param)[<NUM_LIT:0>].isupper():<EOL><INDENT>errs.append(error('<STR_LIT>', param_name=param))<EOL><DEDENT>if doc.parameter_desc(param)[-<NUM_LIT:1>] != '<STR_LIT:.>':<EOL><INDENT>errs.append(error('<STR_LIT>', param_name=param))<EOL><DEDENT><DEDENT><DEDENT>if doc.is_function_or_method:<EOL><INDENT>if not doc.returns:<EOL><INDENT>if doc.method_returns_something:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if len(doc.returns) == <NUM_LIT:1> and doc.returns[<NUM_LIT:0>].name:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>for name_or_type, type_, desc in doc.returns:<EOL><INDENT>if not desc:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>desc = '<STR_LIT:U+0020>'.join(desc)<EOL>if not desc[<NUM_LIT:0>].isupper():<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT>if not desc.endswith('<STR_LIT:.>'):<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if not doc.yields and '<STR_LIT>' in doc.method_source:<EOL><INDENT>errs.append(error('<STR_LIT>'))<EOL><DEDENT><DEDENT>if not doc.see_also:<EOL><INDENT>wrns.append(error('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>for rel_name, rel_desc in doc.see_also.items():<EOL><INDENT>if rel_desc:<EOL><INDENT>if not rel_desc.endswith('<STR_LIT:.>'):<EOL><INDENT>errs.append(error('<STR_LIT>', reference_name=rel_name))<EOL><DEDENT>if not rel_desc[<NUM_LIT:0>].isupper():<EOL><INDENT>errs.append(error('<STR_LIT>', reference_name=rel_name))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>errs.append(error('<STR_LIT>', reference_name=rel_name))<EOL><DEDENT>if rel_name.startswith('<STR_LIT>'):<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>reference_name=rel_name,<EOL>right_reference=rel_name[len('<STR_LIT>'):]))<EOL><DEDENT><DEDENT><DEDENT>examples_errs = '<STR_LIT>'<EOL>if not doc.examples:<EOL><INDENT>wrns.append(error('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>examples_errs = doc.examples_errors<EOL>if examples_errs:<EOL><INDENT>errs.append(error('<STR_LIT>', doctest_log=examples_errs))<EOL><DEDENT>for err in doc.validate_pep8():<EOL><INDENT>errs.append(error('<STR_LIT>',<EOL>error_code=err.error_code,<EOL>error_message=err.message,<EOL>times_happening='<STR_LIT>'.format(err.count)<EOL>if err.count > <NUM_LIT:1> else '<STR_LIT>'))<EOL><DEDENT>examples_source_code = '<STR_LIT>'.join(doc.examples_source_code)<EOL>for wrong_import in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if '<STR_LIT>'.format(wrong_import) in examples_source_code:<EOL><INDENT>errs.append(error('<STR_LIT>', imported_library=wrong_import))<EOL><DEDENT><DEDENT><DEDENT>return errs, wrns, examples_errs<EOL>
Validate the docstring.

Parameters
----------
doc : Docstring
    A Docstring object with the given function name.

Returns
-------
tuple
    errors : list of tuple
        Errors occurred during validation.
    warnings : list of tuple
        Warnings occurred during validation.
    examples_errs : str
        Examples usage displayed along the error, otherwise empty string.

Notes
-----
The errors codes are defined as:
- First two characters: Section where the error happens:
   * GL: Global (no section, like section ordering errors)
   * SS: Short summary
   * ES: Extended summary
   * PR: Parameters
   * RT: Returns
   * YD: Yields
   * RS: Raises
   * WN: Warns
   * SA: See Also
   * NT: Notes
   * RF: References
   * EX: Examples
- Last two characters: Numeric error code inside the section

For example, EX02 is the second codified error in the Examples section
(which in this case is assigned to examples that do not pass the tests).

The error codes, their corresponding error messages, and the details on how
they are validated, are not documented more than in the source code of this
function.