-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFSelement.py
35 lines (26 loc) · 838 Bytes
/
FSelement.py
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
import datetime
class Element(object):
def __init__(self, name, parent):
if isinstance( name, str ) and isinstance( parent, Folder ):
self.__name = name
self.__changeDate = datetime.datetime.now()
self.__parent = parent
if self != Folder.root: parent.addElement(self)
else:
raise Exception()
def getName(self):
return self.__name
def getSize(self):
return 0
def getChangeDate(self):
return self.__changeDate
def printInfo(self):
print (self.getName().ljust(20), str(self.getSize()).ljust(20), self.getType().ljust(14), str(self.getChangeDate()).ljust(26), sep="")
def getType(self):
return "Not a File or Folder"
def setName(self, name):
if isinstance( name, str ):
self.__name = name
return true
else:
raise Exception()