Code Duplication    Length = 80-80 lines in 2 locations

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,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6294-6373 (lines=80) @@
6291
6292
        return self._send_xml_command(cmd)
6293
6294
    def modify_config(
6295
        self, config_id: str, selection: Optional[str] = None, **kwargs
6296
    ) -> Any:
6297
        """Modifies an existing scan config.
6298
6299
        DEPRECATED. Please use *modify_config_set_* methods instead.
6300
6301
        modify_config has four modes to operate depending on the selection.
6302
6303
        Arguments:
6304
            config_id: UUID of scan config to modify.
6305
            selection: one of 'scan_pref', 'nvt_pref', 'nvt_selection' or
6306
                'family_selection'
6307
            name: New name for preference.
6308
            value: New value for preference.
6309
            nvt_oids: List of NVTs associated with preference to modify.
6310
            family: Name of family to modify.
6311
6312
        Returns:
6313
            The response. See :py:meth:`send_command` for details.
6314
        """
6315
        if not config_id:
6316
            raise RequiredArgument(
6317
                function=self.modify_config.__name__,
6318
                argument='config_id argument',
6319
            )
6320
6321
        if selection is None:
6322
            deprecation(
6323
                "Using modify_config to update the comment of a scan config is"
6324
                "deprecated. Please use modify_config_set_comment instead."
6325
            )
6326
            return self.modify_config_set_comment(
6327
                config_id, kwargs.get("comment")
6328
            )
6329
6330
        if selection not in (
6331
            "nvt_pref",
6332
            "scan_pref",
6333
            "family_selection",
6334
            "nvt_selection",
6335
        ):
6336
            raise InvalidArgument(
6337
                "selection must be one of nvt_pref, "
6338
                "scan_pref, family_selection or "
6339
                "nvt_selection"
6340
            )
6341
6342
        if selection == "nvt_pref":
6343
            deprecation(
6344
                "Using modify_config to update a nvt preference of a scan "
6345
                "config is deprecated. Please use "
6346
                "modify_config_set_nvt_preference instead."
6347
            )
6348
            return self.modify_config_set_nvt_preference(config_id, **kwargs)
6349
6350
        if selection == "scan_pref":
6351
            deprecation(
6352
                "Using modify_config to update a scanner preference of a "
6353
                "scan config is deprecated. Please use "
6354
                "modify_config_set_scanner_preference instead."
6355
            )
6356
            return self.modify_config_set_scanner_preference(
6357
                config_id, **kwargs
6358
            )
6359
6360
        if selection == "nvt_selection":
6361
            deprecation(
6362
                "Using modify_config to update a nvt selection of a "
6363
                "scan config is deprecated. Please use "
6364
                "modify_config_set_nvt_selection instead."
6365
            )
6366
            return self.modify_config_set_nvt_selection(config_id, **kwargs)
6367
6368
        deprecation(
6369
            "Using modify_config to update a family selection of a "
6370
            "scan config is deprecated. Please use "
6371
            "modify_config_set_family_selection instead."
6372
        )
6373
        return self.modify_config_set_family_selection(config_id, **kwargs)
6374
6375
    def modify_group(
6376
        self,