(match_type: str, index_start: int, index_end: int)
return " " * index_start + format_text(display, STYLE["detector"]) + "\n"
Return detector object to add in detector_line.
Return detector object to add in detector_line.
Return detector object to add in detector_line .
def format_detector(match_type: str, index_start: int, index_end: int) -> str:
    """Return detector object to add in detector_line."""

    detector_size = len(match_type)
    secret_size = index_end - index_start

    display = ""
    if secret_size < MAX_SECRET_SIZE:
        before = "_" * max(1, int(((secret_size - detector_size) - 1) / 2))
        after = "_" * max(1, (secret_size - len(before) - detector_size) - 2)
        display = "|{}{}{}|".format(before, match_type, after)

    return " " * index_start + format_text(display, STYLE["detector"]) + "\n"
def format_detector ( match_type : str , index_start : int , index_end : int ) -> str : detector_size = len ( match_type ) secret_size = index_end - index_start display = "" if secret_size < MAX_SECRET_SIZE : before = "_" * max ( 1 , int ( ( ( secret_size - detector_size ) - 1 ) / 2 ) ) after = "_" * max ( 1 , ( secret_size - len ( before ) - detector_size ) - 2 ) display = "|{}{}{}|" . format ( before , match_type , after ) return " " * index_start + format_text ( display , STYLE [ "detector" ] ) + "\n"