author | Pierre-Yves David <pierre-yves.david@octobus.net> |
Wed, 23 Oct 2024 01:32:33 +0200 | |
changeset 52426 | 22129ce9f86d |
parent 52425 | 3e79ca017157 |
child 52427 | 8c509a70b6fa |
permissions | -rw-r--r-- |
52425
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
1 |
# configuration related constants |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
2 |
|
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
3 |
from __future__ import annotations |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
4 |
|
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
5 |
from typing import ( |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
6 |
List, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
7 |
Tuple, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
8 |
Union, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
9 |
) |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
10 |
|
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
11 |
# keep typing simple for now |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
12 |
ConfigLevelT = str |
52426
22129ce9f86d
config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52425
diff
changeset
|
13 |
LEVEL_BUNDLED_RESOURCE = 'RESOURCE' |
22129ce9f86d
config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52425
diff
changeset
|
14 |
LEVEL_ENV_OVERWRITE = 'ENV-HGRCPATH' |
22129ce9f86d
config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52425
diff
changeset
|
15 |
LEVEL_USER = 'user' |
52425
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
16 |
LEVEL_LOCAL = 'local' |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
17 |
LEVEL_GLOBAL = 'global' |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
18 |
LEVEL_SHARED = 'shared' |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
19 |
LEVEL_NON_SHARED = 'non_shared' |
52426
22129ce9f86d
config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52425
diff
changeset
|
20 |
# only include level that it make sense to edit |
22129ce9f86d
config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52425
diff
changeset
|
21 |
# note: "user" is the default level and never passed explicitly |
52425
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
22 |
EDIT_LEVELS = ( |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
23 |
LEVEL_USER, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
24 |
LEVEL_LOCAL, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
25 |
LEVEL_GLOBAL, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
26 |
LEVEL_SHARED, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
27 |
LEVEL_NON_SHARED, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
28 |
) |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
29 |
|
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
30 |
ConfigItemT = Tuple[bytes, bytes, bytes, bytes] |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
31 |
ResourceIDT = Tuple[bytes, bytes] |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
32 |
FileRCT = bytes |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
33 |
ComponentT = Tuple[ |
52426
22129ce9f86d
config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52425
diff
changeset
|
34 |
ConfigLevelT, |
52425
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
35 |
bytes, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
36 |
Union[ |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
37 |
List[ConfigItemT], |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
38 |
FileRCT, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
39 |
ResourceIDT, |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
40 |
], |
3e79ca017157
config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
52416
diff
changeset
|
41 |
] |