in o2a/utils/el_utils.py [0:0]
def replace_url_el(url: str, props: PropertySet, allow_no_schema=False) -> str:
"""
Transforms url by replacing EL-expression with equivalent jinja templates.
If schema validation is required then props should include proper name-node.
For example:
input: '{$nameNode}/users/{$userName}/dir
url_with_var: `{{nameNode}}/users/{{userName}}/dir
In this case to validate url schema props should contain `nameNode` value.
"""
url_with_var = el_parser.translate(url)
name_node, _ = _resolve_name_node(url_with_var, props)
if name_node:
url_parts = urlparse(name_node)
else:
url_parts = urlparse(url_with_var)
allowed_schemas = {"hdfs", ""} if allow_no_schema else {"hdfs"}
if url_parts.scheme not in allowed_schemas:
raise ParseException(
f"Unknown path format. The URL should be provided in the following format: "
f"hdfs://localhost:9200/path. Current value: {url_with_var}"
)
return url_with_var