Revision 99f5fa44
b/qa/qa_config.py | ||
---|---|---|
70 | 70 |
|
71 | 71 |
return cls(name=data["name"], nicmac=nicmac) |
72 | 72 |
|
73 |
def __getitem__(self, key): |
|
74 |
"""Legacy dict-like interface. |
|
75 |
|
|
76 |
""" |
|
77 |
if key == "name": |
|
78 |
return self.name |
|
79 |
else: |
|
80 |
raise KeyError(key) |
|
81 |
|
|
82 |
def get(self, key, default): |
|
83 |
"""Legacy dict-like interface. |
|
84 |
|
|
85 |
""" |
|
86 |
try: |
|
87 |
return self[key] |
|
88 |
except KeyError: |
|
89 |
return default |
|
90 |
|
|
91 | 73 |
def Release(self): |
92 | 74 |
"""Releases instance and makes it available again. |
93 | 75 |
|
... | ... | |
137 | 119 |
""" |
138 | 120 |
return cls(primary=data["primary"], secondary=data.get("secondary")) |
139 | 121 |
|
140 |
def __getitem__(self, key): |
|
141 |
"""Legacy dict-like interface. |
|
142 |
|
|
143 |
""" |
|
144 |
if key == "primary": |
|
145 |
return self.primary |
|
146 |
elif key == "secondary": |
|
147 |
return self.secondary |
|
148 |
else: |
|
149 |
raise KeyError(key) |
|
150 |
|
|
151 |
def get(self, key, default): |
|
152 |
"""Legacy dict-like interface. |
|
153 |
|
|
154 |
""" |
|
155 |
try: |
|
156 |
return self[key] |
|
157 |
except KeyError: |
|
158 |
return default |
|
159 |
|
|
160 | 122 |
def Use(self): |
161 | 123 |
"""Marks a node as being in use. |
162 | 124 |
|
Also available in: Unified diff