Code Duplication    Length = 41-42 lines in 2 locations

gvm/protocols/gmpv208/entities/reports.py 1 location

@@ 104-145 (lines=42) @@
101
102
        return self._send_xml_command(cmd)
103
104
    def get_reports(
105
        self,
106
        *,
107
        filter: Optional[str] = None,
108
        filter_id: Optional[str] = None,
109
        note_details: Optional[bool] = None,
110
        override_details: Optional[bool] = None,
111
        details: Optional[bool] = None,
112
    ) -> Any:
113
        """Request a list of reports
114
115
        Arguments:
116
            filter: Filter term to use for the query
117
            filter_id: UUID of an existing filter to use for the query
118
            note_details: If notes are included, whether to include note details
119
            override_details: If overrides are included, whether to include
120
                override details
121
            details: Whether to exclude results
122
123
        Returns:
124
            The response. See :py:meth:`send_command` for details.
125
        """
126
        cmd = XmlCommand("get_reports")
127
128
        if filter:
129
            cmd.set_attribute("report_filter", filter)
130
131
        if filter_id:
132
            cmd.set_attribute("report_filt_id", filter_id)
133
134
        if note_details is not None:
135
            cmd.set_attribute("note_details", to_bool(note_details))
136
137
        if override_details is not None:
138
            cmd.set_attribute("override_details", to_bool(override_details))
139
140
        if details is not None:
141
            cmd.set_attribute("details", to_bool(details))
142
143
        cmd.set_attribute("ignore_pagination", "1")
144
145
        return self._send_xml_command(cmd)
146
147
    def import_report(
148
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5076-5116 (lines=41) @@
5073
        cmd.set_attribute("details", "1")
5074
        return self._send_xml_command(cmd)
5075
5076
    def get_results(
5077
        self,
5078
        *,
5079
        filter: Optional[str] = None,
5080
        filter_id: Optional[str] = None,
5081
        task_id: Optional[str] = None,
5082
        note_details: Optional[bool] = None,
5083
        override_details: Optional[bool] = None,
5084
        details: Optional[bool] = None,
5085
    ) -> Any:
5086
        """Request a list of results
5087
5088
        Arguments:
5089
            filter: Filter term to use for the query
5090
            filter_id: UUID of an existing filter to use for the query
5091
            task_id: UUID of task for note and override handling
5092
            note_details: If notes are included, whether to include note details
5093
            override_details: If overrides are included, whether to include
5094
                override details
5095
            details: Whether to include additional details of the results
5096
5097
        Returns:
5098
            The response. See :py:meth:`send_command` for details.
5099
        """
5100
        cmd = XmlCommand("get_results")
5101
5102
        add_filter(cmd, filter, filter_id)
5103
5104
        if task_id:
5105
            cmd.set_attribute("task_id", task_id)
5106
5107
        if details is not None:
5108
            cmd.set_attribute("details", to_bool(details))
5109
5110
        if note_details is not None:
5111
            cmd.set_attribute("note_details", to_bool(note_details))
5112
5113
        if override_details is not None:
5114
            cmd.set_attribute("override_details", to_bool(override_details))
5115
5116
        return self._send_xml_command(cmd)
5117
5118
    def get_result(self, result_id: str) -> Any:
5119
        """Request a single result