Code Duplication    Length = 16-16 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 5332-5347 (lines=16) @@
5329
            )
5330
            _xmlresource.add_element("type", resource_type.value)
5331
5332
        if subject_id or subject_type:
5333
            if not subject_id:
5334
                raise RequiredArgument(
5335
                    function=self.modify_permission.__name__,
5336
                    argument='subject_id',
5337
                )
5338
5339
            if not isinstance(subject_type, PermissionSubjectType):
5340
                raise InvalidArgumentType(
5341
                    function=self.modify_permission.__name__,
5342
                    argument='subject_type',
5343
                    arg_type=PermissionSubjectType.__name__,
5344
                )
5345
5346
            _xmlsubject = cmd.add_element("subject", attrs={"id": subject_id})
5347
            _xmlsubject.add_element("type", subject_type.value)
5348
5349
        return self._send_xml_command(cmd)
5350

gvm/protocols/gmpv9/gmpv9.py 1 location

@@ 1118-1133 (lines=16) @@
1115
                _actual_resource_type = EntityType.SCAN_CONFIG
1116
            _xmlresource.add_element("type", _actual_resource_type.value)
1117
1118
        if subject_id or subject_type:
1119
            if not subject_id:
1120
                raise RequiredArgument(
1121
                    function=self.modify_permission.__name__,
1122
                    argument='subject_id',
1123
                )
1124
1125
            if not isinstance(subject_type, PermissionSubjectType):
1126
                raise InvalidArgumentType(
1127
                    function=self.modify_permission.__name__,
1128
                    argument='subject_type',
1129
                    arg_type=PermissionSubjectType.__name__,
1130
                )
1131
1132
            _xmlsubject = cmd.add_element("subject", attrs={"id": subject_id})
1133
            _xmlsubject.add_element("type", subject_type.value)
1134
1135
        return self._send_xml_command(cmd)
1136