Code Duplication    Length = 16-16 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 5320-5335 (lines=16) @@
5317
            )
5318
            _xmlresource.add_element("type", resource_type.value)
5319
5320
        if subject_id or subject_type:
5321
            if not subject_id:
5322
                raise RequiredArgument(
5323
                    function=self.modify_permission.__name__,
5324
                    argument='subject_id',
5325
                )
5326
5327
            if not isinstance(subject_type, PermissionSubjectType):
5328
                raise InvalidArgumentType(
5329
                    function=self.modify_permission.__name__,
5330
                    argument='subject_type',
5331
                    arg_type=PermissionSubjectType.__name__,
5332
                )
5333
5334
            _xmlsubject = cmd.add_element("subject", attrs={"id": subject_id})
5335
            _xmlsubject.add_element("type", subject_type.value)
5336
5337
        return self._send_xml_command(cmd)
5338

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