hexconv 0.2.5__tar.gz → 0.2.7__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.
- {hexconv-0.2.5/src/hexconv.egg-info → hexconv-0.2.7}/PKG-INFO +20 -7
- {hexconv-0.2.5 → hexconv-0.2.7}/README.md +19 -6
- {hexconv-0.2.5 → hexconv-0.2.7}/pyproject.toml +1 -1
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv/_core.py +2 -2
- {hexconv-0.2.5 → hexconv-0.2.7/src/hexconv.egg-info}/PKG-INFO +20 -7
- {hexconv-0.2.5 → hexconv-0.2.7}/LICENSE +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/MANIFEST.in +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/setup.cfg +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv/__init__.py +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv/py.typed +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv.egg-info/SOURCES.txt +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv.egg-info/dependency_links.txt +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv.egg-info/requires.txt +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/src/hexconv.egg-info/top_level.txt +0 -0
- {hexconv-0.2.5 → hexconv-0.2.7}/tests/test_hexconv.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hexconv
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Pythonic conversion toolkit for bytes, hex, integers, arrays, binary strings, base64, and text.
|
|
5
5
|
Author: hexconv contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -59,6 +59,25 @@ hx.from_text("data").hex
|
|
|
59
59
|
# '64617461'
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
The bare `.hex`, `.text`, and `.bytes` properties are shortcuts for zero-argument
|
|
63
|
+
`to_*` methods. Call the method form when you need options:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
value = hx.from_hex("deadbeef")
|
|
67
|
+
|
|
68
|
+
value.to_hex()
|
|
69
|
+
# 'deadbeef' (same as value.hex)
|
|
70
|
+
|
|
71
|
+
value.to_hex(sep=" ", uppercase=True)
|
|
72
|
+
# 'DE AD BE EF'
|
|
73
|
+
|
|
74
|
+
value.to_bytes()
|
|
75
|
+
# b'\xde\xad\xbe\xef'
|
|
76
|
+
|
|
77
|
+
hx.from_hex("68656c6c6f").to_text()
|
|
78
|
+
# 'hello'
|
|
79
|
+
```
|
|
80
|
+
|
|
62
81
|
## Fast compose
|
|
63
82
|
|
|
64
83
|
Create your own converters by snapping together
|
|
@@ -186,12 +205,6 @@ conv("12345678")
|
|
|
186
205
|
More conversion patterns:
|
|
187
206
|
|
|
188
207
|
```python
|
|
189
|
-
hx.Text()("hello").bytes
|
|
190
|
-
# b'hello'
|
|
191
|
-
|
|
192
|
-
hx.Hex()("68656c6c6f").text
|
|
193
|
-
# 'hello'
|
|
194
|
-
|
|
195
208
|
hx.BytesArray()([0x4F, 0x4B]).to(hx.Text())
|
|
196
209
|
# 'OK'
|
|
197
210
|
|
|
@@ -30,6 +30,25 @@ hx.from_text("data").hex
|
|
|
30
30
|
# '64617461'
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
The bare `.hex`, `.text`, and `.bytes` properties are shortcuts for zero-argument
|
|
34
|
+
`to_*` methods. Call the method form when you need options:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
value = hx.from_hex("deadbeef")
|
|
38
|
+
|
|
39
|
+
value.to_hex()
|
|
40
|
+
# 'deadbeef' (same as value.hex)
|
|
41
|
+
|
|
42
|
+
value.to_hex(sep=" ", uppercase=True)
|
|
43
|
+
# 'DE AD BE EF'
|
|
44
|
+
|
|
45
|
+
value.to_bytes()
|
|
46
|
+
# b'\xde\xad\xbe\xef'
|
|
47
|
+
|
|
48
|
+
hx.from_hex("68656c6c6f").to_text()
|
|
49
|
+
# 'hello'
|
|
50
|
+
```
|
|
51
|
+
|
|
33
52
|
## Fast compose
|
|
34
53
|
|
|
35
54
|
Create your own converters by snapping together
|
|
@@ -157,12 +176,6 @@ conv("12345678")
|
|
|
157
176
|
More conversion patterns:
|
|
158
177
|
|
|
159
178
|
```python
|
|
160
|
-
hx.Text()("hello").bytes
|
|
161
|
-
# b'hello'
|
|
162
|
-
|
|
163
|
-
hx.Hex()("68656c6c6f").text
|
|
164
|
-
# 'hello'
|
|
165
|
-
|
|
166
179
|
hx.BytesArray()([0x4F, 0x4B]).to(hx.Text())
|
|
167
180
|
# 'OK'
|
|
168
181
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "hexconv"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.7"
|
|
8
8
|
description = "Pythonic conversion toolkit for bytes, hex, integers, arrays, binary strings, base64, and text."
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -462,7 +462,7 @@ _BINARY_CHARS = re.compile(r"^[01]*$")
|
|
|
462
462
|
|
|
463
463
|
@dataclass(frozen=True)
|
|
464
464
|
class Value:
|
|
465
|
-
"""
|
|
465
|
+
"""Byte-backed value with output methods for common formats."""
|
|
466
466
|
|
|
467
467
|
_data: bytes
|
|
468
468
|
source: str | None = None
|
|
@@ -987,7 +987,7 @@ class Converter:
|
|
|
987
987
|
return parsed.to(self.to, **self.output_options)
|
|
988
988
|
|
|
989
989
|
def parse(self, value: Any) -> Value:
|
|
990
|
-
"""Parse a value and return the
|
|
990
|
+
"""Parse a value and return the parsed Value instead of emitting."""
|
|
991
991
|
|
|
992
992
|
return _parse(value, self.from_, **self.input_options)
|
|
993
993
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hexconv
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Pythonic conversion toolkit for bytes, hex, integers, arrays, binary strings, base64, and text.
|
|
5
5
|
Author: hexconv contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -59,6 +59,25 @@ hx.from_text("data").hex
|
|
|
59
59
|
# '64617461'
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
The bare `.hex`, `.text`, and `.bytes` properties are shortcuts for zero-argument
|
|
63
|
+
`to_*` methods. Call the method form when you need options:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
value = hx.from_hex("deadbeef")
|
|
67
|
+
|
|
68
|
+
value.to_hex()
|
|
69
|
+
# 'deadbeef' (same as value.hex)
|
|
70
|
+
|
|
71
|
+
value.to_hex(sep=" ", uppercase=True)
|
|
72
|
+
# 'DE AD BE EF'
|
|
73
|
+
|
|
74
|
+
value.to_bytes()
|
|
75
|
+
# b'\xde\xad\xbe\xef'
|
|
76
|
+
|
|
77
|
+
hx.from_hex("68656c6c6f").to_text()
|
|
78
|
+
# 'hello'
|
|
79
|
+
```
|
|
80
|
+
|
|
62
81
|
## Fast compose
|
|
63
82
|
|
|
64
83
|
Create your own converters by snapping together
|
|
@@ -186,12 +205,6 @@ conv("12345678")
|
|
|
186
205
|
More conversion patterns:
|
|
187
206
|
|
|
188
207
|
```python
|
|
189
|
-
hx.Text()("hello").bytes
|
|
190
|
-
# b'hello'
|
|
191
|
-
|
|
192
|
-
hx.Hex()("68656c6c6f").text
|
|
193
|
-
# 'hello'
|
|
194
|
-
|
|
195
208
|
hx.BytesArray()([0x4F, 0x4B]).to(hx.Text())
|
|
196
209
|
# 'OK'
|
|
197
210
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|