Code Duplication    Length = 40-40 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4537-4576 (lines=40) @@
4534
4535
        return self._send_xml_command(cmd)
4536
4537
    def delete_user(
4538
        self,
4539
        user_id: str = None,
4540
        *,
4541
        name: Optional[str] = None,
4542
        inheritor_id: Optional[str] = None,
4543
        inheritor_name: Optional[str] = None,
4544
    ) -> Any:
4545
        """Deletes an existing user
4546
4547
        Either user_id or name must be passed.
4548
4549
        Arguments:
4550
            user_id: UUID of the task to be deleted.
4551
            name: The name of the user to be deleted.
4552
            inheritor_id: The ID of the inheriting user or "self". Overrides
4553
                inheritor_name.
4554
            inheritor_name: The name of the inheriting user.
4555
4556
        """
4557
        if not user_id and not name:
4558
            raise RequiredArgument(
4559
                function=self.delete_user.__name__, argument='user_id or name'
4560
            )
4561
4562
        cmd = XmlCommand("delete_user")
4563
4564
        if user_id:
4565
            cmd.set_attribute("user_id", user_id)
4566
4567
        if name:
4568
            cmd.set_attribute("name", name)
4569
4570
        if inheritor_id:
4571
            cmd.set_attribute("inheritor_id", inheritor_id)
4572
4573
        if inheritor_name:
4574
            cmd.set_attribute("inheritor_name", inheritor_name)
4575
4576
        return self._send_xml_command(cmd)
4577
4578
    def describe_auth(self) -> Any:
4579
        """Describe authentication methods

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 2660-2699 (lines=40) @@
2657
2658
        return self._send_xml_command(cmd)
2659
2660
    def delete_user(
2661
        self,
2662
        user_id: str = None,
2663
        *,
2664
        name: Optional[str] = None,
2665
        inheritor_id: Optional[str] = None,
2666
        inheritor_name: Optional[str] = None,
2667
    ) -> Any:
2668
        """Deletes an existing user
2669
2670
        Either user_id or name must be passed.
2671
2672
        Arguments:
2673
            user_id: UUID of the task to be deleted.
2674
            name: The name of the user to be deleted.
2675
            inheritor_id: The ID of the inheriting user or "self". Overrides
2676
                inheritor_name.
2677
            inheritor_name: The name of the inheriting user.
2678
2679
        """
2680
        if not user_id and not name:
2681
            raise RequiredArgument(
2682
                function=self.delete_user.__name__, argument='user_id or name'
2683
            )
2684
2685
        cmd = XmlCommand("delete_user")
2686
2687
        if user_id:
2688
            cmd.set_attribute("user_id", user_id)
2689
2690
        if name:
2691
            cmd.set_attribute("name", name)
2692
2693
        if inheritor_id:
2694
            cmd.set_attribute("inheritor_id", inheritor_id)
2695
2696
        if inheritor_name:
2697
            cmd.set_attribute("inheritor_name", inheritor_name)
2698
2699
        return self._send_xml_command(cmd)
2700
2701
    def describe_auth(self) -> Any:
2702
        """Describe authentication methods