2
# Copyright (c) 2008 Canonical
4
# Written by Marc Tardif <marc@interunion.ca>
6
# This file is part of Checkbox.
8
# Checkbox is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# Checkbox is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
23
from checkbox.lib.cache import cache
24
from checkbox.lib.conversion import string_to_type
26
from checkbox.registries.command import CommandRegistry
27
from checkbox.registries.map import MapRegistry
30
class PvsRegistry(CommandRegistry):
31
"""Registry for pvs information.
33
Each item contained in this registry consists information about
40
lines = [l.strip() for l in self.split("\n") if l]
42
keys_line = lines.pop(0)
43
keys = [k.lower() for k in re.split(r"\s+", keys_line)]
46
values = [string_to_type(v) for v in re.split(r"\s+", line)]
47
map = dict(zip(keys, values))
48
value = MapRegistry(None, map)
49
items.append((map["pv"], value))