~milo/lava-tool/lava-169

« back to all changes in this revision

Viewing changes to lava/device/__init__.py

  • Committer: Milo Casagrande
  • Date: 2013-07-26 08:10:16 UTC
  • Revision ID: milo@ubuntu.com-20130726081016-ylm9t8xr1gvncypk
PEP8 and pylint fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# You should have received a copy of the GNU Lesser General Public License
17
17
# along with lava-tool.  If not, see <http://www.gnu.org/licenses/>.
18
18
 
 
19
"""Device class."""
 
20
 
19
21
import re
20
22
 
21
23
from copy import deepcopy
46
48
 
47
49
 
48
50
class Device(object):
 
51
 
49
52
    """A generic device."""
50
 
    def __init__(self, template, hostname=None):
51
 
        self.data = deepcopy(template)
 
53
 
 
54
    def __init__(self, data, hostname=None):
 
55
        self.data = deepcopy(data)
52
56
        self.hostname = hostname
53
57
 
54
58
    def write(self, conf_file):
86
90
    :return A Device instance.
87
91
        """
88
92
    instance = Device(DEFAULT_TEMPLATE, hostname=name)
89
 
    for known_dev, (matcher, dev_template) in KNOWN_DEVICES.iteritems():
 
93
    for _, (matcher, dev_template) in KNOWN_DEVICES.iteritems():
90
94
        if matcher.match(name):
91
95
            instance = Device(dev_template, hostname=name)
92
96
            break