def test__filter_files(expand_path_fixtures): files = sorted( [str(x) for x in transforms._filter_files(transforms._expand_paths("**/*"))] ) assert files == [ "a.txt", "b.py", "c.md", "dira/e.txt", "dira/f.py", "dirb/suba/g.py", ]
"request.instances.extend(instances)", ) # https://github.com/googleapis/gapic-generator-python/issues/672 s.replace( "google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py", "request.traffic_split.extend\(traffic_split\)", "request.traffic_split = traffic_split", ) # post processing to fix the generated reference doc from synthtool import transforms as st import re # https://github.com/googleapis/gapic-generator-python/issues/479 paths = st._filter_files(st._expand_paths("google/cloud/**/*.py", ".")) pattern = r"(:\w+:``[^`]+``)" expr = re.compile(pattern, flags=re.MULTILINE) replaces = [] for path in paths: with path.open("r+") as fh: content = fh.read() matches = re.findall(expr, content) if matches: for match in matches: before = match after = match.replace("``", "`") replaces.append((path, before, after)) for path, before, after in replaces: