コード例 #1
0
ファイル: style_guide.py プロジェクト: rcharp/airform
    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)
コード例 #2
0
    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
            )
コード例 #3
0
ファイル: test_utils.py プロジェクト: mkubux/pycqa-flake8
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)
コード例 #4
0
ファイル: test_utils.py プロジェクト: mkubux/pycqa-flake8
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
コード例 #5
0
ファイル: test_utils.py プロジェクト: PyCQA/flake8
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
コード例 #6
0
ファイル: test_utils.py プロジェクト: PyCQA/flake8
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)