diff --git a/aws_doc_sdk_examples_tools/doc_gen_test.py b/aws_doc_sdk_examples_tools/doc_gen_test.py index 5d6db57..2ff205e 100644 --- a/aws_doc_sdk_examples_tools/doc_gen_test.py +++ b/aws_doc_sdk_examples_tools/doc_gen_test.py @@ -253,6 +253,7 @@ def test_doc_gen_encoder(sample_doc_gen: DocGen): assert "examples" in decoded assert decoded["examples"] == { "s3_PutObject": { + "suppress_publish": False, "category": None, "doc_filenames": None, "file": "filea.txt", diff --git a/aws_doc_sdk_examples_tools/fs.py b/aws_doc_sdk_examples_tools/fs.py index e5eec01..e06e6e6 100644 --- a/aws_doc_sdk_examples_tools/fs.py +++ b/aws_doc_sdk_examples_tools/fs.py @@ -85,9 +85,9 @@ def __init__(self, fs: Dict[Path, str]): self.fs = fs def glob(self, path: Path, glob: str) -> Generator[Path, None, None]: - path_s = str(path) + path_s = path.as_posix() for key in self.fs.keys(): - key_s = str(key) + key_s = key.as_posix() if key_s.startswith(path_s): if fnmatch(key_s, glob): yield key @@ -100,9 +100,9 @@ def readlines(self, path: Path, encoding: str = "utf-8") -> List[str]: return content.splitlines(keepends=True) def write(self, path: Path, content: str): - base = str(path.parent) + base = path.parent.as_posix() assert any( - [str(key).startswith(base) for key in self.fs] + [key.as_posix().startswith(base) for key in self.fs] ), "No parent folder, this will probably fail without a call to mkdir in a real file system!" self.fs[path] = content @@ -110,7 +110,7 @@ def stat(self, path: Path): if path in self.fs: return Stat(path, True, True) for item in self.fs.keys(): - if str(item).startswith(str(path)): + if item.as_posix().startswith(path.as_posix()): return Stat(path, True, False) return Stat(path, False, False) @@ -123,11 +123,11 @@ def list(self, path: Path) -> List[Path]: return [] # Gather all entries that are immediate children of `path` - prefix = str(path).rstrip("/") + "/" + prefix = path.as_posix().rstrip("/") + "/" children = set() for item in self.fs.keys(): - item_s = str(item) + item_s = item.as_posix() if item_s.startswith(prefix): # Determine the remainder path after the prefix remainder = item_s[len(prefix) :] diff --git a/aws_doc_sdk_examples_tools/metadata.py b/aws_doc_sdk_examples_tools/metadata.py index 8308255..92a0dd9 100755 --- a/aws_doc_sdk_examples_tools/metadata.py +++ b/aws_doc_sdk_examples_tools/metadata.py @@ -161,6 +161,7 @@ class Example: doc_filenames: Optional[DocFilenames] = field(default=None) synopsis_list: List[str] = field(default_factory=list) source_key: Optional[str] = field(default=None) + suppress_publish: Optional[bool] = field(default=False) def fill_display_fields(self, categories: Dict[str, Category], service, action): category = self.choose_category(categories) diff --git a/aws_doc_sdk_examples_tools/yaml_writer.py b/aws_doc_sdk_examples_tools/yaml_writer.py index 64be9c1..16623b8 100644 --- a/aws_doc_sdk_examples_tools/yaml_writer.py +++ b/aws_doc_sdk_examples_tools/yaml_writer.py @@ -50,6 +50,7 @@ def prepare_write(examples: Dict[str, Example]) -> Dict[str, str]: # "doc_filenames", # These are currently generated, and don't need to be stored. "source_key", "category", + "suppress_publish", "languages", "service_main", "services",