Code Duplication    Length = 16-16 lines in 2 locations

gvm/protocols/gmpv9/gmpv9.py 1 location

@@ 955-970 (lines=16) @@
952
                _actual_resource_type = EntityType.SCAN_CONFIG
953
            _xmlresource.add_element("type", _actual_resource_type.value)
954
955
        if subject_id or subject_type:
956
            if not subject_id:
957
                raise RequiredArgument(
958
                    function=self.modify_permission.__name__,
959
                    argument='subject_id',
960
                )
961
962
            if not isinstance(subject_type, PermissionSubjectType):
963
                raise InvalidArgumentType(
964
                    function=self.modify_permission.__name__,
965
                    argument='subject_type',
966
                    arg_type=PermissionSubjectType.__name__,
967
                )
968
969
            _xmlsubject = cmd.add_element("subject", attrs={"id": subject_id})
970
            _xmlsubject.add_element("type", subject_type.value)
971
972
        return self._send_xml_command(cmd)
973

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