ethspecify 0.3.2__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ethspecify
3
- Version: 0.3.2
3
+ Version: 0.3.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
@@ -589,9 +589,18 @@ def sort_specref_yaml(yaml_file):
589
589
  with open(yaml_file, 'r') as f:
590
590
  content_str = f.read()
591
591
 
592
- # Try to fix common YAML issues with unquoted search strings containing colons
593
- # This is the same fix used in check_source_files
594
- content_str = re.sub(r'(\s+search:\s+)([^"\n]+:)(\s*$)', r'\1"\2"\3', content_str, flags=re.MULTILINE)
592
+ # Extract search values that originally had single or double quotes before YAML parsing
593
+ # This preserves the original quoting style exactly
594
+ single_quoted_searches = set()
595
+ for match in re.finditer(r"search:\s*'([^']*)'", content_str):
596
+ single_quoted_searches.add(match.group(1))
597
+ double_quoted_searches = set()
598
+ for match in re.finditer(r'search:\s*"([^"]*)"', content_str):
599
+ double_quoted_searches.add(match.group(1))
600
+
601
+ # Temporarily quote unquoted search strings with colons so YAML can parse them
602
+ # This doesn't affect the output - we restore original quoting when writing
603
+ content_str = re.sub(r'(\s+search:\s+)([^"\'\n]+:)(\s*$)', r'\1"\2"\3', content_str, flags=re.MULTILINE)
595
604
 
596
605
  try:
597
606
  content = yaml.safe_load(content_str)
@@ -672,16 +681,11 @@ def sort_specref_yaml(yaml_file):
672
681
  output_lines.append(f" - file: {source.get('file', '')}")
673
682
  if 'search' in source:
674
683
  search_val = source['search']
675
- # Only quote if:
676
- # 1. Contains a colon followed by space or end of string (YAML mapping issue)
677
- # 2. Not already quoted
678
- # 3. Doesn't contain internal quotes (like regex patterns)
679
- if ((':' in search_val or search_val.endswith(':')) and
680
- not (search_val.startswith('"') and search_val.endswith('"')) and
681
- '"' not in search_val):
682
- # Only quote simple strings with colons, not complex patterns
683
- if not any(char in search_val for char in ['\\', '*', '|', '[', ']', '(', ')']):
684
- search_val = f'"{search_val}"'
684
+ # Preserve original quoting style exactly
685
+ if search_val in single_quoted_searches:
686
+ search_val = f"'{search_val}'"
687
+ elif search_val in double_quoted_searches:
688
+ search_val = f'"{search_val}"'
685
689
  output_lines.append(f" search: {search_val}")
686
690
  if 'regex' in source:
687
691
  # Keep boolean values lowercase for consistency
@@ -888,6 +892,18 @@ def add_missing_entries_to_yaml(yaml_file, new_entries):
888
892
  if not new_entries:
889
893
  return
890
894
 
895
+ # Extract search values that originally had single or double quotes before YAML parsing
896
+ # This preserves the original quoting style exactly
897
+ single_quoted_searches = set()
898
+ double_quoted_searches = set()
899
+ if os.path.exists(yaml_file):
900
+ with open(yaml_file, 'r') as f:
901
+ content_str = f.read()
902
+ for match in re.finditer(r"search:\s*'([^']*)'", content_str):
903
+ single_quoted_searches.add(match.group(1))
904
+ for match in re.finditer(r'search:\s*"([^"]*)"', content_str):
905
+ double_quoted_searches.add(match.group(1))
906
+
891
907
  # Load existing entries
892
908
  existing_entries = load_yaml_entries(yaml_file)
893
909
 
@@ -931,7 +947,13 @@ def add_missing_entries_to_yaml(yaml_file, new_entries):
931
947
  if isinstance(source, dict):
932
948
  f.write(f' - file: {source.get("file", "")}\n')
933
949
  if 'search' in source:
934
- f.write(f' search: {source["search"]}\n')
950
+ search_val = source["search"]
951
+ # Preserve original quoting style exactly
952
+ if search_val in single_quoted_searches:
953
+ search_val = f"'{search_val}'"
954
+ elif search_val in double_quoted_searches:
955
+ search_val = f'"{search_val}"'
956
+ f.write(f' search: {search_val}\n')
935
957
  if 'regex' in source:
936
958
  f.write(f' regex: {source["regex"]}\n')
937
959
  else:
@@ -1690,6 +1712,17 @@ def update_entry_names_in_yaml_files(project_dir, specrefs_files):
1690
1712
  if not os.path.exists(yaml_path):
1691
1713
  continue
1692
1714
 
1715
+ # Extract search values that originally had single or double quotes before YAML parsing
1716
+ # This preserves the original quoting style exactly
1717
+ single_quoted_searches = set()
1718
+ double_quoted_searches = set()
1719
+ with open(yaml_path, 'r') as f:
1720
+ content_str = f.read()
1721
+ for match in re.finditer(r"search:\s*'([^']*)'", content_str):
1722
+ single_quoted_searches.add(match.group(1))
1723
+ for match in re.finditer(r'search:\s*"([^"]*)"', content_str):
1724
+ double_quoted_searches.add(match.group(1))
1725
+
1693
1726
  # Load existing entries
1694
1727
  existing_entries = load_yaml_entries(yaml_path)
1695
1728
  if not existing_entries:
@@ -1737,7 +1770,13 @@ def update_entry_names_in_yaml_files(project_dir, specrefs_files):
1737
1770
  if isinstance(source, dict):
1738
1771
  f.write(f' - file: {source.get("file", "")}\n')
1739
1772
  if 'search' in source:
1740
- f.write(f' search: {source["search"]}\n')
1773
+ search_val = source["search"]
1774
+ # Preserve original quoting style exactly
1775
+ if search_val in single_quoted_searches:
1776
+ search_val = f"'{search_val}'"
1777
+ elif search_val in double_quoted_searches:
1778
+ search_val = f'"{search_val}"'
1779
+ f.write(f' search: {search_val}\n')
1741
1780
  if 'regex' in source:
1742
1781
  f.write(f' regex: {source["regex"]}\n')
1743
1782
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ethspecify
3
- Version: 0.3.2
3
+ Version: 0.3.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
@@ -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.3.2",
11
+ version="0.3.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