Code Duplication    Length = 30-33 lines in 4 locations

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

@@ 162-191 (lines=30) @@
159
160
        return self._send_xml_command(cmd)
161
162
    def get_overrides(
163
        self,
164
        *,
165
        filter: Optional[str] = None,
166
        filter_id: Optional[str] = None,
167
        details: Optional[bool] = None,
168
        result: Optional[bool] = None,
169
    ) -> Any:
170
        """Request a list of overrides
171
172
        Arguments:
173
            filter: Filter term to use for the query
174
            filter_id: UUID of an existing filter to use for the query
175
            details: Whether to include full details
176
            result: Whether to include results using the override
177
178
        Returns:
179
            The response. See :py:meth:`send_command` for details.
180
        """
181
        cmd = XmlCommand("get_overrides")
182
183
        add_filter(cmd, filter, filter_id)
184
185
        if details is not None:
186
            cmd.set_attribute("details", to_bool(details))
187
188
        if result is not None:
189
            cmd.set_attribute("result", to_bool(result))
190
191
        return self._send_xml_command(cmd)
192
193
    def get_override(self, override_id: str) -> Any:
194
        """Request a single override

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

@@ 144-173 (lines=30) @@
141
142
        return self._send_xml_command(cmd)
143
144
    def get_notes(
145
        self,
146
        *,
147
        filter: Optional[str] = None,
148
        filter_id: Optional[str] = None,
149
        details: Optional[bool] = None,
150
        result: Optional[bool] = None,
151
    ) -> Any:
152
        """Request a list of notes
153
154
        Arguments:
155
            filter: Filter term to use for the query
156
            filter_id: UUID of an existing filter to use for the query
157
            details: Add info about connected results and tasks
158
            result: Return the details of possible connected results.
159
160
        Returns:
161
            The response. See :py:meth:`send_command` for details.
162
        """
163
        cmd = XmlCommand("get_notes")
164
165
        add_filter(cmd, filter, filter_id)
166
167
        if details is not None:
168
            cmd.set_attribute("details", to_bool(details))
169
170
        if result is not None:
171
            cmd.set_attribute("result", to_bool(result))
172
173
        return self._send_xml_command(cmd)
174
175
    def get_note(self, note_id: str) -> Any:
176
        """Request a single note

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 647-679 (lines=33) @@
644
645
        return self._send_xml_command(cmd)
646
647
    def get_tls_certificates(
648
        self,
649
        *,
650
        filter: Optional[str] = None,
651
        filter_id: Optional[str] = None,
652
        include_certificate_data: Optional[bool] = None,
653
        details: Optional[bool] = None,
654
    ) -> Any:
655
        """Request a list of TLS certificates
656
657
        Arguments:
658
            filter: Filter term to use for the query
659
            filter_id: UUID of an existing filter to use for the query
660
            include_certificate_data: Whether to include the certificate data in
661
                the response
662
663
        Returns:
664
            The response. See :py:meth:`send_command` for details.
665
        """
666
667
        cmd = XmlCommand("get_tls_certificates")
668
669
        add_filter(cmd, filter, filter_id)
670
671
        if details is not None:
672
            cmd.set_attribute("details", to_bool(details))
673
674
        if include_certificate_data is not None:
675
            cmd.set_attribute(
676
                "include_certificate_data", to_bool(include_certificate_data)
677
            )
678
679
        return self._send_xml_command(cmd)
680
681
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
682
        """Request a single TLS certificate
@@ 3806-3836 (lines=31) @@
3803
        cmd.set_attribute("role_id", role_id)
3804
        return self._send_xml_command(cmd)
3805
3806
    def get_scanners(
3807
        self,
3808
        *,
3809
        filter: Optional[str] = None,
3810
        filter_id: Optional[str] = None,
3811
        trash: Optional[bool] = None,
3812
        details: Optional[bool] = None,
3813
    ) -> Any:
3814
        """Request a list of scanners
3815
3816
        Arguments:
3817
            filter: Filter term to use for the query
3818
            filter_id: UUID of an existing filter to use for the query
3819
            trash: Whether to get the trashcan scanners instead
3820
            details:  Whether to include extra details like tasks using this
3821
                scanner
3822
3823
        Returns:
3824
            The response. See :py:meth:`send_command` for details.
3825
        """
3826
        cmd = XmlCommand("get_scanners")
3827
3828
        add_filter(cmd, filter, filter_id)
3829
3830
        if trash is not None:
3831
            cmd.set_attribute("trash", to_bool(trash))
3832
3833
        if details is not None:
3834
            cmd.set_attribute("details", to_bool(details))
3835
3836
        return self._send_xml_command(cmd)
3837
3838
    def get_scanner(self, scanner_id: str) -> Any:
3839
        """Request a single scanner