"""
This type stub file was generated by pyright.
"""

from functools import cached_property
from typing import Self, override
from codeowners import CodeOwners as CodeOwnersParser
from git import Remote, Repo as GitCLI
from git.remote import PushInfoList
from graph_sitter.writer_decorators import noapidoc
from .repo_operator import RepoOperator
from .schemas.config import BaseRepoConfig
from .schemas.enums import FetchResult

class OperatorIsLocal(Exception):
    """Error raised while trying to do a remote operation on a local operator"""
    ...


class LocalRepoOperator(RepoOperator):
    """RepoOperator that does not depend on remote Github.
    It is useful for:
    - Testing codemods locally with a repo already cloned from Github on disk.
    - Creating "fake" repos from a dictionary of files contents
    """
    _repo_path: str
    _repo_name: str
    _default_branch: str
    _git_cli: GitCLI
    repo_config: BaseRepoConfig
    def __init__(self, repo_config: BaseRepoConfig, repo_path: str, default_branch: str, bot_commit: bool = ...) -> None:
        ...
    
    @classmethod
    def create_from_files(cls, repo_path: str, files: dict[str, str], bot_commit: bool = ..., repo_config: BaseRepoConfig = ...) -> LocalRepoOperator:
        """Used when you want to create a directory from a set of files and then create a LocalRepoOperator that points to that directory.
        Use cases:
        - Unit testing
        - Playground
        - Codebase eval

        Args:
            repo_path (str): The path to the directory to create.
            files (dict[str, str]): A dictionary of file names and contents to create in the directory.
            repo_config (BaseRepoConfig): The configuration of the repo.
        """
        ...
    
    @classmethod
    def create_from_commit(cls, repo_path: str, default_branch: str, commit: str, url: str) -> Self:
        """Do a shallow checkout of a particular commit to get a repository from a given remote URL."""
        ...
    
    @property
    def repo_name(self) -> str:
        ...
    
    @property
    def repo_path(self) -> str:
        ...
    
    @property
    def codeowners_parser(self) -> CodeOwnersParser | None:
        ...
    
    @cached_property
    @noapidoc
    def base_url(self) -> str | None:
        ...
    
    @override
    def push_changes(self, remote: Remote | None = ..., refspec: str | None = ..., force: bool = ...) -> PushInfoList:
        ...
    
    @override
    def pull_repo(self) -> None:
        """Pull the latest commit down to an existing local repo"""
        ...
    
    def fetch_remote(self, remote_name: str = ..., refspec: str | None = ..., force: bool = ...) -> FetchResult:
        ...
    


