PageSourceSearch

https://tangleml-tangle.hf.space/assets/python_function-loYkBzNC.js

js tangleml-tangle.hf.space collected 2026-10-03 10:21:45 UTC 1,106 bytes, 31 lines download raw bytes

1const t=`from cloud_pipelines import components
2
3def filter_text(
4    # The InputPath() annotation makes the system pass a local input path where the function can read the input data.
5    text_path: components.InputPath(),
6    # The OutputPath() annotation makes the system pass a local output path where the function should write the output data.
7    filtered_text_path: components.OutputPath(),
8    pattern: str = ".*",
9):
10    """Filters text.
11
12    Filtering is performed using regular expressions.
13
14    Args:
15        text_path: The source text
16        pattern: The regular expression pattern
17        filtered_text_path: The filtered text
18    """
19    # Function must be self-contained.
20    # So all import statements must be inside the function.
21    import os
22    import re
23
24    regex = re.compile(pattern)
25
26    os.makedirs(os.path.dirname(filtered_text_path), exist_ok=True)
27    with open(text_path, "r") as reader:
28        with open(filtered_text_path, "w") as writer:
29            for line in reader:
30                if regex.search(line):
31                    writer.write(line)`;export{t as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.