Code Duplication    Length = 40-40 lines in 2 locations

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

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4569-4608 (lines=40) @@
4566
4567
        return self._send_xml_command(cmd)
4568
4569
    def delete_user(
4570
        self,
4571
        user_id: str = None,
4572
        *,
4573
        name: Optional[str] = None,
4574
        inheritor_id: Optional[str] = None,
4575
        inheritor_name: Optional[str] = None,
4576
    ) -> Any:
4577
        """Deletes an existing user
4578
4579
        Either user_id or name must be passed.
4580
4581
        Arguments:
4582
            user_id: UUID of the task to be deleted.
4583
            name: The name of the user to be deleted.
4584
            inheritor_id: The ID of the inheriting user or "self". Overrides
4585
                inheritor_name.
4586
            inheritor_name: The name of the inheriting user.
4587
4588
        """
4589
        if not user_id and not name:
4590
            raise RequiredArgument(
4591
                function=self.delete_user.__name__, argument='user_id or name'
4592
            )
4593
4594
        cmd = XmlCommand("delete_user")
4595
4596
        if user_id:
4597
            cmd.set_attribute("user_id", user_id)
4598
4599
        if name:
4600
            cmd.set_attribute("name", name)
4601
4602
        if inheritor_id:
4603
            cmd.set_attribute("inheritor_id", inheritor_id)
4604
4605
        if inheritor_name:
4606
            cmd.set_attribute("inheritor_name", inheritor_name)
4607
4608
        return self._send_xml_command(cmd)
4609
4610
    def describe_auth(self) -> Any:
4611
        """Describe authentication methods