module documentation

Undocumented

Exception ConfigTOMLValueError Undocumented
Function check_follow_imports Undocumented
Function convert_to_boolean Return a boolean value translating from other types if necessary.
Function destructure_overrides Take the new [[tool.mypy.overrides]] section array in the pyproject.toml file, and convert it back to a flatter structure that the existing config_parser can handle.
Function expand_path Expand the user home directory and any environment variables contained within the provided path.
Function get_config_module_names Undocumented
Function get_prefix Undocumented
Function is_toml Undocumented
Function mypy_comments_to_config_map Rewrite the mypy comment syntax into ini file syntax.
Function parse_config_file Parse a config file into an Options object.
Function parse_mypy_comments Parse a collection of inline mypy: configuration comments.
Function parse_section Parse one section of a config file.
Function parse_version Undocumented
Function split_and_match_files Take a string representing a list of files/directories (with support for globbing through the glob library).
Function split_and_match_files_list Take a list of files/directories (with support for globbing through the glob library).
Function split_commas Undocumented
Function split_directive Split s on commas, except during quoted sections.
Function str_or_array_as_list Undocumented
Function try_split Split and trim a str or list of str into a list of str
Function validate_codes Undocumented
Constant ini_config_types Undocumented
Constant toml_config_types Undocumented
Type Alias _CONFIG_VALUE_TYPES Undocumented
Type Alias _INI_PARSER_CALLABLE Undocumented
def check_follow_imports(choice: str) -> str: (source)

Undocumented

def convert_to_boolean(value: Any|None) -> bool: (source)

Return a boolean value translating from other types if necessary.

def destructure_overrides(toml_data: dict[str, Any]) -> dict[str, Any]: (source)

Take the new [[tool.mypy.overrides]] section array in the pyproject.toml file, and convert it back to a flatter structure that the existing config_parser can handle. E.g. the following pyproject.toml file: [[tool.mypy.overrides]] module = [ "a.b", "b.*" ] disallow_untyped_defs = true [[tool.mypy.overrides]] module = 'c' disallow_untyped_defs = false Would map to the following config dict that it would have gotten from parsing an equivalent ini file: { "mypy-a.b": { disallow_untyped_defs = true, }, "mypy-b.*": { disallow_untyped_defs = true, }, "mypy-c": { disallow_untyped_defs: false, }, }

def expand_path(path: str) -> str: (source)

Expand the user home directory and any environment variables contained within the provided path.

def get_config_module_names(filename: str|None, modules: list[str]) -> str: (source)

Undocumented

def get_prefix(file_read: str, name: str) -> str: (source)

Undocumented

def is_toml(filename: str) -> bool: (source)

Undocumented

def mypy_comments_to_config_map(line: str, template: Options) -> tuple[dict[str, str], list[str]]: (source)

Rewrite the mypy comment syntax into ini file syntax. Returns

def parse_config_file(options: Options, set_strict_flags: Callable[[], None], filename: str|None, stdout: TextIO|None = None, stderr: TextIO|None = None): (source)

Parse a config file into an Options object. Errors are written to stderr but are not fatal. If filename is None, fall back to default config files.

def parse_mypy_comments(args: list[tuple[int, str]], template: Options) -> tuple[dict[str, object], list[tuple[int, str]]]: (source)

Parse a collection of inline mypy: configuration comments. Returns a dictionary of options to be applied and a list of error messages generated.

def parse_section(prefix: str, template: Options, set_strict_flags: Callable[[], None], section: Mapping[str, Any], config_types: dict[str, Any], stderr: TextIO = sys.stderr) -> tuple[dict[str, object], dict[str, str]]: (source)

Parse one section of a config file. Returns a dict of option values encountered, and a dict of report directories.

def parse_version(v: str|float) -> tuple[int, int]: (source)

Undocumented

def split_and_match_files(paths: str) -> list[str]: (source)

Take a string representing a list of files/directories (with support for globbing through the glob library). Where a path/glob matches no file, we still include the raw path in the resulting list. Returns a list of file paths

def split_and_match_files_list(paths: Sequence[str]) -> list[str]: (source)

Take a list of files/directories (with support for globbing through the glob library). Where a path/glob matches no file, we still include the raw path in the resulting list. Returns a list of file paths

def split_commas(value: str) -> list[str]: (source)

Undocumented

def split_directive(s: str) -> tuple[list[str], list[str]]: (source)

Split s on commas, except during quoted sections. Returns the parts and a list of error messages.

def str_or_array_as_list(v: str|Sequence[str]) -> list[str]: (source)

Undocumented

def try_split(v: str|Sequence[str], split_regex: str = '[,]') -> list[str]: (source)

Split and trim a str or list of str into a list of str

def validate_codes(codes: list[str]) -> list[str]: (source)

Undocumented

Undocumented

Value
{'python_version': parse_version,
 'custom_typing_module': str,
 'custom_typeshed_dir': expand_path,
 'mypy_path': (lambda s: [expand_path(p.strip()) for p in re.split('[,:]', s)]),
 'files': split_and_match_files,
 'quickstart_file': expand_path,
 'junit_xml': expand_path,
...

Undocumented

Value
ini_config_types.copy()
_CONFIG_VALUE_TYPES: _TypeAlias = (source)

Undocumented

Value
Union[str, bool, int, float, Dict[str, str], List[str], Tuple[int, int]]
_INI_PARSER_CALLABLE: _TypeAlias = (source)

Undocumented

Value
Callable[[Any], _CONFIG_VALUE_TYPES]