File indexing completed on 2024-09-22 04:08:47
0001 """ 0002 SPDX-FileCopyrightText: 2017 Eliakin Costa <eliakim170@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 """ 0006 0007 class Document(object): 0008 0009 def __init__(self, filePath): 0010 self._document = [] 0011 self._filePath = filePath 0012 0013 def open(self, filePath=''): 0014 if filePath: 0015 self._filePath = filePath 0016 0017 with open(self._filePath, 'r') as pythonFile: 0018 self._document = pythonFile.read() 0019 0020 def save(self): 0021 with open(self._filePath, 'w') as pythonFile: 0022 pythonFile.write(self._document) 0023 0024 def compare(self, new_doc): 0025 if len(self._document) != len(new_doc): 0026 return False 0027 0028 if new_doc != self._document: 0029 return False 0030 0031 return True 0032 0033 @property 0034 def data(self): 0035 return self._document 0036 0037 @data.setter 0038 def data(self, data): 0039 self._document = data 0040 0041 @property 0042 def filePath(self): 0043 return self._filePath