INNER CODE UNIT · Python

parse_entry_point

autokitteh/autokitteh · runtimes/pythonrt/runner/main.py:45

def parse_entry_point(entry_point):
    """
    >>> parse_entry_point('review.py:on_github_pull_request')
    ('review', 'on_github_pull_request')
    """
    if ":" not in entry_point:
        raise ValueError(f"{entry_point!r} - missing :")

    file_name, func_name = entry_point.split(":", 1)
    if not file_name.endswith(".py"):
        raise ValueError(f"{entry_point!r} - not a Python file")

    return file_name[:-3], func_name


# This is the same as pb.user_code.Frame, but we want to decouple internal code from API
# proto definition.
Frame = namedtuple("Frame", "filename lineno code name")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…