Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Python parsing example



This article shows an example of parsing for a Python Script.

Script interface

Suppose the following script interface:
      public interface Script {
        public String execute();
      }

Python script

We have the following script:
      def execute(self):
        return context.getScriptFile().getName()

Final result

      import java
      from org.scripthelper.context import DefaultScriptContext
      from org.scripthelper.context import ContextListener
      from org.scripthelper.python.samples import Script
      class ScriptClass (Script, ContextListener):
      _ def __init__(self):
      _   self.context = None
      _ def init(self, ctx):
      _   self.context = ctx
      _ def execute(self):
      _   return 10

See also


Categories: dev | impls

Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence