Example #1
0
 def __init__(self, filepath: str, mode: str) -> None:
     self.original_mode = stat(filepath)[ST_MODE]
     self.mode_changed = False
     if mode in ("w", "a", "wb", "ab"):
         if not self.original_mode & S_IWRITE:
             chmod(filepath, self.original_mode | S_IWRITE)
             self.mode_changed = True
     FileIO.__init__(self, filepath, mode)
Example #2
0
 def __init__(self, filepath, mode):
     self.original_mode = stat(filepath)[ST_MODE]
     self.mode_changed = False
     if mode in ('w', 'a', 'wb', 'ab'):
         if not self.original_mode & S_IWRITE:
             chmod(filepath, self.original_mode | S_IWRITE)
             self.mode_changed = True
     FileIO.__init__(self, filepath, mode)
Example #3
0
 def __init__(self, filepath, mode):
     self.original_mode = stat(filepath)[ST_MODE]
     self.mode_changed = False
     if mode in ('w', 'a', 'wb', 'ab'):
         if not self.original_mode & S_IWRITE:
             chmod(filepath, self.original_mode | S_IWRITE)
             self.mode_changed = True
     FileIO.__init__(self, filepath, mode)
Example #4
0
 def close(self) -> None:
     """restore mode before closing"""
     self._restore_mode()
     FileIO.close(self)
Example #5
0
 def close(self):
     """restore mode before closing"""
     self._restore_mode()
     FileIO.close(self)