from treestore import Treestore
import settings


def get_treestore():
    return Treestore(**settings.TREESTORE_KWARGS)

def uri_from_tree_id(tree_id):
    return (settings.TREE_URI + tree_id)

def tree_id_from_uri(uri):
    if uri.startswith(settings.TREE_URI):
        uri = uri.replace(settings.TREE_URI, '', 1)
    return uri
from treestore import Treestore
import settings


def get_treestore():
    return Treestore(**settings.TREESTORE_KWARGS)

def uri_from_tree_id(tree_id):
    return Treestore.uri_from_id(tree_id, base_uri=settings.TREE_URI)

def tree_id_from_uri(uri):
    if uri.startswith(settings.TREE_URI):
        uri = uri.replace(settings.TREE_URI, '', 1)
    if uri.endswith('/'): uri = uri.rstrip('/')
    return uri
Use treestore to get URIs from IDs.
Use treestore to get URIs from IDs.

  from treestore import Treestore
  import settings
  
  
  def get_treestore():
      return Treestore(**settings.TREESTORE_KWARGS)
  
  def uri_from_tree_id(tree_id):
-     return (settings.TREE_URI + tree_id)
+     return Treestore.uri_from_id(tree_id, base_uri=settings.TREE_URI)
  
  def tree_id_from_uri(uri):
      if uri.startswith(settings.TREE_URI):
          uri = uri.replace(settings.TREE_URI, '', 1)
+     if uri.endswith('/'): uri = uri.rstrip('/')
      return uri
Use treestore to get URIs from IDs.
## Code Before:
from treestore import Treestore
import settings


def get_treestore():
    return Treestore(**settings.TREESTORE_KWARGS)

def uri_from_tree_id(tree_id):
    return (settings.TREE_URI + tree_id)

def tree_id_from_uri(uri):
    if uri.startswith(settings.TREE_URI):
        uri = uri.replace(settings.TREE_URI, '', 1)
    return uri
## Instruction:
Use treestore to get URIs from IDs.
## Code After:
from treestore import Treestore
import settings


def get_treestore():
    return Treestore(**settings.TREESTORE_KWARGS)

def uri_from_tree_id(tree_id):
    return Treestore.uri_from_id(tree_id, base_uri=settings.TREE_URI)

def tree_id_from_uri(uri):
    if uri.startswith(settings.TREE_URI):
        uri = uri.replace(settings.TREE_URI, '', 1)
    if uri.endswith('/'): uri = uri.rstrip('/')
    return uri