Code Duplication    Length = 40-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/entities/results.py 1 location

@@ 51-90 (lines=40) @@
48
        cmd.set_attribute("details", "1")
49
        return self._send_xml_command(cmd)
50
51
    def get_results(
52
        self,
53
        *,
54
        filter: Optional[str] = None,
55
        filter_id: Optional[str] = None,
56
        task_id: Optional[str] = None,
57
        note_details: Optional[bool] = None,
58
        override_details: Optional[bool] = None,
59
        details: Optional[bool] = None,
60
    ) -> Any:
61
        """Request a list of results
62
63
        Arguments:
64
            filter: Filter term to use for the query
65
            filter_id: UUID of an existing filter to use for the query
66
            task_id: UUID of task for note and override handling
67
            note_details: If notes are included, whether to include note details
68
            override_details: If overrides are included, whether to include
69
                override details
70
            details: Whether to include additional details of the results
71
72
        Returns:
73
            The response. See :py:meth:`send_command` for details.
74
        """
75
        cmd = XmlCommand("get_results")
76
77
        add_filter(cmd, filter, filter_id)
78
79
        if task_id:
80
            cmd.set_attribute("task_id", task_id)
81
82
        if details is not None:
83
            cmd.set_attribute("details", to_bool(details))
84
        if note_details is not None:
85
            cmd.set_attribute("note_details", to_bool(note_details))
86
87
        if override_details is not None:
88
            cmd.set_attribute("override_details", to_bool(override_details))
89
90
        return self._send_xml_command(cmd)
91