1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
19 # Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
22 .. note:: DEPRECATED! Please do not extend this or add new uses of this module,
23 use :py:mod:`pyi2ncommon.arnied_api` or :py:mod:`pyi2ncommon.cnfvar`
27 class CnfLine(object):
28 """Represents an arnied cnfline"""
37 self.instance = instance
39 self.line_no = line_no
40 self.parent_line_no = parent_line_no
42 if len(self.name) == 0:
43 raise ValueError("You can't leave the cnfvar name empty")
46 raise ValueError('Zero is not a valid line number')
49 """Build cnfline string representation"""
52 if len(self.name) == 0:
53 raise ValueError("Can't display empty cnfvar name")
55 raise ValueError('Zero is not a valid line number')
57 if self.parent_line_no:
58 rtn = '{0} ({1})'.format(self.line_no, self.parent_line_no)
60 rtn = '{0}'.format(self.line_no)
62 rtn += ' {0},{1}: "{2}"'.format(self.name, self.instance, self.data)