コード例 #1
0
ファイル: get_config.py プロジェクト: tv42/roast
def get_config(cfg, type_, path):
    found = None
    for section in cfg.sections():
        try:
            (type, glob) = section.split(None, 1)
        except ValueError:
            continue
        if type != type_:
            continue
        if not match_path.match_path(path=path, glob=glob):
            continue
        if found is None:
            found = {}
        found.update(cfg.items(section))

    return found
コード例 #2
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_exact():
    assert match_path('foo', 'foo')
コード例 #3
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_prefix():
    # we want "example.com" to match "example.com/foo"
    assert match_path('foo/bar/baz', 'foo/bar')
    assert not match_path('foo/barbaz', 'foo/bar')
コード例 #4
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_simple_mismatch():
    assert not match_path('foo', 'bar')
コード例 #5
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_prefix_wrong_way():
    assert not match_path('foo/bar/baz', 'bar/baz')
コード例 #6
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_wildcard_matches_slashes():
    assert match_path('foo/bar', 'fo*ar')
コード例 #7
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_wildcard_partial():
    assert match_path('foobar', 'fo*ar')
コード例 #8
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_wildcard_full():
    assert match_path('foo', '*')
コード例 #9
0
ファイル: test_match_path.py プロジェクト: mchubby/roast
def test_exact_dirs():
    assert match_path('foo/bar', 'foo/bar')