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

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