Code Duplication    Length = 33-48 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 2947-2994 (lines=48) @@
2944
2945
        return self._send_xml_command(cmd)
2946
2947
    def get_configs(
2948
        self,
2949
        *,
2950
        filter: Optional[str] = None,
2951
        filter_id: Optional[str] = None,
2952
        trash: Optional[bool] = None,
2953
        details: Optional[bool] = None,
2954
        families: Optional[bool] = None,
2955
        preferences: Optional[bool] = None,
2956
        tasks: Optional[bool] = None
2957
    ) -> Any:
2958
        """Request a list of scan configs
2959
2960
        Arguments:
2961
            filter: Filter term to use for the query
2962
            filter_id: UUID of an existing filter to use for the query
2963
            trash: Whether to get the trashcan scan configs instead
2964
            details: Whether to get config families, preferences, nvt selectors
2965
                and tasks.
2966
            families: Whether to include the families if no details are
2967
                requested
2968
            preferences: Whether to include the preferences if no details are
2969
                requested
2970
            tasks: Whether to get tasks using this config
2971
2972
        Returns:
2973
            The response. See :py:meth:`send_command` for details.
2974
        """
2975
        cmd = XmlCommand("get_configs")
2976
2977
        _add_filter(cmd, filter, filter_id)
2978
2979
        if trash is not None:
2980
            cmd.set_attribute("trash", _to_bool(trash))
2981
2982
        if details is not None:
2983
            cmd.set_attribute("details", _to_bool(details))
2984
2985
        if families is not None:
2986
            cmd.set_attribute("families", _to_bool(families))
2987
2988
        if preferences is not None:
2989
            cmd.set_attribute("preferences", _to_bool(preferences))
2990
2991
        if tasks is not None:
2992
            cmd.set_attribute("tasks", _to_bool(tasks))
2993
2994
        return self._send_xml_command(cmd)
2995
2996
    def get_config(self, config_id: str) -> Any:
2997
        """Request a single scan config

gvm/protocols/gmpv9/gmpv9.py 1 location

@@ 1055-1087 (lines=33) @@
1052
        cmd.add_element("usage_type", usage_type.value)
1053
        return self._send_xml_command(cmd)
1054
1055
    def __get_configs(
1056
        self,
1057
        usage_type: UsageType,
1058
        *,
1059
        filter: Optional[str] = None,
1060
        filter_id: Optional[str] = None,
1061
        trash: Optional[bool] = None,
1062
        details: Optional[bool] = None,
1063
        families: Optional[bool] = None,
1064
        preferences: Optional[bool] = None,
1065
        tasks: Optional[bool] = None
1066
    ) -> Any:
1067
        cmd = XmlCommand("get_configs")
1068
        cmd.set_attribute("usage_type", usage_type.value)
1069
1070
        _add_filter(cmd, filter, filter_id)
1071
1072
        if trash is not None:
1073
            cmd.set_attribute("trash", _to_bool(trash))
1074
1075
        if details is not None:
1076
            cmd.set_attribute("details", _to_bool(details))
1077
1078
        if families is not None:
1079
            cmd.set_attribute("families", _to_bool(families))
1080
1081
        if preferences is not None:
1082
            cmd.set_attribute("preferences", _to_bool(preferences))
1083
1084
        if tasks is not None:
1085
            cmd.set_attribute("tasks", _to_bool(tasks))
1086
1087
        return self._send_xml_command(cmd)
1088
1089
    def __get_config(self, config_id: str, usage_type: UsageType) -> Any:
1090
        if not config_id: