Abyss-lord commented on code in PR #9483:
URL: https://github.com/apache/gravitino/pull/9483#discussion_r2621872444


##########
clients/client-python/gravitino/client/generic_tag.py:
##########
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+from typing import Optional
+
+from gravitino.api.metadata_object import MetadataObject
+from gravitino.api.tag.tag import Tag
+from gravitino.dto.audit_dto import AuditDTO
+from gravitino.dto.responses.metadata_object_list_response import (
+    MetadataObjectListResponse,
+)
+from gravitino.dto.tag_dto import TagDTO
+from gravitino.exceptions.handlers.error_handler import ErrorHandler
+from gravitino.exceptions.handlers.error_handlers import ErrorHandlers
+from gravitino.rest.rest_utils import encode_string
+from gravitino.utils import HTTPClient
+from gravitino.utils.http_client import Response
+
+
+class GenericTag(Tag, Tag.AssociatedObjects):
+    """Represents a generic tag."""
+
+    API_LIST_OBJECTS_ENDPOINT = "api/metalakes/{}/tags/{}/objects"
+
+    def __init__(
+        self,
+        metalake: str,
+        tag_dto: TagDTO,
+        client: HTTPClient,
+    ) -> None:
+        self._metalake = metalake
+        self._tag_dto = tag_dto
+        self._client = client
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, GenericTag):
+            return False
+
+        return self._tag_dto == other._tag_dto
+
+    def __hash__(self) -> int:
+        return hash(self._tag_dto)
+
+    def name(self) -> str:
+        """Get the name of the tag.
+
+        Returns:
+            str: The name of the tag.
+        """
+        return self._tag_dto.name()
+
+    def comment(self) -> str:
+        """Get the comment of the tag.
+
+        Returns:
+            str: The comment of the tag.
+        """
+        return self._tag_dto.comment()
+
+    def properties(self) -> dict[str, str]:
+        """Get the properties of the tag.
+
+        Returns:
+            Dict[str, str]: The properties of the tag.
+        """
+        return self._tag_dto.properties()
+
+    def inherited(self) -> Optional[bool]:
+        """Check if the tag is inherited from a parent object or not.
+
+        If the tag is inherited, it will return `True`, if it is owned by the 
object itself, it will return `False`.
+
+        **Note**. The return value is optional, only when the tag is 
associated with an object, and called from the
+        object, the return value will be present. Otherwise, it will be empty.
+
+        Returns:
+            Optional[bool]:
+                True if the tag is inherited, false if it is owned by the 
object itself. Empty if the
+                tag is not associated with any object.
+        """
+        return self._tag_dto.inherited()
+
+    def audit_info(self) -> AuditDTO:
+        """
+        Retrieve The audit information of the entity.

Review Comment:
   fix



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to