Code Duplication    Length = 80-80 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6262-6341 (lines=80) @@
6259
6260
        return self._send_xml_command(cmd)
6261
6262
    def modify_config(
6263
        self, config_id: str, selection: Optional[str] = None, **kwargs
6264
    ) -> Any:
6265
        """Modifies an existing scan config.
6266
6267
        DEPRECATED. Please use *modify_config_set_* methods instead.
6268
6269
        modify_config has four modes to operate depending on the selection.
6270
6271
        Arguments:
6272
            config_id: UUID of scan config to modify.
6273
            selection: one of 'scan_pref', 'nvt_pref', 'nvt_selection' or
6274
                'family_selection'
6275
            name: New name for preference.
6276
            value: New value for preference.
6277
            nvt_oids: List of NVTs associated with preference to modify.
6278
            family: Name of family to modify.
6279
6280
        Returns:
6281
            The response. See :py:meth:`send_command` for details.
6282
        """
6283
        if not config_id:
6284
            raise RequiredArgument(
6285
                function=self.modify_config.__name__,
6286
                argument='config_id argument',
6287
            )
6288
6289
        if selection is None:
6290
            deprecation(
6291
                "Using modify_config to update the comment of a scan config is"
6292
                "deprecated. Please use modify_config_set_comment instead."
6293
            )
6294
            return self.modify_config_set_comment(
6295
                config_id, kwargs.get("comment")
6296
            )
6297
6298
        if selection not in (
6299
            "nvt_pref",
6300
            "scan_pref",
6301
            "family_selection",
6302
            "nvt_selection",
6303
        ):
6304
            raise InvalidArgument(
6305
                "selection must be one of nvt_pref, "
6306
                "scan_pref, family_selection or "
6307
                "nvt_selection"
6308
            )
6309
6310
        if selection == "nvt_pref":
6311
            deprecation(
6312
                "Using modify_config to update a nvt preference of a scan "
6313
                "config is deprecated. Please use "
6314
                "modify_config_set_nvt_preference instead."
6315
            )
6316
            return self.modify_config_set_nvt_preference(config_id, **kwargs)
6317
6318
        if selection == "scan_pref":
6319
            deprecation(
6320
                "Using modify_config to update a scanner preference of a "
6321
                "scan config is deprecated. Please use "
6322
                "modify_config_set_scanner_preference instead."
6323
            )
6324
            return self.modify_config_set_scanner_preference(
6325
                config_id, **kwargs
6326
            )
6327
6328
        if selection == "nvt_selection":
6329
            deprecation(
6330
                "Using modify_config to update a nvt selection of a "
6331
                "scan config is deprecated. Please use "
6332
                "modify_config_set_nvt_selection instead."
6333
            )
6334
            return self.modify_config_set_nvt_selection(config_id, **kwargs)
6335
6336
        deprecation(
6337
            "Using modify_config to update a family selection of a "
6338
            "scan config is deprecated. Please use "
6339
            "modify_config_set_family_selection instead."
6340
        )
6341
        return self.modify_config_set_family_selection(config_id, **kwargs)
6342
6343
    def modify_group(
6344
        self,

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 4828-4907 (lines=80) @@
4825
4826
        return self._send_xml_command(cmd)
4827
4828
    def modify_config(
4829
        self, config_id: str, selection: Optional[str] = None, **kwargs
4830
    ) -> Any:
4831
        """Modifies an existing scan config.
4832
4833
        DEPRECATED. Please use *modify_config_set_* methods instead.
4834
4835
        modify_config has four modes to operate depending on the selection.
4836
4837
        Arguments:
4838
            config_id: UUID of scan config to modify.
4839
            selection: one of 'scan_pref', 'nvt_pref', 'nvt_selection' or
4840
                'family_selection'
4841
            name: New name for preference.
4842
            value: New value for preference.
4843
            nvt_oids: List of NVTs associated with preference to modify.
4844
            family: Name of family to modify.
4845
4846
        Returns:
4847
            The response. See :py:meth:`send_command` for details.
4848
        """
4849
        if not config_id:
4850
            raise RequiredArgument(
4851
                function=self.modify_config.__name__,
4852
                argument='config_id argument',
4853
            )
4854
4855
        if selection is None:
4856
            deprecation(
4857
                "Using modify_config to update the comment of a scan config is"
4858
                "deprecated. Please use modify_config_set_comment instead."
4859
            )
4860
            return self.modify_config_set_comment(
4861
                config_id, kwargs.get("comment")
4862
            )
4863
4864
        if selection not in (
4865
            "nvt_pref",
4866
            "scan_pref",
4867
            "family_selection",
4868
            "nvt_selection",
4869
        ):
4870
            raise InvalidArgument(
4871
                "selection must be one of nvt_pref, "
4872
                "scan_pref, family_selection or "
4873
                "nvt_selection"
4874
            )
4875
4876
        if selection == "nvt_pref":
4877
            deprecation(
4878
                "Using modify_config to update a nvt preference of a scan "
4879
                "config is deprecated. Please use "
4880
                "modify_config_set_nvt_preference instead."
4881
            )
4882
            return self.modify_config_set_nvt_preference(config_id, **kwargs)
4883
4884
        if selection == "scan_pref":
4885
            deprecation(
4886
                "Using modify_config to update a scanner preference of a "
4887
                "scan config is deprecated. Please use "
4888
                "modify_config_set_scanner_preference instead."
4889
            )
4890
            return self.modify_config_set_scanner_preference(
4891
                config_id, **kwargs
4892
            )
4893
4894
        if selection == "nvt_selection":
4895
            deprecation(
4896
                "Using modify_config to update a nvt selection of a "
4897
                "scan config is deprecated. Please use "
4898
                "modify_config_set_nvt_selection instead."
4899
            )
4900
            return self.modify_config_set_nvt_selection(config_id, **kwargs)
4901
4902
        deprecation(
4903
            "Using modify_config to update a family selection of a "
4904
            "scan config is deprecated. Please use "
4905
            "modify_config_set_family_selection instead."
4906
        )
4907
        return self.modify_config_set_family_selection(config_id, **kwargs)
4908
4909
    def modify_credential(
4910
        self,