class_docstr: The TabPy state object that stores attributes
  about this TabPy and perform GET/SET on these
  attributes.
  
  Attributes:
      - name
      - description
      - endpoints (name, description, docstring, version, target)
      - revision number
  
  When the state object is initialized, the state is saved as a ConfigParser.
  There is a config to any attribute.
class_docstr_tok: ["The","TabPy","state","object","that","stores","attributes","about","this","TabPy","and","perform","GET\/SET","on","these","attributes",".","Attributes",":","-","name","-","description","-","endpoints","(","name",",","description",",","docstring",",","version",",","target",")","-","revision","number","When","the","state","object","is","initialized",",","the","state","is","saved","as","a","ConfigParser",".","There","is","a","config","to","any","attribute","."]
docstr: Delete an existing endpoint on the TabPy
  
  Parameters
  ----------
  name : str
      The name of the endpoint to be deleted.
  
  Returns
  -------
  deleted endpoint object
  
  Note:
  Cannot delete this endpoint if other endpoints are currently
  depending on this endpoint.
docstr_tok: ["Delete","an","existing","endpoint","on","the","TabPy","Parameters","--","--","--","--","--","name",":","str","The","name","of","the","endpoint","to","be","deleted",".","Returns","--","--","--","-","deleted","endpoint","object","Note",":","Can","not","delete","this","endpoint","if","other","endpoints","are","currently","depending","on","this","endpoint","."]
code: def delete_endpoint(self, name):
      """
      Delete an existing endpoint on the TabPy
  
      Parameters
      ----------
      name : str
          The name of the endpoint to be deleted.
  
      Returns
      -------
      deleted endpoint object
  
      Note:
      Cannot delete this endpoint if other endpoints are currently
      depending on this endpoint.
  
      """
      if not name or name == "":
          raise ValueError(
              "Name of the endpoint must be a valid string."
          )
      endpoints = self.get_endpoints()
      if name not in endpoints:
          raise ValueError(f"Endpoint {name} does not exist.")
  
      endpoint_to_delete = endpoints[name]
  
      # get dependencies and target
      deps = set()
      for endpoint_name in endpoints:
          if endpoint_name != name:
              deps_list = endpoints[endpoint_name].get(
                  "dependencies", []
              )
              if name in deps_list:
                  deps.add(endpoint_name)
  
      # check if other endpoints are depending on this endpoint
      if len(deps) > 0:
          raise ValueError(
              f"Cannot remove endpoint {name}, it is currently "
              f"used by {list(deps)} endpoints."
          )
  
      del endpoints[name]
  
      # delete the endpoint from state
      try:
          self._remove_config_option(
              _QUERY_OBJECT_DOCSTRING, name, _update_revision=False
          )
          self._remove_config_option(_DEPLOYMENT_SECTION_NAME, name)
  
          return endpoint_to_delete
      except Exception as e:
          logger.error(f"Unable to delete endpoint {e}")
          raise ValueError(f"Unable to delete endpoint: {e}")
  
imports: import json
  import logging
  from tabpy.tabpy_server.management.util import write_state_config
  from threading import Lock
  from time import time
label_desc: Use image node_id 14 for calling the TabPyState obj's underlying member method code with example usage: obj.delete_endpoint(name) and returns: endpoint_to_delete