How to use the instawow.utils.TocReader.from_path_name function in instawow

To help you get started, we’ve selected a few instawow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github layday / instawow / tests / test_utils.py View on Github external
def test_indexing_toc_entries(fake_addon):
    toc_reader = TocReader.from_path_name(fake_addon)
    assert toc_reader['Normal'] == ('Normal', 'Normal entry')
    assert toc_reader['Compact'] == ('Compact', 'Compact entry')
    assert toc_reader['Indented'] == ('Indented', '')
    assert toc_reader['Comment'] == ('Comment', '')
    assert toc_reader['Nonexistent'] == ('Nonexistent', '')
github layday / instawow / tests / test_utils.py View on Github external
def test_tabulate(fake_addon):
    toc_reader = TocReader.from_path_name(fake_addon)
    data = [('key', 'value'), *toc_reader.entries.items()]
    assert (
        tabulate(data)
        == '''\
  key        value    \n\
github layday / instawow / tests / test_utils.py View on Github external
def test_parsing_toc_entries(fake_addon):
    toc_reader = TocReader.from_path_name(fake_addon)
    assert toc_reader.entries == {
        'Normal': 'Normal entry',
        'Compact': 'Compact entry',
    }
github layday / instawow / tests / test_utils.py View on Github external
def test_multiindexing_toc_entries(fake_addon):
    toc_reader = TocReader.from_path_name(fake_addon)
    assert toc_reader['Normal', 'Compact'] == ('Normal', 'Normal entry')
    assert toc_reader['Compact', 'Normal'] == ('Compact', 'Compact entry')
    assert toc_reader['Indented', 'Normal'] == ('Normal', 'Normal entry')
    assert toc_reader['Nonexistent', 'Indented', 'Normal'] == ('Normal', 'Normal entry')
github layday / instawow / tests / test_utils.py View on Github external
def test_loading_toc_from_path(fake_addon):
    TocReader.from_path(fake_addon / 'FakeAddon.toc')
    with pytest.raises(FileNotFoundError):
        TocReader.from_path(fake_addon / 'MissingToc.toc')

    TocReader.from_path_name(fake_addon)
    with pytest.raises(FileNotFoundError):
        TocReader.from_path_name(fake_addon.parent / 'MissingAddon')
github layday / instawow / instawow / cli.py View on Github external
def get_desc_from_toc(pkg: models.Pkg):
        if pkg.source == 'wowi':
            toc_reader = TocReader.from_path_name(obj.m.config.addon_dir / pkg.folders[0].name)
            return toc_reader['Notes'].value
        else:
            return pkg.description
github layday / instawow / instawow / matchers.py View on Github external
def make_addon_folder(path: Path):
        if path.name not in own_folders and path.is_dir() and not path.is_symlink():
            with suppress(FileNotFoundError):
                return AddonFolder(path.name, TocReader.from_path_name(path))