Skip to content

Commit fc80078

Browse files
committed
updated isPublic to is_public to comform to python naming conventions
1 parent fa7aab2 commit fc80078

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

tabpy/tabpy_server/handlers/management_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _add_or_update_endpoint(self, action, name, version, request_data):
8484
target = request_data.get("target", None)
8585
schema = request_data.get("schema", None)
8686
src_path = request_data.get("src_path", None)
87-
isPublic = request_data.get("isPublic", None)
87+
is_public = request_data.get("is_public", None)
8888
target_path = get_query_object_path(
8989
self.settings[SettingsParameters.StateFilePath], name, version
9090
)
@@ -118,7 +118,7 @@ def _add_or_update_endpoint(self, action, name, version, request_data):
118118
dependencies=dependencies,
119119
target=target,
120120
schema=schema,
121-
isPublic=isPublic,
121+
is_public=is_public,
122122
)
123123
else:
124124
self.tabpy_state.update_endpoint(
@@ -131,7 +131,7 @@ def _add_or_update_endpoint(self, action, name, version, request_data):
131131
target=target,
132132
schema=schema,
133133
version=version,
134-
isPublic=isPublic,
134+
is_public=is_public,
135135
)
136136

137137
except Exception as e:

tabpy/tabpy_server/management/state.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ def _check_and_set_dependencies(self, dependencies, defaultValue):
187187

188188
return dependencies
189189

190-
def _check_and_set_is_public(self, isPublic, defaultValue):
191-
if isPublic is None:
190+
def _check_and_set_is_public(self, is_public, defaultValue):
191+
if is_public is None:
192192
return defaultValue
193193

194-
return isPublic
194+
return is_public
195195

196196
@state_lock
197197
def add_endpoint(
@@ -204,7 +204,7 @@ def add_endpoint(
204204
target=None,
205205
dependencies=None,
206206
schema=None,
207-
isPublic=None,
207+
is_public=None,
208208
):
209209
"""
210210
Add a new endpoint to the TabPy.
@@ -238,7 +238,7 @@ def add_endpoint(
238238
docstring, "-- no docstring found in query function --")
239239
endpoint_type = self._check_and_set_endpoint_type(endpoint_type, None)
240240
dependencies = self._check_and_set_dependencies(dependencies, [])
241-
isPublic = self._check_and_set_is_public(isPublic, False)
241+
is_public = self._check_and_set_is_public(is_public, False)
242242

243243
self._check_target(target)
244244
if target and target not in endpoints:
@@ -254,7 +254,7 @@ def add_endpoint(
254254
"creation_time": int(time()),
255255
"last_modified_time": int(time()),
256256
"schema": schema,
257-
"isPublic": isPublic,
257+
"is_public": is_public,
258258
}
259259

260260
endpoints[name] = endpoint_info
@@ -298,7 +298,7 @@ def update_endpoint(
298298
target=None,
299299
dependencies=None,
300300
schema=None,
301-
isPublic=None,
301+
is_public=None,
302302
):
303303
"""
304304
Update an existing endpoint on the TabPy.
@@ -340,7 +340,7 @@ def update_endpoint(
340340
endpoint_type, endpoint_info["type"])
341341
dependencies = self._check_and_set_dependencies(
342342
dependencies, endpoint_info.get("dependencies", []))
343-
isPublic = self._check_and_set_is_public(isPublic, endpoint_info["isPublic"])
343+
is_public = self._check_and_set_is_public(is_public, endpoint_info["is_public"])
344344

345345
self._check_target(target)
346346
if target and target not in endpoints:
@@ -363,7 +363,7 @@ def update_endpoint(
363363
"creation_time": endpoint_info["creation_time"],
364364
"last_modified_time": int(time()),
365365
"schema": schema,
366-
"isPublic": isPublic,
366+
"is_public": is_public,
367367
}
368368

369369
endpoints[name] = endpoint_info

tabpy/tabpy_tools/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def get_endpoints(self, type=None):
174174
"last_modified_time": 1469511182,
175175
"type": "model",
176176
"target": null,
177-
"isPublic": True}
177+
"is_public": True}
178178
"add": {
179179
"description": "",
180180
"docstring": "-- no docstring found in query function --",
@@ -184,7 +184,7 @@ def get_endpoints(self, type=None):
184184
"last_modified_time": 1469505967,
185185
"type": "model",
186186
"target": null,
187-
"isPublic": False}
187+
"is_public": False}
188188
}
189189
"""
190190
return self._service.get_endpoints(type)
@@ -193,7 +193,7 @@ def _get_endpoint_upload_destination(self):
193193
"""Returns the endpoint upload destination."""
194194
return self._service.get_endpoint_upload_destination()["path"]
195195

196-
def deploy(self, name, obj, description="", schema=None, override=False, isPublic=False):
196+
def deploy(self, name, obj, description="", schema=None, override=False, is_public=False):
197197
"""Deploys a Python function as an endpoint in the server.
198198
199199
Parameters
@@ -222,7 +222,7 @@ def deploy(self, name, obj, description="", schema=None, override=False, isPubli
222222
RuntimeError. If True and there is already an endpoint with that
223223
name, it will deploy a new version on top of it.
224224
225-
isPublic : bool, optional
225+
is_public : bool, optional
226226
Whether a function should be public for viewing from within tableau. If
227227
False, function will not appear in the custom functions explorer within
228228
Tableau. If True, function will be visible ta anyone on a site with this
@@ -244,7 +244,7 @@ def deploy(self, name, obj, description="", schema=None, override=False, isPubli
244244

245245
version = endpoint.version + 1
246246

247-
obj = self._gen_endpoint(name, obj, description, version, schema, isPublic)
247+
obj = self._gen_endpoint(name, obj, description, version, schema, is_public)
248248

249249
self._upload_endpoint(obj)
250250

@@ -264,7 +264,7 @@ def remove(self, name):
264264
Endpoint name to remove'''
265265
self._service.remove_endpoint(name)
266266

267-
def _gen_endpoint(self, name, obj, description, version=1, schema=None, isPublic=False):
267+
def _gen_endpoint(self, name, obj, description, version=1, schema=None, is_public=False):
268268
"""Generates an endpoint dict.
269269
270270
Parameters
@@ -282,7 +282,7 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, isPublic
282282
version : int
283283
The version. Defaults to 1.
284284
285-
isPublic : bool
285+
is_public : bool
286286
True if function should be visible in the custom functions explorer
287287
within Tableau
288288
@@ -330,7 +330,7 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, isPublic
330330
"required_files": [],
331331
"required_packages": [],
332332
"schema": copy.copy(schema),
333-
"isPublic": isPublic,
333+
"is_public": is_public,
334334
}
335335

336336
def _upload_endpoint(self, obj):

tabpy/tabpy_tools/rest_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Endpoint(RESTObject):
4747
evaluator = RESTProperty(str)
4848
schema_version = RESTProperty(int)
4949
schema = RESTProperty(str)
50-
isPublic = RESTProperty(bool)
50+
is_public = RESTProperty(bool)
5151

5252
def __new__(cls, **kwargs):
5353
"""Dispatch to the appropriate class."""
@@ -68,7 +68,7 @@ def __eq__(self, other):
6868
and self.evaluator == other.evaluator
6969
and self.schema_version == other.schema_version
7070
and self.schema == other.schema
71-
and self.isPublic == other.isPublic
71+
and self.is_public == other.is_public
7272
)
7373

7474

0 commit comments

Comments
 (0)