import os
import asyncio
import subprocess
import contextlib
import contextvars
from typing import *

import wait4it
import sqlmodel
from sqlmodel import Session
from aioify import aioify

from twitterscraper.models.domain import TwitterProfile, TwitterTweet, JobHistoric
from twitterscraper.utils import Singleton


class Repository(Singleton):
    # https://sqlmodel.tiangolo.com/
    get: Callable[..., "Repository"]
    _session_contextvar: contextvars.ContextVar[Optional[Session]]

    def __init__(self, uri: str):
        self._engine = 