ethspecify 0.1.2__tar.gz → 0.1.3__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.
Potentially problematic release.
This version of ethspecify might be problematic. Click here for more details.
- {ethspecify-0.1.2 → ethspecify-0.1.3}/PKG-INFO +3 -3
- {ethspecify-0.1.2 → ethspecify-0.1.3}/README.md +2 -2
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify/core.py +34 -43
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify.egg-info/PKG-INFO +3 -3
- {ethspecify-0.1.2 → ethspecify-0.1.3}/setup.py +1 -1
- {ethspecify-0.1.2 → ethspecify-0.1.3}/LICENSE +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify/__init__.py +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify/cli.py +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify.egg-info/SOURCES.txt +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify.egg-info/dependency_links.txt +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify.egg-info/entry_points.txt +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify.egg-info/requires.txt +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/ethspecify.egg-info/top_level.txt +0 -0
- {ethspecify-0.1.2 → ethspecify-0.1.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ethspecify
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: A utility for processing Ethereum specification tags.
|
|
5
5
|
Home-page: https://github.com/jtraglia/ethspecify
|
|
6
6
|
Author: Justin Traglia
|
|
@@ -45,13 +45,13 @@ In your client, add HTML tags like this:
|
|
|
45
45
|
|
|
46
46
|
```
|
|
47
47
|
/*
|
|
48
|
-
* <spec fn="is_fully_withdrawable_validator" fork="deneb"
|
|
48
|
+
* <spec fn="is_fully_withdrawable_validator" fork="deneb" />
|
|
49
49
|
*/
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
```
|
|
53
53
|
/*
|
|
54
|
-
* <spec ssz_object="BeaconState" fork="electra" style="diff"
|
|
54
|
+
* <spec ssz_object="BeaconState" fork="electra" style="diff" />
|
|
55
55
|
*/
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -21,13 +21,13 @@ In your client, add HTML tags like this:
|
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
/*
|
|
24
|
-
* <spec fn="is_fully_withdrawable_validator" fork="deneb"
|
|
24
|
+
* <spec fn="is_fully_withdrawable_validator" fork="deneb" />
|
|
25
25
|
*/
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
```
|
|
29
29
|
/*
|
|
30
|
-
* <spec ssz_object="BeaconState" fork="electra" style="diff"
|
|
30
|
+
* <spec ssz_object="BeaconState" fork="electra" style="diff" />
|
|
31
31
|
*/
|
|
32
32
|
```
|
|
33
33
|
|
|
@@ -278,58 +278,49 @@ def replace_spec_tags(file_path):
|
|
|
278
278
|
re.DOTALL
|
|
279
279
|
)
|
|
280
280
|
|
|
281
|
+
def rebuild_opening_tag(attributes, hash_value):
|
|
282
|
+
# Rebuild a fresh opening tag from attributes, overriding any existing hash.
|
|
283
|
+
new_opening = "<spec"
|
|
284
|
+
for key, val in attributes.items():
|
|
285
|
+
if key != "hash":
|
|
286
|
+
new_opening += f' {key}="{val}"'
|
|
287
|
+
new_opening += f' hash="{hash_value}">'
|
|
288
|
+
return new_opening
|
|
289
|
+
|
|
281
290
|
def replacer(match):
|
|
291
|
+
# Always use the tag text from whichever group matched:
|
|
282
292
|
if match.group("self") is not None:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
293
|
+
original_tag_text = match.group("self")
|
|
294
|
+
else:
|
|
295
|
+
original_tag_text = match.group("long")
|
|
296
|
+
|
|
297
|
+
attributes = extract_attributes(original_tag_text)
|
|
298
|
+
print(f"spec tag: {attributes}")
|
|
299
|
+
preset, fork, style = parse_common_attributes(attributes)
|
|
300
|
+
spec = get_spec(attributes, preset, fork)
|
|
301
|
+
hash_value = hashlib.sha256(spec.encode('utf-8')).hexdigest()[:8]
|
|
302
|
+
|
|
303
|
+
if style == "hash":
|
|
304
|
+
# For hash style, output a self-closing tag.
|
|
305
|
+
if 'hash="' in original_tag_text:
|
|
291
306
|
updated_tag = re.sub(
|
|
292
307
|
r'(hash=")[^"]*(")',
|
|
293
308
|
lambda m: f'{m.group(1)}{hash_value}{m.group(2)}',
|
|
294
|
-
|
|
309
|
+
original_tag_text
|
|
295
310
|
)
|
|
296
311
|
else:
|
|
297
|
-
|
|
298
|
-
updated_tag = tag_text[:-2] + f' hash="{hash_value}"' + tag_text[-2:]
|
|
312
|
+
updated_tag = re.sub(r'\s*/>$', f' hash="{hash_value}" />', original_tag_text)
|
|
299
313
|
return updated_tag
|
|
300
314
|
else:
|
|
301
|
-
#
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
preset, fork, style = parse_common_attributes(attributes)
|
|
311
|
-
spec = get_spec(attributes, preset, fork)
|
|
312
|
-
hash_value = hashlib.sha256(spec.encode('utf-8')).hexdigest()[:8]
|
|
313
|
-
if 'hash="' in opening_tag_full:
|
|
314
|
-
updated_opening = re.sub(
|
|
315
|
-
r'(hash=")[^"]*(")',
|
|
316
|
-
lambda m: f'{m.group(1)}{hash_value}{m.group(2)}',
|
|
317
|
-
opening_tag_full
|
|
318
|
-
)
|
|
319
|
-
else:
|
|
320
|
-
updated_opening = opening_tag_full[:-1] + f' hash="{hash_value}">'
|
|
321
|
-
if style == "hash":
|
|
322
|
-
updated_tag = re.sub(r'\s*</spec>\s*$', '', updated_opening)
|
|
323
|
-
updated_tag = re.sub(r'\s*>$', '', updated_tag) + " />"
|
|
324
|
-
else:
|
|
325
|
-
spec_content = get_spec_item(attributes)
|
|
326
|
-
prefix = content[:match.start()].splitlines()[-1]
|
|
327
|
-
prefixed_spec = "\n".join(
|
|
328
|
-
f"{prefix}{line}" if line.rstrip() else prefix.rstrip()
|
|
329
|
-
for line in spec_content.rstrip().split("\n")
|
|
330
|
-
)
|
|
331
|
-
long_opening = updated_opening.rstrip(">/") + ">"
|
|
332
|
-
updated_tag = f"{long_opening}\n{prefixed_spec}\n{prefix}</spec>"
|
|
315
|
+
# For full/diff styles, always rebuild as a long (paired) tag.
|
|
316
|
+
new_opening = rebuild_opening_tag(attributes, hash_value)
|
|
317
|
+
spec_content = get_spec_item(attributes)
|
|
318
|
+
prefix = content[:match.start()].splitlines()[-1]
|
|
319
|
+
prefixed_spec = "\n".join(
|
|
320
|
+
f"{prefix}{line}" if line.rstrip() else prefix.rstrip()
|
|
321
|
+
for line in spec_content.rstrip().split("\n")
|
|
322
|
+
)
|
|
323
|
+
updated_tag = f"{new_opening}\n{prefixed_spec}\n{prefix}</spec>"
|
|
333
324
|
return updated_tag
|
|
334
325
|
|
|
335
326
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ethspecify
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: A utility for processing Ethereum specification tags.
|
|
5
5
|
Home-page: https://github.com/jtraglia/ethspecify
|
|
6
6
|
Author: Justin Traglia
|
|
@@ -45,13 +45,13 @@ In your client, add HTML tags like this:
|
|
|
45
45
|
|
|
46
46
|
```
|
|
47
47
|
/*
|
|
48
|
-
* <spec fn="is_fully_withdrawable_validator" fork="deneb"
|
|
48
|
+
* <spec fn="is_fully_withdrawable_validator" fork="deneb" />
|
|
49
49
|
*/
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
```
|
|
53
53
|
/*
|
|
54
|
-
* <spec ssz_object="BeaconState" fork="electra" style="diff"
|
|
54
|
+
* <spec ssz_object="BeaconState" fork="electra" style="diff" />
|
|
55
55
|
*/
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -8,7 +8,7 @@ long_description = (this_directory / "README.md").read_text(encoding="utf-8")
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="ethspecify",
|
|
11
|
-
version="0.1.
|
|
11
|
+
version="0.1.3",
|
|
12
12
|
description="A utility for processing Ethereum specification tags.",
|
|
13
13
|
long_description=long_description,
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
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
|