-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.py
34 lines (24 loc) · 875 Bytes
/
common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import enum
from typing import Dict, List, Tuple, Union
from pydantic import BaseModel
class IncludeChange(enum.Enum):
ADD = "add"
REMOVE = "remove"
@classmethod
def from_value(cls, value):
for enum_value in cls:
if enum_value.value == value:
return enum_value
class IgnoresSubConfiguration(BaseModel):
filenames: List[str] = []
headers: List[str] = []
edges: List[Tuple[str, str]] = []
class IgnoresConfiguration(BaseModel):
skip: List[str] = []
add: IgnoresSubConfiguration = IgnoresSubConfiguration()
remove: IgnoresSubConfiguration = IgnoresSubConfiguration()
class Configuration(BaseModel):
dependencies: Dict[str, Union[str, "Configuration"]] = {}
includeDirs: List[str] = []
ignores: IgnoresConfiguration = IgnoresConfiguration()
headerMappings: Dict[str, str] = {}