diff --git a/swh/web/common/query.py b/swh/web/common/query.py --- a/swh/web/common/query.py +++ b/swh/web/common/query.py @@ -1,11 +1,10 @@ -# Copyright (C) 2015-2018 The Software Heritage developers +# Copyright (C) 2015-2022 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information import re -from uuid import UUID from swh.model.hashutil import ALGORITHMS, hash_to_bytes from swh.web.common.exc import BadInputExc @@ -87,25 +86,3 @@ raise BadInputExc(error_msg) return (algo, hash) - - -def parse_uuid4(uuid): - """Parse an uuid 4 from a string. - - Args: - uuid: String representing an uuid. - - Returns: - The uuid as is if everything is ok. - - Raises: - BadInputExc: if the uuid is invalid. - - """ - try: - UUID(uuid, version=4) - except ValueError as e: - # not a valid hex code for a UUID - raise BadInputExc(str(e)) - - return uuid diff --git a/swh/web/tests/common/test_query.py b/swh/web/tests/common/test_query.py --- a/swh/web/tests/common/test_query.py +++ b/swh/web/tests/common/test_query.py @@ -108,15 +108,3 @@ assert sha == b"123" mock_hash.assert_called_once_with("sha256:123") - - -def test_parse_uuid4(): - actual_uuid = query.parse_uuid4("7c33636b-8f11-4bda-89d9-ba8b76a42cec") - - assert actual_uuid == "7c33636b-8f11-4bda-89d9-ba8b76a42cec" - - -def test_parse_uuid4_ko(): - with pytest.raises(BadInputExc) as e: - query.parse_uuid4("7c33636b-8f11-4bda-89d9-ba8b76a42") - assert e.match("badly formed hexadecimal UUID string")