kunit_config.py (126901ba3499880c9ed033633817cf7493120fda) kunit_config.py (1da2e6220e1115930694c649605534baf6fa3dea)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Builds a .config from a kunitconfig.
4#
5# Copyright (C) 2019, Google LLC.
6# Author: Felix Guo <felixguoxiuping@gmail.com>
7# Author: Brendan Higgins <brendanhiggins@google.com>
8
9from dataclasses import dataclass
10import re
1# SPDX-License-Identifier: GPL-2.0
2#
3# Builds a .config from a kunitconfig.
4#
5# Copyright (C) 2019, Google LLC.
6# Author: Felix Guo <felixguoxiuping@gmail.com>
7# Author: Brendan Higgins <brendanhiggins@google.com>
8
9from dataclasses import dataclass
10import re
11from typing import Dict, Iterable, List, Tuple
11from typing import Any, Dict, Iterable, List, Tuple
12
13CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$'
14CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$'
15
16@dataclass(frozen=True)
17class KconfigEntry:
18 name: str
19 value: str

--- 9 unchanged lines hidden (view full) ---

29
30
31class Kconfig:
32 """Represents defconfig or .config specified using the Kconfig language."""
33
34 def __init__(self) -> None:
35 self._entries = {} # type: Dict[str, str]
36
12
13CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$'
14CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$'
15
16@dataclass(frozen=True)
17class KconfigEntry:
18 name: str
19 value: str

--- 9 unchanged lines hidden (view full) ---

29
30
31class Kconfig:
32 """Represents defconfig or .config specified using the Kconfig language."""
33
34 def __init__(self) -> None:
35 self._entries = {} # type: Dict[str, str]
36
37 def __eq__(self, other) -> bool:
37 def __eq__(self, other: Any) -> bool:
38 if not isinstance(other, self.__class__):
39 return False
40 return self._entries == other._entries
41
42 def __repr__(self) -> str:
43 return ','.join(str(e) for e in self.as_entries())
44
45 def as_entries(self) -> Iterable[KconfigEntry]:

--- 63 unchanged lines hidden ---
38 if not isinstance(other, self.__class__):
39 return False
40 return self._entries == other._entries
41
42 def __repr__(self) -> str:
43 return ','.join(str(e) for e in self.as_entries())
44
45 def as_entries(self) -> Iterable[KconfigEntry]:

--- 63 unchanged lines hidden ---