from typing import Union
from pathlib import Path


def text_in_lines(file: Union[str, Path], text: str, ignorecase=True, encoding="utf-8") -> bool:
    """Checks file contains the text in any of it's lines"""

    if ignorecase:
        text = text.lower()

    with open(file, mode="r", encoding=encoding) as fp:
        for line in fp:
            if ignorecase:
                if text in line.lower():
                    return True
            else:
                if text in line:
                    return True
    return False