
from calvin.runtime.south.calvinlib import base_calvinlib_object
import pystache


class Pystache(base_calvinlib_object.BaseCalvinlibObject):
    """
    Functions for manipulating strings.
    """

    init_schema = {
        "description": "setup mustache formated strings",
        "type": "object",
        "properties": {}
    }

    render = {
        "description": "convert dict structure into string",
        "type": "object",
        "properties": {
            "template": {"type": "string"},
            "dictionary": {"type": "dict"}
        }
    }

    def init(self):
        pass

    def render(self, template, *context, **kwargs):
        return pystache.render(template, *context, **kwargs)


from calvin.runtime.south.calvinlib import base_calvinlib_object
import pystache


class Pystache(base_calvinlib_object.BaseCalvinlibObject):
    """
    Module for formatting strings using Mustache-style templates.
    """

    render_schema = {
        "description": "Return template string rendered using given dictionary",
        "type": "object",
        "properties": {
            "template": {"type": "string"},
            "dictionary": {"type": "dict"}
        }
    }

    def init(self):
        pass

    def render(self, template, dictionary):
        return pystache.render(template, **dictionary)

Fix erroneous schema naming & others
calvinlib: Fix erroneous schema naming & others

  
  from calvin.runtime.south.calvinlib import base_calvinlib_object
  import pystache
  
  
  class Pystache(base_calvinlib_object.BaseCalvinlibObject):
      """
-     Functions for manipulating strings.
+     Module for formatting strings using Mustache-style templates.
      """
  
-     init_schema = {
+     render_schema = {
+         "description": "Return template string rendered using given dictionary",
-         "description": "setup mustache formated strings",
-         "type": "object",
-         "properties": {}
-     }
- 
-     render = {
-         "description": "convert dict structure into string",
          "type": "object",
          "properties": {
              "template": {"type": "string"},
              "dictionary": {"type": "dict"}
          }
      }
  
      def init(self):
          pass
  
-     def render(self, template, *context, **kwargs):
+     def render(self, template, dictionary):
-         return pystache.render(template, *context, **kwargs)
+         return pystache.render(template, **dictionary)
  
Fix erroneous schema naming & others
## Code Before:

from calvin.runtime.south.calvinlib import base_calvinlib_object
import pystache


class Pystache(base_calvinlib_object.BaseCalvinlibObject):
    """
    Functions for manipulating strings.
    """

    init_schema = {
        "description": "setup mustache formated strings",
        "type": "object",
        "properties": {}
    }

    render = {
        "description": "convert dict structure into string",
        "type": "object",
        "properties": {
            "template": {"type": "string"},
            "dictionary": {"type": "dict"}
        }
    }

    def init(self):
        pass

    def render(self, template, *context, **kwargs):
        return pystache.render(template, *context, **kwargs)

## Instruction:
Fix erroneous schema naming & others
## Code After:

from calvin.runtime.south.calvinlib import base_calvinlib_object
import pystache


class Pystache(base_calvinlib_object.BaseCalvinlibObject):
    """
    Module for formatting strings using Mustache-style templates.
    """

    render_schema = {
        "description": "Return template string rendered using given dictionary",
        "type": "object",
        "properties": {
            "template": {"type": "string"},
            "dictionary": {"type": "dict"}
        }
    }

    def init(self):
        pass

    def render(self, template, dictionary):
        return pystache.render(template, **dictionary)
