Exemple #1
0
        public PyVariable NewInstance(PyVariableFlags flags = PyVariableFlags.Object, List <object> arguments = null)
        {
            PyVariable instance = PyVariableManager.NewVariable(flags: flags);

            instance.CallAssign(new PythonFunction(this.ClassName), arguments);
            return(instance);
        }
Exemple #2
0
 public PyEventClassBuilder(string baseClass, Type classType = null)
 {
     this._itw          = new IndentedTextWriter(this._sw);
     this.BaseClassName = baseClass;
     this.ClassName     = PyVariableManager.GetFreeVariableName() + baseClass.Replace(".", string.Empty);;
     if (classType != null)
     {
         this.EventDest = classType.FullName;
     }
 }
        public PyFunctionBuilder(string functionName)
        {
            if (functionName == null)
            {
                functionName = "_f" + PyVariableManager.GetFreeVariableName();
            }
            this.Name   = functionName;
            this.Writer = new IndentedTextWriter(this._sw);

            // TODO: arguments (when and if they will be needed)
            Writer.WriteLine(string.Format("def {0}():", this.Name));
            Writer.Indent++;
        }
Exemple #4
0
 public void Dispose()
 {
     PyVariableManager.DestroyVariable(this.Name);
 }