Code Duplication    Length = 32-34 lines in 2 locations

org_fedora_oscap/service/kickstart.py 1 location

@@ 74-105 (lines=32) @@
71
        """
72
        pass
73
74
    def handle_line(self, line, line_number=None):
75
        """Handle one line of the section.
76
77
        :param line: a line to parse
78
        :param line_number: a line number
79
        :raise: KickstartParseError for invalid lines
80
        """
81
        actions = {
82
            "content-type": self._parse_content_type,
83
            "content-url": self._parse_content_url,
84
            "content-path": self._parse_content_path,
85
            "datastream-id": self._parse_datastream_id,
86
            "profile": self._parse_profile_id,
87
            "xccdf-id": self._parse_xccdf_id,
88
            "xccdf-path": self._parse_content_path,
89
            "cpe-path": self._parse_cpe_path,
90
            "tailoring-path": self._parse_tailoring_path,
91
            "fingerprint": self._parse_fingerprint,
92
            "certificates": self._parse_certificates,
93
        }
94
95
        line = line.strip()
96
        (pre, sep, post) = line.partition("=")
97
        pre = pre.strip()
98
        post = post.strip()
99
        post = post.strip('"')
100
101
        try:
102
            actions[pre](post)
103
        except KeyError:
104
            msg = "Unknown item '%s' for %s addon" % (line, self.name)
105
            raise KickstartParseError(msg)
106
107
    def _parse_content_type(self, value):
108
        value_low = value.lower()

org_fedora_oscap/ks/oscap.py 1 location

@@ 206-239 (lines=34) @@
203
    def _parse_certificates(self, value):
204
        self.certificates = value
205
206
    def handle_line(self, line):
207
        """
208
        The handle_line method that is called with every line from this addon's
209
        %addon section of the kickstart file.
210
211
        :param line: a single line from the %addon section
212
        :type line: str
213
214
        """
215
216
        actions = {"content-type": self._parse_content_type,
217
                   "content-url": self._parse_content_url,
218
                   "content-path": self._parse_content_path,
219
                   "datastream-id": self._parse_datastream_id,
220
                   "profile": self._parse_profile_id,
221
                   "xccdf-id": self._parse_xccdf_id,
222
                   "xccdf-path": self._parse_content_path,
223
                   "cpe-path": self._parse_cpe_path,
224
                   "tailoring-path": self._parse_tailoring_path,
225
                   "fingerprint": self._parse_fingerprint,
226
                   "certificates": self._parse_certificates,
227
                   }
228
229
        line = line.strip()
230
        (pre, sep, post) = line.partition("=")
231
        pre = pre.strip()
232
        post = post.strip()
233
        post = post.strip('"')
234
235
        try:
236
            actions[pre](post)
237
        except KeyError:
238
            msg = "Unknown item '%s' for %s addon" % (line, self.name)
239
            raise KickstartParseError(msg)
240
241
    def finalize(self):
242
        """