from typing import Dict
from typing import Tuple
import tokenize


def find_strings(fpath: str) -> Dict[Tuple[int, str], Tuple[int, str]]:
    """Find all strings (and f-strings) for the given file.

    Parameters
    ----------
    fpath : str
        File path.

    Returns
    -------
    dict
        A dict with a tuple for key and a tuple for value. The tuple contains
        the line number and the stripped string. The value containes the line
        number and the original string.
    """
    strings = {}
    with open(fpath) as f:
        for toktype, tokstr, (lineno, _), _, _ in tokenize.generate_tokens(
            f.readline
        ):
            if toktype == tokenize.STRING:
                try:
                    string = eval(tokstr)
                except Exception:
                    string = eval(tokstr[1:])

                if isinstance(string, str):
                    key = " ".join([it for it in string.split() if it != ""])
                    strings[(lineno, key)] = (lineno, string)

    return strings