Skip to content

Commit 04dfd3e

Browse files
committed
Remove IAM things, they will stay internal.
1 parent da32d1b commit 04dfd3e

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

aws_doc_sdk_examples_tools/builder.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from dataclasses import dataclass, field
22
import logging
33
from pathlib import Path
4-
import re
5-
from typing import List, Optional, cast
64

75
from aws_doc_sdk_examples_tools.doc_gen import DocGen
86
from aws_doc_sdk_examples_tools.fs import Fs, PathFs
@@ -13,35 +11,6 @@
1311
logger = logging.getLogger(Path(__file__).name)
1412

1513

16-
IAM_PATTERN = re.compile(r'"Version"\s*:\s*"20(08|12)-10-17"\s*,')
17-
IAM_PATTERN_SLASHES = re.compile(r'\\"Version\\"\s*:\s*\\"20(08|12)-10-17\\"\s*,')
18-
# This exciting set of unicode characters is the expanded version of the &IAM-2025-waiver; entity.
19-
IAM_WAIVER = '"Version":"2012-10-17",\u0009\u0009\u0020\u0009\u0020\u0009\u0020'
20-
IAM_WAIVER_SLASHES = '\\"Version\\":\\"2012-10-17\\",\u0009\u0009\u0020\u0009\u0020\u0009\u0020'
21-
22-
23-
def _iam_replace_all(source: Optional[str]):
24-
if source:
25-
return IAM_PATTERN_SLASHES.subn(IAM_WAIVER_SLASHES, IAM_PATTERN.subn(IAM_WAIVER, source)[0])[0]
26-
return None
27-
28-
29-
def _iam_fixup_metadata(meta_folder: Path):
30-
for meta_path in meta_folder.glob("**/*_metadata.yaml"):
31-
with meta_path.open("r") as meta_file:
32-
contents = meta_file.read()
33-
contents = cast(str, _iam_replace_all(contents))
34-
with meta_path.open("w") as meta_file:
35-
meta_file.write(contents)
36-
37-
38-
def _iam_fixup_docgen(doc_gen: DocGen) -> DocGen:
39-
# For performance, do this mutably, but keep the signature open to making DocGen frozen
40-
for snippet in doc_gen.snippets.values():
41-
snippet.code = cast(str, _iam_replace_all(snippet.code))
42-
return doc_gen
43-
44-
4514
@dataclass
4615
class Builder:
4716
root: Path
@@ -71,10 +40,8 @@ def write_snippets(self):
7140
def run(self):
7241
logger.debug("Copying docgen files...")
7342
self.copy_doc_gen()
74-
_iam_fixup_metadata(self.dest)
7543
logger.debug("Collecting snippets...")
7644
self._doc_gen.collect_snippets()
77-
self._doc_gen = _iam_fixup_docgen(self._doc_gen)
7845
logger.debug("Writing snippets...")
7946
self.write_snippets()
8047

0 commit comments

Comments
 (0)