Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#3768] fix(client-python): fix method-hidden issue (#3777)

Liang Chun26be339ada94
diff --git a/clients/client-python/gravitino/api/catalog_change.py b/clients/client-python/gravitino/api/catalog_change.py
index 1b51c1c681..9739063b26 100644
--- a/clients/client-python/gravitino/api/catalog_change.py
+++ b/clients/client-python/gravitino/api/catalog_change.py
@@ -65,7 +65,7 @@ class CatalogChange(ABC):
"""A catalog change to rename the catalog."""
def __init__(self, new_name):
- self.new_name = new_name
+ self._new_name = new_name
def new_name(self):
"""Retrieves the new name set for the catalog.
@@ -73,7 +73,7 @@ class CatalogChange(ABC):
Returns:
The new name of the catalog.
"""
- return self.new_name
+ return self._new_name
def __eq__(self, other) -> bool:
"""Compares this RenameCatalog instance with another object for equality. Two instances are
@@ -87,7 +87,7 @@ class CatalogChange(ABC):
"""
if not isinstance(other, CatalogChange.RenameCatalog):
return False
- return self.new_name == other.new_name
+ return self.new_name() == other.new_name()
def __hash__(self):
"""Generates a hash code for this RenameCatalog instance. The hash code is primarily based on
@@ -96,7 +96,7 @@ class CatalogChange(ABC):
Returns:
A hash code value for this renaming operation.
"""
- return hash(self.new_name)
+ return hash(self.new_name())
def __str__(self):
"""Provides a string representation of the RenameCatalog instance. This string includes the
@@ -105,13 +105,13 @@ class CatalogChange(ABC):
Returns:
A string summary of this renaming operation.
"""
- return f"RENAMECATALOG {self.new_name}"
+ return f"RENAMECATALOG {self.new_name()}"
class UpdateCatalogComment:
"""A catalog change to update the catalog comment."""
def __init__(self, new_comment):
- self.new_comment = new_comment
+ self._new_comment = new_comment
def new_comment(self):
"""Retrieves the new comment intended for the catalog.
@@ -119,7 +119,7 @@ class CatalogChange(ABC):
Returns:
The new comment that has been set for the catalog.
"""
- return self.new_comment
+ return self._new_comment
def __eq__(self, other) -> bool:
"""Compares this UpdateCatalogComment instance with another object for equality.
@@ -133,7 +133,7 @@ class CatalogChange(ABC):
"""
if not isinstance(other, CatalogChange.UpdateCatalogComment):
return False
- return self.new_comment == other.new_comment
+ return self.new_comment() == other.new_comment()
def __hash__(self):
"""Generates a hash code for this UpdateCatalogComment instance.
@@ -142,7 +142,7 @@ class CatalogChange(ABC):
Returns:
A hash code representing this comment update operation.
"""
- return hash(self.new_comment)
+ return hash(self.new_comment())
def __str__(self):
"""Provides a string representation of the UpdateCatalogComment instance.
@@ -151,14 +151,14 @@ class CatalogChange(ABC):
Returns:
A string summary of this comment update operation.
"""
- return f"UPDATECATALOGCOMMENT {self.new_comment}"
+ return f"UPDATECATALOGCOMMENT {self.new_comment()}"
class SetProperty:
"""A catalog change to set the property and value for the catalog."""
def __init__(self, catalog_property, value):
- self.property = catalog_property
- self.value = value
+ self._property = catalog_property
+ self._value = value
def property(self):
"""Retrieves the name of the property being set in the catalog.
@@ -166,7 +166,7 @@ class CatalogChange(ABC):
Returns:
The name of the property.
"""
- return self.property
+ return self._property
def value(self):
"""Retrieves the value assigned to the property in the catalog.
@@ -174,7 +174,7 @@ class CatalogChange(ABC):
Returns:
The value of the property.
"""
- return self.value
+ return self._value
def __eq__(self, other) -> bool:
"""Compares this SetProperty instance with another object for equality.
@@ -188,7 +188,7 @@ class CatalogChange(ABC):
"""
if not isinstance(other, CatalogChange.SetProperty):
return False
- return self.property == other.property and self.value == other.value
+ return self.property() == other.property() and self.value() == other.value()
def __hash__(self):
"""Generates a hash code for this SetProperty instance.
@@ -197,7 +197,7 @@ class CatalogChange(ABC):
Returns:
A hash code value for this property setting.
"""
- return hash((self.property, self.value))
+ return hash((self.property(), self.value()))
def __str__(self):
"""Provides a string representation of the SetProperty instance.
@@ -206,7 +206,7 @@ class CatalogChange(ABC):
Returns:
A string summary of the property setting.
"""
- return f"SETPROPERTY {self.property} {self.value}"
+ return f"SETPROPERTY {self.property()} {self.value()}"
class RemoveProperty:
"""A catalog change to remove a property from the catalog."""
diff --git a/clients/client-python/pylintrc b/clients/client-python/pylintrc
index d78d0ebd59..a56922a677 100644
--- a/clients/client-python/pylintrc
+++ b/clients/client-python/pylintrc
@@ -25,7 +25,6 @@ disable=missing-class-docstring,
missing-timeout, #TODO-fix
broad-exception-caught, #TODO-fix
duplicate-code, #TODO-fix
- method-hidden, #TODO-fix
no-name-in-module, #TODO-fix
invalid-field-call, #TODO-fix
protected-access, #TODO-fix
@@ -81,4 +80,4 @@ argument-naming-style=snake_case
variable-naming-style=snake_case
# Naming Style for Module
-module-naming-style=snake_case
\ No newline at end of file
+module-naming-style=snake_case