from typing import Union
from pathlib import Path
from typing import List
from typing import Dict
import json


def readJSONLFile(file_name: Union[str, Path]) -> List[Dict]:
    """
    Read a '.jsonl' file and create a list of dicts
    Args:
        file_name: `Union[str,Path]`
            The file to open
    Returns:
        The list of dictionaries read from the 'file_name'
    """
    lines = (
        open(file_name, 'r', encoding='utf-8').readlines() if isinstance(file_name, str) else
        file_name.read_text('utf-8').splitlines(False)
    )
    return [json.loads(line) for line in lines]