derrickaw commented on code in PR #38547:
URL: https://github.com/apache/beam/pull/38547#discussion_r3277117909
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -1391,19 +1391,61 @@ def validate_transform_references(spec):
return spec
+def strip_leading_comments(source: str) -> str:
+ lines = source.splitlines(keepends=True)
+ stripped_lines = []
+ in_leading_comments = True
+ for line in lines:
+ stripped_line = line.lstrip()
+ if in_leading_comments:
+ if stripped_line.startswith('#') or not stripped_line:
+ continue
+ else:
+ in_leading_comments = False
+ stripped_lines.append(line)
+ return "".join(stripped_lines)
+
+
class _BeamFileIOLoader(jinja2.BaseLoader):
+ def __init__(self, search_paths=()):
+ self.search_paths = list(search_paths)
+
def get_source(self, environment, path):
- with FileSystems.open(path) as fin:
- source = fin.read().decode()
- return source, path, lambda: True
+ candidates = [path]
+ if FileSystems.get_scheme(path) is None and not path.startswith('/'):
Review Comment:
valid comment, thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]