mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
491 B
18 lines
491 B
import StringIO |
|
import os |
|
|
|
class QOpen(StringIO.StringIO): |
|
def __init__(self, *args): |
|
self.__args = args |
|
StringIO.StringIO.__init__(self) |
|
|
|
def close(self): |
|
import StringIO, os |
|
fname = self.__args[0] |
|
if not os.access(fname, os.R_OK) or self.getvalue() != open(fname).read(): |
|
open(*self.__args).write(self.getvalue()) |
|
StringIO.StringIO.close(self) |
|
|
|
def __del__(self): |
|
if not self.closed: |
|
self.close()
|
|
|