Code Duplication    Length = 31-31 lines in 2 locations

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

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 4728-4758 (lines=31) @@
4725
4726
        return self._send_xml_command(cmd)
4727
4728
    def get_assets(
4729
        self,
4730
        asset_type: AssetType,
4731
        *,
4732
        filter: Optional[str] = None,
4733
        filter_id: Optional[str] = None,
4734
    ) -> Any:
4735
        """Request a list of assets
4736
4737
        Arguments:
4738
            asset_type: Either 'os' or 'host'
4739
            filter: Filter term to use for the query
4740
            filter_id: UUID of an existing filter to use for the query
4741
4742
        Returns:
4743
            The response. See :py:meth:`send_command` for details.
4744
        """
4745
        if not isinstance(asset_type, AssetType):
4746
            raise InvalidArgumentType(
4747
                function=self.get_assets.__name__,
4748
                argument='asset_type',
4749
                arg_type=AssetType.__name__,
4750
            )
4751
4752
        cmd = XmlCommand("get_assets")
4753
4754
        cmd.set_attribute("type", asset_type.value)
4755
4756
        _add_filter(cmd, filter, filter_id)
4757
4758
        return self._send_xml_command(cmd)
4759
4760
    def get_asset(self, asset_id: str, asset_type: AssetType) -> Any:
4761
        """Request a single asset