-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.py
More file actions
41 lines (34 loc) · 993 Bytes
/
File.py
File metadata and controls
41 lines (34 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class File:
'''
File
name --> name of the file
timestamp --> timestamp of the last modification
path --> local path of the file
'''
def __init__(self, name, timestamp, path):
# file name
self.name = name
# timestamp of the last modification
self.timestamp = timestamp
# local path of the file
self.path = path
def __eq__(self, other):
'''
Override equality operator
'''
if isinstance(other, File):
return ((self.name == other.name) and
(self.timestamp == other.timestamp) and
(self.path == other.path))
return False
def __str__(self):
'''
Override string representation
'''
name = "name: " + self.name
path = "path: " + self.path
return "File:\n\t" \
+ name + "\n\t" \
+ path
if __name__ == '__main__':
pass