Skip to main content

A package for reading and writing World of Warcraft addon TOC files.

Project description

Tests

pytoc

A Python package for parsing World of Warcraft TOC files used in addons.

Installation

You can install this package via pip.

pip install wow-pytoc

Usage

Reading a TOC file:

from pytoc import TOCFile, Dependency

file_path: str = "X:/path/to/my/addon.toc"
toc = TOCFile(file_path)

print(toc.Interface)
print(toc.Title)
print(toc.LocalizedTitles["frFR"])
print(toc.AdditionalFields["X-Website"])

for file in toc.Files:
    print(file)

for dep in toc.Dependencies
    dep: Dependency
    print(f"Dependency Name: {dep.Name} Required: {dep.Required}")

Writing a TOC file:

from pytoc import TOCFile

toc = TOCFile()
toc.Interface = 110000
toc.Author = "Ghost"
toc.Files = ["file1.lua", "file2.xml"]

required = True
toc.add_dependency("totalRP3", required)

output = "path/to/dest.toc"
toc.export(output)

For some examples, take a look at the test_toc.py file.

Notes

All dependency fields will be added to the TOCFile.Dependencies list. Fields that are not available to addons, or extra fields that don't begin with "X-" will be added directly to the object namespace.

Fields will overwrite eachother if more than one of that directive is present in the TOC file.

For certain fields that accept comma-delimited input, the attribute may end up being either a list or a str|int, depending on if there are multiple entries or just a single one.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wow_pytoc-0.5.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

wow_pytoc-0.5.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file wow_pytoc-0.5.1.tar.gz.

File metadata

  • Download URL: wow_pytoc-0.5.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for wow_pytoc-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b05e828fd0c958b98847ff39a6230a90a611a795cb48d94d6af6c06a4d1abc85
MD5 afb2ac0015d097512896db9223edca08
BLAKE2b-256 efce3d6db3c59c582c1c7b8333f80bf87c0f5038e4253674c6b17f95d993bd03

See more details on using hashes here.

File details

Details for the file wow_pytoc-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: wow_pytoc-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for wow_pytoc-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c6f4f24b949b04e16c8c0b80b94ad1a988b5c14b9d2cbc985e957b6ff393730
MD5 936286b44c0fa4356c3cc02d0fb170a6
BLAKE2b-256 d6debceaf1f4ab3b297de43c1316e65dc8205c40f3f0bcc1fa46530fd22bfe3b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page