Esempio n. 1
0
 def makeFile(self,contents,mode,start=0,stop=None,resizable=False):
     s = StringIO(contents)
     f = Slice(s,start,stop,resizable=resizable,mode=mode)
     def getvalue():
         val = s.getvalue()
         if stop:
             val = val[:f.stop]
         if start:
             val = val[f.start:]
         return val
     f.getvalue = getvalue
     return f
Esempio n. 2
0
    def makeFile(self, contents, mode, start=0, stop=None, resizable=False):
        s = StringIO(contents)
        f = Slice(s, start, stop, resizable=resizable, mode=mode)

        def getvalue():
            val = s.getvalue()
            if stop:
                val = val[:f.stop]
            if start:
                val = val[f.start:]
            return val

        f.getvalue = getvalue
        return f