MothPriest 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: MothPriest
3
+ Version: 1.0.0
4
+ Summary: Module for creating intuitive and efficient file parsers
5
+ Author: Cameron Churchwell
6
+ Author-email: cameronchurchwell@icloud.com
7
+ Requires-Dist: pathlib
8
+ Requires-Dist: typing
9
+ Requires-Dist: Pillow
10
+ Requires-Dist: pytest
11
+ Dynamic: author
12
+ Dynamic: author-email
13
+ Dynamic: requires-dist
14
+ Dynamic: summary
@@ -0,0 +1,8 @@
1
+ README.md
2
+ setup.py
3
+ MothPriest.egg-info/PKG-INFO
4
+ MothPriest.egg-info/SOURCES.txt
5
+ MothPriest.egg-info/dependency_links.txt
6
+ MothPriest.egg-info/requires.txt
7
+ MothPriest.egg-info/top_level.txt
8
+ mothpriest/__init__.py
@@ -0,0 +1,4 @@
1
+ pathlib
2
+ typing
3
+ Pillow
4
+ pytest
@@ -0,0 +1 @@
1
+ mothpriest
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: MothPriest
3
+ Version: 1.0.0
4
+ Summary: Module for creating intuitive and efficient file parsers
5
+ Author: Cameron Churchwell
6
+ Author-email: cameronchurchwell@icloud.com
7
+ Requires-Dist: pathlib
8
+ Requires-Dist: typing
9
+ Requires-Dist: Pillow
10
+ Requires-Dist: pytest
11
+ Dynamic: author
12
+ Dynamic: author-email
13
+ Dynamic: requires-dist
14
+ Dynamic: summary
@@ -0,0 +1,44 @@
1
+ # MothPriest
2
+
3
+ Python module for creating intuitive file parsers.
4
+
5
+ Imagine you have a file with the following structure:
6
+
7
+ | Field | Size (Bytes) | Value |
8
+ |----------|----------|----------|
9
+ | Magic | 6 | "STRING" |
10
+ | StringSize | 4 | uint32 (little endian) size String in bytes |
11
+ | String | StringSize | string data for this file |
12
+
13
+ MothPriest makes parsing and editing this file simple:
14
+
15
+ ```Python
16
+ from io import BytesIO
17
+ from mothpriest.parsers import *
18
+
19
+ parser = BlockParser(
20
+ "root",
21
+ [
22
+ MagicParser("STRING", "Magic"),
23
+ IntegerParser("StringSize", size=4, little_endian=True, signed=False),
24
+ StringParser("String", size="StringSize") # Note the reference back to StringSize
25
+ ]
26
+ )
27
+
28
+ data = b"STRING\x1A\x00\x00\x00Lorem ipsum dolor sit amet"
29
+ with BytesIO(data) as buffer:
30
+ parser(buffer)
31
+
32
+ assert parser['String'] == "Lorem ipsum dolor sit amet"
33
+
34
+ parser['String'] = "The quick brown fox jumps over the lazy dog"
35
+ # StringSize is now inconsistent with String, but there is no need to manually update
36
+
37
+ with BytesIO() as buffer:
38
+ parser.unparse(buffer)
39
+ buffer.seek(0)
40
+ output_data = buffer.read()
41
+
42
+ # Note how StringSize is updated automatically
43
+ assert output_data == b"STRING\x2B\x00\x00\x00The quick brown fox jumps over the lazy dog"
44
+ ```
@@ -0,0 +1 @@
1
+ from .parsers import *
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,16 @@
1
+ from distutils.core import setup
2
+
3
+ setup(
4
+ name='MothPriest',
5
+ version='1.0.0',
6
+ description='Module for creating intuitive and efficient file parsers',
7
+ author='Cameron Churchwell',
8
+ author_email='cameronchurchwell@icloud.com',
9
+ install_requires=[
10
+ 'pathlib',
11
+ 'typing',
12
+ 'Pillow',
13
+ 'pytest'
14
+ ],
15
+ packages=['mothpriest'],
16
+ )