mathlibtools/lib.py
def from_path(cls, path: Path, cache_url: str = '',
                  force_download: bool = False,
                  upgrade_lean: bool = True) -> 'LeanProject':
        """Builds a LeanProject from a Path object"""
        repo: Optional[Repo] = None
        is_dirty = False
        rev = ''
        try:
            repo = Repo(path, search_parent_directories=True)
        except InvalidGitRepositoryError:
            pass
        if repo:
            if repo.bare:
                raise InvalidLeanProject('Git repository is not initialized')
            is_dirty = repo.is_dirty()
            try:
                rev = repo.commit().hexsha
            except ValueError:
                rev = ''
        directory = find_root(path)
        config = toml.load(directory/'leanpkg.toml')

        return cls(repo, is_dirty, rev, directory,
                   config['package'], config['dependencies'],
                   cache_url, force_download, upgrade_lean)
Builds a LeanProject from a Path object
Builds a LeanProject from a Path object
Builds a LeanProject from a Path object
def from_path(cls, path: Path, cache_url: str = '',
                  force_download: bool = False,
                  upgrade_lean: bool = True) -> 'LeanProject':
        repo: Optional[Repo] = None
        is_dirty = False
        rev = ''
        try:
            repo = Repo(path, search_parent_directories=True)
        except InvalidGitRepositoryError:
            pass
        if repo:
            if repo.bare:
                raise InvalidLeanProject('Git repository is not initialized')
            is_dirty = repo.is_dirty()
            try:
                rev = repo.commit().hexsha
            except ValueError:
                rev = ''
        directory = find_root(path)
        config = toml.load(directory/'leanpkg.toml')
        return cls(repo, is_dirty, rev, directory,
                   config['package'], config['dependencies'],
                   cache_url, force_download, upgrade_lean)
def from_path ( cls , path : Path , cache_url : str = '' , force_download : bool = False , upgrade_lean : bool = True ) -> 'LeanProject' : repo : Optional [ Repo ] = None is_dirty = False rev = '' try : repo = Repo ( path , search_parent_directories = True ) except InvalidGitRepositoryError : pass if repo : if repo . bare : raise InvalidLeanProject ( 'Git repository is not initialized' ) is_dirty = repo . is_dirty ( ) try : rev = repo . commit ( ) . hexsha except ValueError : rev = '' directory = find_root ( path ) config = toml . load ( directory / 'leanpkg.toml' ) return cls ( repo , is_dirty , rev , directory , config [ 'package' ] , config [ 'dependencies' ] , cache_url , force_download , upgrade_lean )
Builds a LeanProject from a Path object
Builds a LeanProject from a Path object
"""Builds a LeanProject from a Path object"""
cls
path
Path
cache_url
str
force_download
bool
upgrade_lean
bool