def populate_style_guides_with(self, options): """Generate style guides from the per-file-ignores option. :param options: The original options parsed from the CLI and config file. :type options: :class:`~optparse.Values` :returns: A copy of the default style guide with overridden values. :rtype: :class:`~flake8.style_guide.StyleGuide` """ per_file = utils.parse_files_to_codes_mapping(options.per_file_ignores) for filename, violations in per_file: yield self.default_style_guide.copy(filename=filename, extend_ignore_with=violations)
def populate_style_guides_with(self, options): """Generate style guides from the per-file-ignores option. :param options: The original options parsed from the CLI and config file. :type options: :class:`~optparse.Values` :returns: A copy of the default style guide with overridden values. :rtype: :class:`~flake8.style_guide.StyleGuide` """ per_file = utils.parse_files_to_codes_mapping( options.per_file_ignores ) for filename, violations in per_file: yield self.default_style_guide.copy( filename=filename, extend_ignore_with=violations )
def test_invalid_file_list(value): """Test parsing of invalid files-to-codes mappings.""" with pytest.raises(exceptions.ExecutionError): utils.parse_files_to_codes_mapping(value)
def test_parse_files_to_codes_mapping(value, expected): """Test parsing of valid files-to-codes mappings.""" assert utils.parse_files_to_codes_mapping(value) == expected
def test_parse_files_to_codes_mapping(value, expected): """Test parsing of valid files-to-codes mappings.""" assert utils.parse_files_to_codes_mapping(value) == expected
def test_invalid_file_list(value): """Test parsing of invalid files-to-codes mappings.""" with pytest.raises(exceptions.ExecutionError): utils.parse_files_to_codes_mapping(value)