view mercurial/interfaces/types.py @ 52914:3e8a3db5f5e8

typing: introduce a few basic alias for common types These types are passed everywhere. We introduce basic alias to Any, to make it simpler to start annotating code prior to introducing proper protocol for them.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 07 Feb 2025 23:00:31 +0100
parents a7dcb7c1ff5a
children
line wrap: on
line source

# mercurial/interfaces/types.py - type alias for interfaces
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
#
# This is the main entry point for Mercurial code writing type annotations.
#
# The general principle can be summarized when dealing with <FooBar> object:
# - to type your code: use FooBarT from `mercurial.interface.types`
# - to subclass <FooBar>: use IFooBar from `mercurial.interface.foo_bar`

from __future__ import annotations

from ._basetypes import (  # noqa: F401 (ignore imported but not used)
    CallbackCategoryT,
    FsPathT,
    HgPathT,
    RepoT,
    UiT,
    UserMsgT,
    VfsKeyT,
    VfsT,
)

from . import (
    matcher,
    transaction,
)

MatcherT = matcher.IMatcher
TransactionT = transaction.ITransaction