Skip to content

Commit 4780d83

Browse files
committed
Avoid deprecation warnings for special attribute access in CCProxy after Hypothesis update
1 parent 0d9d1c7 commit 4780d83

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tiledb/__init__.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,16 @@
110110
group_create = Group.create
111111

112112

113-
# Create a proxy object to wrap libtiledb and provide a `cc` alias
113+
# Create a proxy class to handle the deprecation of `tiledb.cc`
114114
class CCProxy:
115115
def __init__(self, module):
116116
self._module = module
117117

118118
def __getattr__(self, name):
119-
warnings.warn(
120-
"`tiledb.cc` is deprecated. Please use `tiledb.libtiledb` instead.",
121-
)
119+
if not name.startswith("__"):
120+
warnings.warn(
121+
"`tiledb.cc` is deprecated. Please use `tiledb.libtiledb` instead.",
122+
)
122123
return getattr(self._module, name)
123124

124125
def __repr__(self):
@@ -128,9 +129,10 @@ def __repr__(self):
128129
return self._module.__repr__()
129130

130131

132+
# Create a proxy object to wrap libtiledb and provide a `cc` alias
131133
cc = CCProxy(libtiledb)
132134
sys.modules["tiledb.cc"] = cc
133-
cc = cc
135+
# Delete the class to avoid namespace pollution
134136
del CCProxy
135137

136138
# Note: we use a modified namespace packaging to allow continuity of existing TileDB-Py imports.

0 commit comments

Comments
 (0)