Code Duplication    Length = 31-31 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4696-4726 (lines=31) @@
4693
4694
        return self._send_xml_command(cmd)
4695
4696
    def get_assets(
4697
        self,
4698
        asset_type: AssetType,
4699
        *,
4700
        filter: Optional[str] = None,
4701
        filter_id: Optional[str] = None,
4702
    ) -> Any:
4703
        """Request a list of assets
4704
4705
        Arguments:
4706
            asset_type: Either 'os' or 'host'
4707
            filter: Filter term to use for the query
4708
            filter_id: UUID of an existing filter to use for the query
4709
4710
        Returns:
4711
            The response. See :py:meth:`send_command` for details.
4712
        """
4713
        if not isinstance(asset_type, AssetType):
4714
            raise InvalidArgumentType(
4715
                function=self.get_assets.__name__,
4716
                argument='asset_type',
4717
                arg_type=AssetType.__name__,
4718
            )
4719
4720
        cmd = XmlCommand("get_assets")
4721
4722
        cmd.set_attribute("type", asset_type.value)
4723
4724
        _add_filter(cmd, filter, filter_id)
4725
4726
        return self._send_xml_command(cmd)
4727
4728
    def get_asset(self, asset_id: str, asset_type: AssetType) -> Any:
4729
        """Request a single asset

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 2871-2901 (lines=31) @@
2868
2869
        return self._send_xml_command(cmd)
2870
2871
    def get_assets(
2872
        self,
2873
        asset_type: AssetType,
2874
        *,
2875
        filter: Optional[str] = None,
2876
        filter_id: Optional[str] = None,
2877
    ) -> Any:
2878
        """Request a list of assets
2879
2880
        Arguments:
2881
            asset_type: Either 'os' or 'host'
2882
            filter: Filter term to use for the query
2883
            filter_id: UUID of an existing filter to use for the query
2884
2885
        Returns:
2886
            The response. See :py:meth:`send_command` for details.
2887
        """
2888
        if not isinstance(asset_type, AssetType):
2889
            raise InvalidArgumentType(
2890
                function=self.get_assets.__name__,
2891
                argument='asset_type',
2892
                arg_type=AssetType.__name__,
2893
            )
2894
2895
        cmd = XmlCommand("get_assets")
2896
2897
        cmd.set_attribute("type", asset_type.value)
2898
2899
        _add_filter(cmd, filter, filter_id)
2900
2901
        return self._send_xml_command(cmd)
2902
2903
    def get_asset(self, asset_id: str, asset_type: AssetType) -> Any:
2904
        """Request a single asset