コード例 #1
0
ファイル: ignore.py プロジェクト: vasinkd/dvc
    def _read_patterns(self, binary_stream):
        negate_patterns = []
        patterns = []
        for pattern in read_ignore_patterns(binary_stream):
            if pattern.lstrip().startswith(b"!"):
                negate_patterns.append(pattern)
            else:
                patterns.append(pattern)

        return negate_patterns, patterns
コード例 #2
0
    def test_read_file(self):
        f = BytesIO(b"""
# a comment

# and an empty line:

\\#not a comment
!negative
with trailing whitespace 
with escaped trailing whitespace\\ 
""")  # noqa: W291
        self.assertEqual(list(read_ignore_patterns(f)), [
            b'\\#not a comment', b'!negative', b'with trailing whitespace',
            b'with escaped trailing whitespace '
        ])
コード例 #3
0
ファイル: test_ignore.py プロジェクト: atbradley/dulwich
    def test_read_file(self):
        f = BytesIO(b"""
# a comment

# and an empty line:

\#not a comment
!negative
with trailing whitespace 
with escaped trailing whitespace\ 
""")  # noqa: W291
        self.assertEqual(list(read_ignore_patterns(f)), [
            b'\\#not a comment',
            b'!negative',
            b'with trailing whitespace',
            b'with escaped trailing whitespace '
        ])
コード例 #4
0
ファイル: test_ignore.py プロジェクト: pmrowla/dulwich
    def test_read_file(self):
        f = BytesIO(b"""
# a comment
\x20\x20
# and an empty line:

\\#not a comment
!negative
with trailing whitespace 
with escaped trailing whitespace\\ 
""")  # noqa: W291
        self.assertEqual(
            list(read_ignore_patterns(f)),
            [
                b"\\#not a comment",
                b"!negative",
                b"with trailing whitespace",
                b"with escaped trailing whitespace ",
            ],
        )