Skip to content

Commit

Permalink
updated isPublic to is_public to comform to python naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoens committed Sep 10, 2024
1 parent fa7aab2 commit fc80078
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions tabpy/tabpy_server/handlers/management_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _add_or_update_endpoint(self, action, name, version, request_data):
target = request_data.get("target", None)
schema = request_data.get("schema", None)
src_path = request_data.get("src_path", None)
isPublic = request_data.get("isPublic", None)
is_public = request_data.get("is_public", None)
target_path = get_query_object_path(
self.settings[SettingsParameters.StateFilePath], name, version
)
Expand Down Expand Up @@ -118,7 +118,7 @@ def _add_or_update_endpoint(self, action, name, version, request_data):
dependencies=dependencies,
target=target,
schema=schema,
isPublic=isPublic,
is_public=is_public,
)
else:
self.tabpy_state.update_endpoint(
Expand All @@ -131,7 +131,7 @@ def _add_or_update_endpoint(self, action, name, version, request_data):
target=target,
schema=schema,
version=version,
isPublic=isPublic,
is_public=is_public,
)

except Exception as e:
Expand Down
18 changes: 9 additions & 9 deletions tabpy/tabpy_server/management/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def _check_and_set_dependencies(self, dependencies, defaultValue):

return dependencies

def _check_and_set_is_public(self, isPublic, defaultValue):
if isPublic is None:
def _check_and_set_is_public(self, is_public, defaultValue):
if is_public is None:
return defaultValue

return isPublic
return is_public

@state_lock
def add_endpoint(
Expand All @@ -204,7 +204,7 @@ def add_endpoint(
target=None,
dependencies=None,
schema=None,
isPublic=None,
is_public=None,
):
"""
Add a new endpoint to the TabPy.
Expand Down Expand Up @@ -238,7 +238,7 @@ def add_endpoint(
docstring, "-- no docstring found in query function --")
endpoint_type = self._check_and_set_endpoint_type(endpoint_type, None)
dependencies = self._check_and_set_dependencies(dependencies, [])
isPublic = self._check_and_set_is_public(isPublic, False)
is_public = self._check_and_set_is_public(is_public, False)

self._check_target(target)
if target and target not in endpoints:
Expand All @@ -254,7 +254,7 @@ def add_endpoint(
"creation_time": int(time()),
"last_modified_time": int(time()),
"schema": schema,
"isPublic": isPublic,
"is_public": is_public,
}

endpoints[name] = endpoint_info
Expand Down Expand Up @@ -298,7 +298,7 @@ def update_endpoint(
target=None,
dependencies=None,
schema=None,
isPublic=None,
is_public=None,
):
"""
Update an existing endpoint on the TabPy.
Expand Down Expand Up @@ -340,7 +340,7 @@ def update_endpoint(
endpoint_type, endpoint_info["type"])
dependencies = self._check_and_set_dependencies(
dependencies, endpoint_info.get("dependencies", []))
isPublic = self._check_and_set_is_public(isPublic, endpoint_info["isPublic"])
is_public = self._check_and_set_is_public(is_public, endpoint_info["is_public"])

self._check_target(target)
if target and target not in endpoints:
Expand All @@ -363,7 +363,7 @@ def update_endpoint(
"creation_time": endpoint_info["creation_time"],
"last_modified_time": int(time()),
"schema": schema,
"isPublic": isPublic,
"is_public": is_public,
}

endpoints[name] = endpoint_info
Expand Down
16 changes: 8 additions & 8 deletions tabpy/tabpy_tools/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_endpoints(self, type=None):
"last_modified_time": 1469511182,
"type": "model",
"target": null,
"isPublic": True}
"is_public": True}
"add": {
"description": "",
"docstring": "-- no docstring found in query function --",
Expand All @@ -184,7 +184,7 @@ def get_endpoints(self, type=None):
"last_modified_time": 1469505967,
"type": "model",
"target": null,
"isPublic": False}
"is_public": False}
}
"""
return self._service.get_endpoints(type)
Expand All @@ -193,7 +193,7 @@ def _get_endpoint_upload_destination(self):
"""Returns the endpoint upload destination."""
return self._service.get_endpoint_upload_destination()["path"]

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

version = endpoint.version + 1

obj = self._gen_endpoint(name, obj, description, version, schema, isPublic)
obj = self._gen_endpoint(name, obj, description, version, schema, is_public)

self._upload_endpoint(obj)

Expand All @@ -264,7 +264,7 @@ def remove(self, name):
Endpoint name to remove'''
self._service.remove_endpoint(name)

def _gen_endpoint(self, name, obj, description, version=1, schema=None, isPublic=False):
def _gen_endpoint(self, name, obj, description, version=1, schema=None, is_public=False):
"""Generates an endpoint dict.
Parameters
Expand All @@ -282,7 +282,7 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, isPublic
version : int
The version. Defaults to 1.
isPublic : bool
is_public : bool
True if function should be visible in the custom functions explorer
within Tableau
Expand Down Expand Up @@ -330,7 +330,7 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, isPublic
"required_files": [],
"required_packages": [],
"schema": copy.copy(schema),
"isPublic": isPublic,
"is_public": is_public,
}

def _upload_endpoint(self, obj):
Expand Down
4 changes: 2 additions & 2 deletions tabpy/tabpy_tools/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Endpoint(RESTObject):
evaluator = RESTProperty(str)
schema_version = RESTProperty(int)
schema = RESTProperty(str)
isPublic = RESTProperty(bool)
is_public = RESTProperty(bool)

def __new__(cls, **kwargs):
"""Dispatch to the appropriate class."""
Expand All @@ -68,7 +68,7 @@ def __eq__(self, other):
and self.evaluator == other.evaluator
and self.schema_version == other.schema_version
and self.schema == other.schema
and self.isPublic == other.isPublic
and self.is_public == other.is_public
)


Expand Down

0 comments on commit fc80078

Please sign in to comment.