Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws_doc_sdk_examples_tools/doc_gen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions aws_doc_sdk_examples_tools/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -100,17 +100,17 @@ 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

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)

Expand All @@ -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) :]
Expand Down
1 change: 1 addition & 0 deletions aws_doc_sdk_examples_tools/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions aws_doc_sdk_examples_tools/yaml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading