コード例 #1
0
ファイル: Printout.py プロジェクト: stefano-bragaglia/myclips
    def do(self, funcEnv, resourceId, *args, **kargs):
        """
        Retract function handler implementation
        """

        # convert <TYPE:value> to python value
        resourceId = Function.resolve(
            self, funcEnv,
            self.semplify(funcEnv, resourceId, types.Symbol, ("1", "symbol")))

        if resourceId != "nil":
            try:
                resource = funcEnv.RESOURCES[resourceId]
            except KeyError:
                raise InvalidArgValueError(
                    "Resource with logical name %s cannot be found" %
                    str(resourceId))
            else:

                #                for fragment in args:
                #
                #                    # revolve variables and function calls
                #                    fragment = self.resolve(funcEnv, self.semplify(funcEnv, fragment))
                #
                #                    resource.write(str(fragment))

                resource.write("".join([
                    str(self.resolve(funcEnv, self.semplify(funcEnv, x)))
                    for x in args
                ]))

        return types.NullValue()
コード例 #2
0
ファイル: Printout.py プロジェクト: julianpistorius/myclips
    def do(self, funcEnv, resourceId, *args, **kargs):
        """
        Retract function handler implementation
        """
        
        # convert <TYPE:value> to python value
        resourceId = Function.resolve(self, funcEnv, self.semplify(funcEnv, resourceId, types.Symbol, ("1", "symbol")))
        
        if resourceId != "nil":
            try:
                resource = funcEnv.RESOURCES[resourceId]
            except KeyError:
                raise InvalidArgValueError("Resource with logical name %s cannot be found"%str(resourceId))
            else:
            
#                for fragment in args:
#                    
#                    # revolve variables and function calls
#                    fragment = self.resolve(funcEnv, self.semplify(funcEnv, fragment))
#                    
#                    resource.write(str(fragment))
                    
                resource.write("".join([str(self.resolve(funcEnv, self.semplify(funcEnv, x))) for x in args]))
                    
        return types.NullValue()
コード例 #3
0
ファイル: Printout.py プロジェクト: stefano-bragaglia/myclips
 def resolve(self, funcEnv, arg):
     """
     Override Function.resolve to manage the <Symbol:crlf> conversion to NEWLINE
     and to remove quotes in types.String values
     """
     if isinstance(arg, types.Symbol) and arg.pyEqual("crlf"):
         return "\n"
     else:
         return Function.resolve(self, funcEnv, arg)
コード例 #4
0
ファイル: Printout.py プロジェクト: julianpistorius/myclips
 def resolve(self, funcEnv, arg):
     """
     Override Function.resolve to manage the <Symbol:crlf> conversion to NEWLINE
     and to remove quotes in types.String values
     """
     if isinstance(arg, types.Symbol) and arg.pyEqual("crlf"):
         return "\n"
     else:
         return Function.resolve(self, funcEnv, arg)