Code Duplication    Length = 25-25 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 4 locations

@@ 2542-2566 (lines=25) @@
2539
        cmd.set_attribute("details", "1")
2540
        return self._send_xml_command(cmd)
2541
2542
    def get_roles(
2543
        self,
2544
        *,
2545
        filter: Optional[str] = None,
2546
        filter_id: Optional[str] = None,
2547
        trash: Optional[bool] = None,
2548
    ) -> Any:
2549
        """Request a list of roles
2550
2551
        Arguments:
2552
            filter: Filter term to use for the query
2553
            filter_id: UUID of an existing filter to use for the query
2554
            trash: Whether to get the trashcan roles instead
2555
2556
        Returns:
2557
            The response. See :py:meth:`send_command` for details.
2558
        """
2559
        cmd = XmlCommand("get_roles")
2560
2561
        add_filter(cmd, filter, filter_id)
2562
2563
        if trash is not None:
2564
            cmd.set_attribute("trash", to_bool(trash))
2565
2566
        return self._send_xml_command(cmd)
2567
2568
    def get_role(self, role_id: str) -> Any:
2569
        """Request a single role
@@ 2366-2390 (lines=25) @@
2363
        cmd.set_attribute("group_id", group_id)
2364
        return self._send_xml_command(cmd)
2365
2366
    def get_permissions(
2367
        self,
2368
        *,
2369
        filter: Optional[str] = None,
2370
        filter_id: Optional[str] = None,
2371
        trash: Optional[bool] = None,
2372
    ) -> Any:
2373
        """Request a list of permissions
2374
2375
        Arguments:
2376
            filter: Filter term to use for the query
2377
            filter_id: UUID of an existing filter to use for the query
2378
            trash: Whether to get permissions in the trashcan instead
2379
2380
        Returns:
2381
            The response. See :py:meth:`send_command` for details.
2382
        """
2383
        cmd = XmlCommand("get_permissions")
2384
2385
        add_filter(cmd, filter, filter_id)
2386
2387
        if trash is not None:
2388
            cmd.set_attribute("trash", to_bool(trash))
2389
2390
        return self._send_xml_command(cmd)
2391
2392
    def get_permission(self, permission_id: str) -> Any:
2393
        """Request a single permission
@@ 2321-2345 (lines=25) @@
2318
2319
        return self._send_xml_command(cmd)
2320
2321
    def get_groups(
2322
        self,
2323
        *,
2324
        filter: Optional[str] = None,
2325
        filter_id: Optional[str] = None,
2326
        trash: Optional[bool] = None,
2327
    ) -> Any:
2328
        """Request a list of groups
2329
2330
        Arguments:
2331
            filter: Filter term to use for the query
2332
            filter_id: UUID of an existing filter to use for the query
2333
            trash: Whether to get the trashcan groups instead
2334
2335
        Returns:
2336
            The response. See :py:meth:`send_command` for details.
2337
        """
2338
        cmd = XmlCommand("get_groups")
2339
2340
        add_filter(cmd, filter, filter_id)
2341
2342
        if trash is not None:
2343
            cmd.set_attribute("trash", to_bool(trash))
2344
2345
        return self._send_xml_command(cmd)
2346
2347
    def get_group(self, group_id: str) -> Any:
2348
        """Request a single group
@@ 1132-1156 (lines=25) @@
1129
1130
        return self._send_xml_command(cmd)
1131
1132
    def get_tickets(
1133
        self,
1134
        *,
1135
        trash: Optional[bool] = None,
1136
        filter: Optional[str] = None,
1137
        filter_id: Optional[str] = None,
1138
    ) -> Any:
1139
        """Request a list of tickets
1140
1141
        Arguments:
1142
            filter: Filter term to use for the query
1143
            filter_id: UUID of an existing filter to use for the query
1144
            trash: True to request the tickets in the trashcan
1145
1146
        Returns:
1147
            The response. See :py:meth:`send_command` for details.
1148
        """
1149
        cmd = XmlCommand("get_tickets")
1150
1151
        add_filter(cmd, filter, filter_id)
1152
1153
        if trash is not None:
1154
            cmd.set_attribute("trash", to_bool(trash))
1155
1156
        return self._send_xml_command(cmd)
1157
1158
    def get_ticket(self, ticket_id: str) -> Any:
1159
        """Request a single ticket