World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#3769] fix(client-python): fix invalid-field-call issue (#3809)
Liang Chun29bf1225f286
diff --git a/clients/client-python/gravitino/api/fileset_change.py b/clients/client-python/gravitino/api/fileset_change.pyindex 6e70eb0321..74473e1996 100644--- a/clients/client-python/gravitino/api/fileset_change.py+++ b/clients/client-python/gravitino/api/fileset_change.py@@ -4,7 +4,7 @@ This software is licensed under the Apache License version 2."""from abc import ABC-from dataclasses import field+from dataclasses import dataclass, fieldfrom dataclasses_json import config@@ -63,14 +63,12 @@ class FilesetChange(ABC):"""return FilesetChange.RemoveProperty(fileset_property)+ @dataclassclass RenameFileset:"""A fileset change to rename the fileset."""_new_name: str = field(metadata=config(field_name="new_name"))- def __init__(self, new_name):- self._new_name = new_name-def new_name(self):"""Retrieves the new name set for the fileset.@@ -111,14 +109,12 @@ class FilesetChange(ABC):"""return f"RENAMEFILESET {self._new_name}"+ @dataclassclass UpdateFilesetComment:"""A fileset change to update the fileset comment."""_new_comment: str = field(metadata=config(field_name="new_comment"))- def __init__(self, new_comment):- self._new_comment = new_comment-def new_comment(self):"""Retrieves the new comment intended for the fileset.@@ -159,16 +155,13 @@ class FilesetChange(ABC):"""return f"UPDATEFILESETCOMMENT {self._new_comment}"+ @dataclassclass SetProperty:"""A fileset change to set the property and value for the fileset."""_property: str = field(metadata=config(field_name="property"))_value: str = field(metadata=config(field_name="value"))- def __init__(self, fileset_property: str, value: str):- self._property = fileset_property- self._value = value-def property(self):"""Retrieves the name of the property being set in the fileset.@@ -217,14 +210,12 @@ class FilesetChange(ABC):"""return f"SETPROPERTY {self._property} {self._value}"+ @dataclassclass RemoveProperty:"""A fileset change to remove a property from the fileset."""_property: str = field(metadata=config(field_name="property"))- def __init__(self, fileset_property: str):- self._property = fileset_property-def property(self):"""Retrieves the name of the property to be removed from the fileset.diff --git a/clients/client-python/gravitino/api/schema_change.py b/clients/client-python/gravitino/api/schema_change.pyindex 3dd0580303..7b56b265af 100644--- a/clients/client-python/gravitino/api/schema_change.py+++ b/clients/client-python/gravitino/api/schema_change.py@@ -4,7 +4,7 @@ This software is licensed under the Apache License version 2."""from abc import ABC-from dataclasses import field+from dataclasses import dataclass, fieldfrom dataclasses_json import config@@ -37,16 +37,13 @@ class SchemaChange(ABC):"""return SchemaChange.RemoveProperty(schema_property)+ @dataclassclass SetProperty:"""SchemaChange class to set the property and value pairs for the schema."""_property: str = field(metadata=config(field_name="property"))_value: str = field(metadata=config(field_name="value"))- def __init__(self, schema_property: str, value: str):- self._property = schema_property- self._value = value-def property(self):"""Retrieves the name of the property to be set.@@ -95,14 +92,12 @@ class SchemaChange(ABC):"""return f"SETPROPERTY {self._property} {self._value}"+ @dataclassclass RemoveProperty:"""SchemaChange class to remove a property from the schema."""_property: str = field(metadata=config(field_name="property"))- def __init__(self, schema_property: str):- self._property = schema_property-def property(self):"""Retrieves the name of the property to be removed.diff --git a/clients/client-python/gravitino/dto/dto_converters.py b/clients/client-python/gravitino/dto/dto_converters.pyindex 294c0aa430..061948166e 100644--- a/clients/client-python/gravitino/dto/dto_converters.py+++ b/clients/client-python/gravitino/dto/dto_converters.py@@ -54,9 +54,11 @@ class DTOConverters:@staticmethoddef to_catalog_update_request(change: CatalogChange):if isinstance(change, CatalogChange.RenameCatalog):- return CatalogUpdateRequest.RenameCatalogRequest(change.new_name)+ return CatalogUpdateRequest.RenameCatalogRequest(change.new_name())if isinstance(change, CatalogChange.UpdateCatalogComment):- return CatalogUpdateRequest.UpdateCatalogCommentRequest(change.new_comment)+ return CatalogUpdateRequest.UpdateCatalogCommentRequest(+ change.new_comment()+ )if isinstance(change, CatalogChange.SetProperty):# TODO# pylint: disable=too-many-function-argsdiff --git a/clients/client-python/gravitino/dto/requests/catalog_update_request.py b/clients/client-python/gravitino/dto/requests/catalog_update_request.pyindex c8dc720015..9db2be5888 100644--- a/clients/client-python/gravitino/dto/requests/catalog_update_request.py+++ b/clients/client-python/gravitino/dto/requests/catalog_update_request.py@@ -28,11 +28,19 @@ class CatalogUpdateRequestBase(RESTRequest):class CatalogUpdateRequest:"""Represents an interface for catalog update requests."""+ @dataclassclass RenameCatalogRequest(CatalogUpdateRequestBase):- new_name: Optional[str] = field(metadata=config(field_name="newName"))+ """Represents a request to rename a catalog."""++ _new_name: Optional[str] = field(metadata=config(field_name="newName"))+ """The new name for the catalog."""++ def __init__(self, new_name: str):+ super().__init__("rename")+ self._new_name = new_namedef catalog_change(self):- return CatalogChange.rename(self.new_name)+ return CatalogChange.rename(self._new_name)def validate(self):"""Validates the fields of the request.@@ -41,46 +49,66 @@ class CatalogUpdateRequest:IllegalArgumentException if the new name is not set."""assert (- self.new_name is None+ self._new_name is None), '"newName" field is required and cannot be empty'+ @dataclassclass UpdateCatalogCommentRequest(CatalogUpdateRequestBase):"""Request to update the comment of a catalog."""- new_comment: Optional[str] = field(metadata=config(field_name="newComment"))+ _new_comment: Optional[str] = field(metadata=config(field_name="newComment"))+ """The new comment for the catalog."""++ def __init__(self, new_comment: str):+ super().__init__("updateComment")+ self._new_comment = new_commentdef catalog_change(self):- return CatalogChange.update_comment(self.new_comment)+ return CatalogChange.update_comment(self._new_comment)def validate(self):assert (- self.new_comment is None+ self._new_comment is None), '"newComment" field is required and cannot be empty'+ @dataclassclass SetCatalogPropertyRequest(CatalogUpdateRequestBase):"""Request to set a property on a catalog."""- property: Optional[str] = None- value: Optional[str] = None+ _property: Optional[str] = field(metadata=config(field_name="property"))+ """The property to set."""++ _value: Optional[str] = field(metadata=config(field_name="value"))+ """The value of the property."""++ def __init__(self, catalog_property: str, value: str):+ super().__init__("setProperty")+ self._property = catalog_property+ self._value = valuedef catalog_change(self):- return CatalogChange.set_property(self.property, self.value)+ return CatalogChange.set_property(self._property, self._value)def validate(self):assert (- self.property is None+ self._property is None), '"property" field is required and cannot be empty'- assert self.value is None, '"value" field is required and cannot be empty'+ assert self._value is None, '"value" field is required and cannot be empty'class RemoveCatalogPropertyRequest(CatalogUpdateRequestBase):"""Request to remove a property from a catalog."""property: Optional[str] = None+ """The property to remove."""++ def __init__(self, catalog_property: str):+ super().__init__("removeProperty")+ self._property = catalog_propertydef catalog_change(self):- return CatalogChange.remove_property(self.property)+ return CatalogChange.remove_property(self._property)def validate(self):assert (- self.property is None+ self._property is None), '"property" field is required and cannot be empty'diff --git a/clients/client-python/pylintrc b/clients/client-python/pylintrcindex 431bd64675..e2e398e93c 100644--- a/clients/client-python/pylintrc+++ b/clients/client-python/pylintrc@@ -25,7 +25,6 @@ disable=missing-class-docstring,missing-timeout, #TODO-fixbroad-exception-caught, #TODO-fixduplicate-code, #TODO-fix- invalid-field-call, #TODO-fixtoo-many-arguments, #TODO-fix[LOGGING]