Mercurial > public > mercurial-scm > hg-stable
diff mercurial/configuration/__init__.py @ 52456:3e79ca017157
config: gather constant and type into the `__init__.py`
This will help using them in multiple files.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 23 Oct 2024 00:43:17 +0200 |
parents | 0a81f3ef054c |
children | 22129ce9f86d |
line wrap: on
line diff
--- a/mercurial/configuration/__init__.py Wed Oct 23 01:12:52 2024 +0200 +++ b/mercurial/configuration/__init__.py Wed Oct 23 00:43:17 2024 +0200 @@ -0,0 +1,36 @@ +# configuration related constants + +from __future__ import annotations + +from typing import ( + List, + Tuple, + Union, +) + +# keep typing simple for now +ConfigLevelT = str +LEVEL_USER = 'user' # "user" is the default level and never passed explicitly +LEVEL_LOCAL = 'local' +LEVEL_GLOBAL = 'global' +LEVEL_SHARED = 'shared' +LEVEL_NON_SHARED = 'non_shared' +EDIT_LEVELS = ( + LEVEL_USER, + LEVEL_LOCAL, + LEVEL_GLOBAL, + LEVEL_SHARED, + LEVEL_NON_SHARED, +) + +ConfigItemT = Tuple[bytes, bytes, bytes, bytes] +ResourceIDT = Tuple[bytes, bytes] +FileRCT = bytes +ComponentT = Tuple[ + bytes, + Union[ + List[ConfigItemT], + FileRCT, + ResourceIDT, + ], +]